aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog17
-rw-r--r--gdb/NEWS7
-rw-r--r--gdb/breakpoint.c77
-rw-r--r--gdb/doc/ChangeLog5
-rw-r--r--gdb/doc/gdb.texinfo5
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/commands.exp6
-rw-r--r--gdb/testsuite/gdb.cp/extern-c.exp2
8 files changed, 90 insertions, 34 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b29508e..a40533c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,22 @@
2010-04-01 Pedro Alves <pedro@codesourcery.com>
+ * breakpoint.c (multi_start, multi_end, last_was_multi): Delete.
+ (prev_breakpoint_count): New.
+ (set_breakpoint_count): Adjust.
+ (rbreak_start_breakpoint_count): New.
+ (start_rbreak_breakpoints): Adjust.
+ (end_rbreak_breakpoints): Adjust.
+ (struct commands_info) <arg>: New field.
+ (do_map_commands_command): Tweak output to include breakpoint spec
+ range.
+ (commands_command_1): Adjust. Avoid setting an xfree cleanup if
+ ARG was empty on entry. Set INFO's arg.
+ (create_breakpoint): Adjust.
+
+ * NEWS: Clarify `commands' changes.
+
+2010-04-01 Pedro Alves <pedro@codesourcery.com>
+
* tracepoint.c: Include stack.h.
(struct add_local_symbols_data): New.
(do_collect_symbol): New.
diff --git a/gdb/NEWS b/gdb/NEWS
index 0d27faa..3d12fbe 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -17,8 +17,11 @@
register EAX or 64-bit register RAX.
* The `commands' command now accepts a range of breakpoints to modify.
- A plain `commands' following an `rbreak' will affect all the
- breakpoints set by `rbreak'.
+ A plain `commands' following a command that creates multiple
+ breakpoints affects all the breakpoints set by that command. This
+ applies to breakpoints set by `rbreak', and also applies when a
+ single `break' command creates multiple breakpoints (e.g.,
+ breakpoints on overloaded c++ functions).
* Python scripting
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index dfd93f8..01ec269 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -388,13 +388,11 @@ VEC(bp_location_p) *moribund_locations = NULL;
static int breakpoint_count;
-/* If the last command to create a breakpoint created multiple
- breakpoints, this holds the start and end breakpoint numbers. */
-static int multi_start;
-static int multi_end;
-/* True if the last breakpoint set was part of a group set with a
- single command, e.g., "rbreak". */
-static int last_was_multi;
+/* The value of `breakpoint_count' before the last command that
+ created breakpoints. If the last (break-like) command created more
+ than one breakpoint, then the difference between BREAKPOINT_COUNT
+ and PREV_BREAKPOINT_COUNT is more than one. */
+static int prev_breakpoint_count;
/* Number of last tracepoint made. */
@@ -412,29 +410,31 @@ breakpoint_enabled (struct breakpoint *b)
static void
set_breakpoint_count (int num)
{
+ prev_breakpoint_count = breakpoint_count;
breakpoint_count = num;
- last_was_multi = 0;
set_internalvar_integer (lookup_internalvar ("bpnum"), num);
}
+/* Used by `start_rbreak_breakpoints' below, to record the current
+ breakpoint count before "rbreak" creates any breakpoint. */
+static int rbreak_start_breakpoint_count;
+
/* Called at the start an "rbreak" command to record the first
breakpoint made. */
+
void
start_rbreak_breakpoints (void)
{
- multi_start = breakpoint_count + 1;
+ rbreak_start_breakpoint_count = breakpoint_count;
}
/* Called at the end of an "rbreak" command to record the last
breakpoint made. */
+
void
end_rbreak_breakpoints (void)
{
- if (breakpoint_count >= multi_start)
- {
- multi_end = breakpoint_count;
- last_was_multi = 1;
- }
+ prev_breakpoint_count = rbreak_start_breakpoint_count;
}
/* Used in run_command to zero the hit count when a new run starts. */
@@ -894,9 +894,14 @@ struct commands_info
{
/* True if the command was typed at a tty. */
int from_tty;
+
+ /* The breakpoint range spec. */
+ char *arg;
+
/* Non-NULL if the body of the commands are being read from this
already-parsed command. */
struct command_line *control;
+
/* The command lines read from the user, or NULL if they have not
yet been read. */
struct counted_command_line *cmd;
@@ -917,12 +922,23 @@ do_map_commands_command (struct breakpoint *b, void *data)
if (info->control != NULL)
l = copy_command_lines (info->control->body_list[0]);
else
+ {
+ struct cleanup *old_chain;
+ char *str;
+
+ str = xstrprintf (_("Type commands for breakpoint(s) %s, one per line."),
+ info->arg);
- l = read_command_lines (_("Type commands for all specified breakpoints"),
- info->from_tty, 1,
- (breakpoint_is_tracepoint (b)
- ? check_tracepoint_command : 0),
- b);
+ old_chain = make_cleanup (xfree, str);
+
+ l = read_command_lines (str,
+ info->from_tty, 1,
+ (breakpoint_is_tracepoint (b)
+ ? check_tracepoint_command : 0),
+ b);
+
+ do_cleanups (old_chain);
+ }
info->cmd = alloc_counted_command_line (l);
}
@@ -955,16 +971,27 @@ commands_command_1 (char *arg, int from_tty, struct command_line *control)
if (arg == NULL || !*arg)
{
- if (last_was_multi)
- arg = xstrprintf ("%d-%d", multi_start, multi_end);
+ if (breakpoint_count - prev_breakpoint_count > 1)
+ arg = xstrprintf ("%d-%d", prev_breakpoint_count + 1, breakpoint_count);
else if (breakpoint_count > 0)
arg = xstrprintf ("%d", breakpoint_count);
+ else
+ {
+ /* So that we don't try to free the incoming non-NULL
+ argument in the cleanup below. Mapping breakpoint
+ numbers will fail in this case. */
+ arg = NULL;
+ }
}
else
/* The command loop has some static state, so we need to preserve
our argument. */
arg = xstrdup (arg);
- make_cleanup (xfree, arg);
+
+ if (arg != NULL)
+ make_cleanup (xfree, arg);
+
+ info.arg = arg;
map_breakpoint_numbers (arg, do_map_commands_command, &info);
@@ -7239,7 +7266,7 @@ create_breakpoint (struct gdbarch *gdbarch,
int not_found = 0;
enum bptype type_wanted;
int task = 0;
- int first_bp_set = breakpoint_count + 1;
+ int prev_bkpt_count = breakpoint_count;
sals.sals = NULL;
sals.nelts = 0;
@@ -7399,9 +7426,7 @@ create_breakpoint (struct gdbarch *gdbarch,
{
warning (_("Multiple breakpoints were set.\n"
"Use the \"delete\" command to delete unwanted breakpoints."));
- multi_start = first_bp_set;
- multi_end = breakpoint_count;
- last_was_multi = 1;
+ prev_breakpoint_count = prev_bkpt_count;
}
/* That's it. Discard the cleanups for data inserted into the
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 5cbd9c5..a792152 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2010-04-01 Pedro Alves <pedro@codesourcery.com>
+
+ * gdb.texinfo (Break Commands): Clarify `commands' changes, and
+ add cross reference.
+
2010-03-31 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (TUI Commands): Mention that in some cases, these
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index c9b1d08..5e02172 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -4343,8 +4343,9 @@ watchpoint, or catchpoint set (not to the breakpoint most recently
encountered). If the most recent breakpoints were set with a single
command, then the @code{commands} will apply to all the breakpoints
set by that command. This applies to breakpoints set by
-@code{rbreak}, and also breakpoints set with @code{break} that have
-multiple locations.
+@code{rbreak}, and also applies when a single @code{break} command
+creates multiple breakpoints (@pxref{Ambiguous Expressions,,Ambiguous
+Expressions}).
@end table
Pressing @key{RET} as a means of repeating the last @value{GDBN} command is
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 5f48f55..61f6193 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2010-04-01 Pedro Alves <pedro@codesourcery.com>
+ * gdb.base/commands.exp: Adjust.
+ * gdb.cp/extern-c.exp: Adjust.
+
+2010-04-01 Pedro Alves <pedro@codesourcery.com>
+
* gdb.trace/collection.c (local_test_func): Define a local struct,
and instanciate it.
diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp
index ee3d787..bc81f06 100644
--- a/gdb/testsuite/gdb.base/commands.exp
+++ b/gdb/testsuite/gdb.base/commands.exp
@@ -299,7 +299,7 @@ proc watchpoint_command_test {} {
send_gdb "commands $wp_id\n"
gdb_expect {
- -re "Type commands for all specified breakpoints.*>" {
+ -re "Type commands for breakpoint.*, one per line.*>" {
pass "begin commands on watch"
}
-re "$gdb_prompt $" {fail "begin commands on watch"}
@@ -452,7 +452,7 @@ proc bp_deleted_in_command_test {} {
send_gdb "commands\n"
gdb_expect {
- -re "Type commands for all specified breakpoints.*>" {
+ -re "Type commands for breakpoint.*>" {
pass "begin commands in bp_deleted_in_command_test"
}
-re "$gdb_prompt $" {fail "begin commands in bp_deleted_in_command_test"}
@@ -519,7 +519,7 @@ proc temporary_breakpoint_commands {} {
send_gdb "commands\n"
gdb_expect {
- -re "Type commands for all specified breakpoints.*>" {
+ -re "Type commands for breakpoint.*>" {
pass "begin commands in bp_deleted_in_command_test"
}
-re "$gdb_prompt $" {fail "begin commands in bp_deleted_in_command_test"}
diff --git a/gdb/testsuite/gdb.cp/extern-c.exp b/gdb/testsuite/gdb.cp/extern-c.exp
index 5ad4e9c..275ef2d 100644
--- a/gdb/testsuite/gdb.cp/extern-c.exp
+++ b/gdb/testsuite/gdb.cp/extern-c.exp
@@ -48,7 +48,7 @@ gdb_test "rbreak c_funcs" \
# Test that "commands" without an argument puts commands on both
# breakpoints.
gdb_test_multiple "commands" "set commands on multiple breakpoints" {
- -re "Type commands for all specified breakpoints\r\nEnd with a line saying just \"end\".\r\n>$" {
+ -re "Type commands for breakpoint\\(s\\) 3-4, one per line\.\r\nEnd with a line saying just \"end\".\r\n>$" {
gdb_test_multiple "set \$counter = \$counter + 1\nend" \
"command details for multiple breakpoints" {
-re "$gdb_prompt $" {