aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2010-02-12 00:47:53 +0000
committerPedro Alves <palves@redhat.com>2010-02-12 00:47:53 +0000
commitfd9b8c249a7a95cc869675f09634e62c808483bc (patch)
tree136ef6ae930765c16ca569db55da63002254e2b5
parent28ed0eccaa5aaede7dd1b3bc3396814ca9d86939 (diff)
downloadgdb-fd9b8c249a7a95cc869675f09634e62c808483bc.zip
gdb-fd9b8c249a7a95cc869675f09634e62c808483bc.tar.gz
gdb-fd9b8c249a7a95cc869675f09634e62c808483bc.tar.bz2
* breakpoint.c (break_command_really): Change return type to int.
Return false if no breakpoint was created, true otherwise. (trace_command): Don't set the tracepoint count if no tracepoint was created. (ftrace_command): Ditto. (create_tracepoint_from_upload): Bail out if the tracepoint wasn't created in the breakpoints table.
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/breakpoint.c98
2 files changed, 61 insertions, 47 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0cd8fd7..b3c083b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+2010-02-12 Pedro Alves <pedro@codesourcery.com>
+
+ * breakpoint.c (break_command_really): Change return type to int.
+ Return false if no breakpoint was created, true otherwise.
+ (trace_command): Don't set the tracepoint count if no tracepoint
+ was created.
+ (ftrace_command): Ditto.
+ (create_tracepoint_from_upload): Bail out if the tracepoint wasn't
+ created in the breakpoints table.
+
2010-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
Ulrich Weigand <uweigand@de.ibm.com>
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 4b2daf0..574ecdf 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -6722,17 +6722,16 @@ find_condition_and_thread (char *tok, CORE_ADDR pc,
}
}
-/* Set a breakpoint. This function is shared between
- CLI and MI functions for setting a breakpoint.
- This function has two major modes of operations,
- selected by the PARSE_CONDITION_AND_THREAD parameter.
- If non-zero, the function will parse arg, extracting
- breakpoint location, address and thread. Otherwise,
- ARG is just the location of breakpoint, with condition
- and thread specified by the COND_STRING and THREAD
- parameters. */
+/* Set a breakpoint. This function is shared between CLI and MI
+ functions for setting a breakpoint. This function has two major
+ modes of operations, selected by the PARSE_CONDITION_AND_THREAD
+ parameter. If non-zero, the function will parse arg, extracting
+ breakpoint location, address and thread. Otherwise, ARG is just the
+ location of breakpoint, with condition and thread specified by the
+ COND_STRING and THREAD parameters. Returns true if any breakpoint
+ was created; false otherwise. */
-static void
+static int
break_command_really (struct gdbarch *gdbarch,
char *arg, char *cond_string, int thread,
int parse_condition_and_thread,
@@ -6793,7 +6792,7 @@ break_command_really (struct gdbarch *gdbarch,
selects no, then simply return the error code. */
if (pending_break_support == AUTO_BOOLEAN_AUTO
&& !nquery ("Make breakpoint pending on future shared library load? "))
- return;
+ return 0;
/* At this point, either the user was queried about setting
a pending breakpoint and selected yes, or pending
@@ -6811,7 +6810,7 @@ break_command_really (struct gdbarch *gdbarch,
}
default:
if (!sals.nelts)
- return;
+ return 0;
}
/* Create a chain of things that always need to be cleaned up. */
@@ -6923,6 +6922,8 @@ break_command_really (struct gdbarch *gdbarch,
/* error call may happen here - have BKPT_CHAIN already discarded. */
update_global_location_list (1);
+
+ return 1;
}
/* Set a breakpoint.
@@ -9789,33 +9790,33 @@ set_tracepoint_count (int num)
void
trace_command (char *arg, int from_tty)
{
- break_command_really (get_current_arch (),
- arg,
- NULL, 0, 1 /* parse arg */,
- 0 /* tempflag */, 0 /* hardwareflag */,
- 1 /* traceflag */,
- 0 /* Ignore count */,
- pending_break_support,
- NULL,
- from_tty,
- 1 /* enabled */);
- set_tracepoint_count (breakpoint_count);
+ if (break_command_really (get_current_arch (),
+ arg,
+ NULL, 0, 1 /* parse arg */,
+ 0 /* tempflag */, 0 /* hardwareflag */,
+ 1 /* traceflag */,
+ 0 /* Ignore count */,
+ pending_break_support,
+ NULL,
+ from_tty,
+ 1 /* enabled */))
+ set_tracepoint_count (breakpoint_count);
}
void
ftrace_command (char *arg, int from_tty)
{
- break_command_really (get_current_arch (),
- arg,
- NULL, 0, 1 /* parse arg */,
- 0 /* tempflag */, 1 /* hardwareflag */,
- 1 /* traceflag */,
- 0 /* Ignore count */,
- pending_break_support,
- NULL,
- from_tty,
- 1 /* enabled */);
- set_tracepoint_count (breakpoint_count);
+ if (break_command_really (get_current_arch (),
+ arg,
+ NULL, 0, 1 /* parse arg */,
+ 0 /* tempflag */, 1 /* hardwareflag */,
+ 1 /* traceflag */,
+ 0 /* Ignore count */,
+ pending_break_support,
+ NULL,
+ from_tty,
+ 1 /* enabled */))
+ set_tracepoint_count (breakpoint_count);
}
/* Given information about a tracepoint as recorded on a target (which
@@ -9829,24 +9830,27 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
{
char buf[100];
struct breakpoint *tp;
-
+
/* In the absence of a source location, fall back to raw address. */
sprintf (buf, "*%s", paddress (get_current_arch(), utp->addr));
- break_command_really (get_current_arch (),
- buf,
- NULL, 0, 1 /* parse arg */,
- 0 /* tempflag */,
- (utp->type == bp_fast_tracepoint) /* hardwareflag */,
- 1 /* traceflag */,
- 0 /* Ignore count */,
- pending_break_support,
- NULL,
- 0 /* from_tty */,
- utp->enabled /* enabled */);
+ if (!break_command_really (get_current_arch (),
+ buf,
+ NULL, 0, 1 /* parse arg */,
+ 0 /* tempflag */,
+ (utp->type == bp_fast_tracepoint) /* hardwareflag */,
+ 1 /* traceflag */,
+ 0 /* Ignore count */,
+ pending_break_support,
+ NULL,
+ 0 /* from_tty */,
+ utp->enabled /* enabled */))
+ return NULL;
+
set_tracepoint_count (breakpoint_count);
- tp = get_tracepoint (tracepoint_count);
+ tp = get_tracepoint (tracepoint_count);
+ gdb_assert (tp != NULL);
if (utp->pass > 0)
{