aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-04-08 14:09:30 +0000
committerPedro Alves <palves@redhat.com>2013-04-08 14:09:30 +0000
commitf6de8ec2620da62f46cb4e3887b981677cdd9cdb (patch)
treeb9a0d682130d2443d1a850a87384ee8f005b17f8 /gdb/breakpoint.c
parentf65ce5fb99ce664302abe4af1263fdbb0518d069 (diff)
downloadgdb-f6de8ec2620da62f46cb4e3887b981677cdd9cdb.zip
gdb-f6de8ec2620da62f46cb4e3887b981677cdd9cdb.tar.gz
gdb-f6de8ec2620da62f46cb4e3887b981677cdd9cdb.tar.bz2
create_breapoint / explicit mode: Error out if there's garbage after the breakpoint location.
If !PARSE_CONDITION_AND_THREAD, then ARG is just the location, nothing else. The fact that the describing comment of create_breakpoint doesn't mention this just looks like an oversight of when extra_string was added. "parse_condition_and_thread" has been a misnomer ever since extra_string was added -- better rename it avoid more confusion. This makes it "parse_arg", as that'll remain stable even if/when more explicit parameters are added. gdb/ 2013-04-08 Pedro Alves <palves@redhat.com> Keith Seitz <keiths@redhat.com> * breakpoint.c (create_breakpoint): Rename "parse_condition_and_thread" parameter to "parse_arg". Update describing comment. If !PARSE_ARG, then error out if ARG is not the empty string after extracting the location. * breakpoint.h (create_breakpoint): Rename "parse_condition_and_thread" parameter to "parse_arg". gdb/testsuite/ 2013-04-08 Pedro Alves <palves@redhat.com> * gdb.mi/mi-break.exp (test_error): Add tests with garbage after the location.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 5ba1f2f..667bedd 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -9510,20 +9510,20 @@ decode_static_tracepoint_spec (char **arg_p)
/* 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. If INTERNAL is non-zero,
- the breakpoint number will be allocated from the internal
- breakpoint count. Returns true if any breakpoint was created;
- false otherwise. */
+ modes of operations, selected by the PARSE_ARG parameter. If
+ non-zero, the function will parse ARG, extracting location,
+ condition, thread and extra string. Otherwise, ARG is just the
+ breakpoint's location, with condition, thread, and extra string
+ specified by the COND_STRING, THREAD and EXTRA_STRING parameters.
+ If INTERNAL is non-zero, the breakpoint number will be allocated
+ from the internal breakpoint count. Returns true if any breakpoint
+ was created; false otherwise. */
int
create_breakpoint (struct gdbarch *gdbarch,
char *arg, char *cond_string,
int thread, char *extra_string,
- int parse_condition_and_thread,
+ int parse_arg,
int tempflag, enum bptype type_wanted,
int ignore_count,
enum auto_boolean pending_break_support,
@@ -9641,7 +9641,7 @@ create_breakpoint (struct gdbarch *gdbarch,
lsal = VEC_index (linespec_sals, canonical.sals, 0);
- if (parse_condition_and_thread)
+ if (parse_arg)
{
char *rest;
/* Here we only parse 'arg' to separate condition
@@ -9660,6 +9660,9 @@ create_breakpoint (struct gdbarch *gdbarch,
}
else
{
+ if (*arg != '\0')
+ error (_("Garbage '%s' at end of location"), arg);
+
/* Create a private copy of condition string. */
if (cond_string)
{
@@ -9699,7 +9702,7 @@ create_breakpoint (struct gdbarch *gdbarch,
init_raw_breakpoint_without_location (b, gdbarch, type_wanted, ops);
b->addr_string = copy_arg;
- if (parse_condition_and_thread)
+ if (parse_arg)
b->cond_string = NULL;
else
{