aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-01-22 20:19:40 +0000
committerPedro Alves <palves@redhat.com>2013-01-22 20:19:40 +0000
commit9c97429fb1870f53e69556e967d01ce01116b35e (patch)
tree15efcb9b83fb956edfffec9d50002abb91811e87 /gdb
parentbd00c69423eff0d06f1632cfb50ccb5d8ab58151 (diff)
downloadgdb-9c97429fb1870f53e69556e967d01ce01116b35e.zip
gdb-9c97429fb1870f53e69556e967d01ce01116b35e.tar.gz
gdb-9c97429fb1870f53e69556e967d01ce01116b35e.tar.bz2
All annotate_breakpoints_changed calls are along-side
observer_notify_breakpoints_changed calls. All, except the init_raw_breakpoint one. But that one is actually wrong. The breakpoint is being constructed at that point, and hasn't been placed on the breakpoint chain yet. It would be better placed in install_breakpoint, and I actually started out that way. But once the annotate_breakpoints_changed are parallel to the observer calls, we can fully move annotations to observers too. One issue is that this changes the order of annotations a bit. Before, we'd emit the annotation, and after call "mention()" on the breakpoint (which prints the breakpoint number, etc.). But, we call the observers _after_ mention is called, so the annotation output will change a little: void install_breakpoint (int internal, struct breakpoint *b, int update_gll) { add_to_breakpoint_chain (b); set_breakpoint_number (internal, b); if (is_tracepoint (b)) set_tracepoint_count (breakpoint_count); if (!internal) mention (b); observer_notify_breakpoint_created (b); if (update_gll) update_global_location_list (1); } I believe this order doesn't really matter (the frontend needs to wait for the prompt anyway), so I just adjust the expected output in the tests. Emacs in annotations mode doesn't seem to complain. Couple that with the previous patch that suppressed duplicated annotations, and, the fact that some annotations calls were actually missing (were we do have observer calls), more changes to the tests are needed anyway. Tested on x86_64 Fedora 17. gdb/ 2013-01-22 Pedro Alves <palves@redhat.com> * annotate.c (annotate_breakpoints_changed): Rename to ... (annotate_breakpoints_invalid): ... this. Make static. (breakpoint_changed): Adjust. (_initialize_annotate): Always install the observers. Install a "breakpoint_created" observer. * annotate.h (annotate_breakpoints_changed): Delete declaration. * breakpoint.c (set_breakpoint_condition) (breakpoint_set_commands, do_map_commands_command) (init_raw_breakpoint, clear_command, set_ignore_count) (enable_breakpoint_disp): No longer call annotate_breakpoints_changed. gdb/testsuite/ 2013-01-22 Pedro Alves <palves@redhat.com> * gdb.base/annota1.exp (breakpoints_invalid): New variable. Adjust tests to breakpoints-invalid changes. * gdb.cp/annota2.exp (breakpoints_invalid, frames_invalid): New variables. Adjust tests to breakpoints-invalid changes.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog14
-rw-r--r--gdb/annotate.c16
-rw-r--r--gdb/annotate.h2
-rw-r--r--gdb/breakpoint.c10
-rw-r--r--gdb/testsuite/ChangeLog8
-rw-r--r--gdb/testsuite/gdb.base/annota1.exp19
-rw-r--r--gdb/testsuite/gdb.cp/annota2.exp15
7 files changed, 49 insertions, 35 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 48f5ad0..adc2217 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,19 @@
2013-01-22 Pedro Alves <palves@redhat.com>
+ * annotate.c (annotate_breakpoints_changed): Rename to ...
+ (annotate_breakpoints_invalid): ... this. Make static.
+ (breakpoint_changed): Adjust.
+ (_initialize_annotate): Always install the observers. Install a
+ "breakpoint_created" observer.
+ * annotate.h (annotate_breakpoints_changed): Delete declaration.
+ * breakpoint.c (set_breakpoint_condition)
+ (breakpoint_set_commands, do_map_commands_command)
+ (init_raw_breakpoint, clear_command, set_ignore_count)
+ (enable_breakpoint_disp): No longer call
+ annotate_breakpoints_changed.
+
+2013-01-22 Pedro Alves <palves@redhat.com>
+
* annotate.c: Include "inferior.h".
(frames_invalid_emitted)
(breakpoints_invalid_emitted): New globals.
diff --git a/gdb/annotate.c b/gdb/annotate.c
index 387467b..d82daa2 100644
--- a/gdb/annotate.c
+++ b/gdb/annotate.c
@@ -63,9 +63,9 @@ print_value_flags (struct type *t)
else
printf_filtered (("-"));
}
-
-void
-annotate_breakpoints_changed (void)
+
+static void
+annotate_breakpoints_invalid (void)
{
if (annotation_level == 2
&& (!breakpoints_invalid_emitted
@@ -575,15 +575,13 @@ annotate_display_prompt (void)
static void
breakpoint_changed (struct breakpoint *b)
{
- annotate_breakpoints_changed ();
+ annotate_breakpoints_invalid ();
}
void
_initialize_annotate (void)
{
- if (annotation_level == 2)
- {
- observer_attach_breakpoint_deleted (breakpoint_changed);
- observer_attach_breakpoint_modified (breakpoint_changed);
- }
+ observer_attach_breakpoint_created (breakpoint_changed);
+ observer_attach_breakpoint_deleted (breakpoint_changed);
+ observer_attach_breakpoint_modified (breakpoint_changed);
}
diff --git a/gdb/annotate.h b/gdb/annotate.h
index 73a3098..72c4f19 100644
--- a/gdb/annotate.h
+++ b/gdb/annotate.h
@@ -19,8 +19,6 @@
#include "symtab.h"
#include "gdbtypes.h"
-extern void annotate_breakpoints_changed (void);
-
extern void annotate_breakpoint (int);
extern void annotate_catchpoint (int);
extern void annotate_watchpoint (int);
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 35848b4..216ac73 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -985,7 +985,6 @@ set_breakpoint_condition (struct breakpoint *b, char *exp,
}
mark_breakpoint_modified (b);
- annotate_breakpoints_changed ();
observer_notify_breakpoint_modified (b);
}
@@ -1217,7 +1216,6 @@ breakpoint_set_commands (struct breakpoint *b,
decref_counted_command_line (&b->commands);
b->commands = alloc_counted_command_line (commands);
- annotate_breakpoints_changed ();
observer_notify_breakpoint_modified (b);
}
@@ -1334,7 +1332,6 @@ do_map_commands_command (struct breakpoint *b, void *data)
incref_counted_command_line (info->cmd);
decref_counted_command_line (&b->commands);
b->commands = info->cmd;
- annotate_breakpoints_changed ();
observer_notify_breakpoint_modified (b);
}
}
@@ -7072,8 +7069,6 @@ init_raw_breakpoint (struct breakpoint *b, struct gdbarch *gdbarch,
program space. */
if (bptype != bp_breakpoint && bptype != bp_hardware_breakpoint)
b->pspace = sal.pspace;
-
- annotate_breakpoints_changed ();
}
/* set_raw_breakpoint is a low level routine for allocating and
@@ -12053,7 +12048,6 @@ clear_command (char *arg, int from_tty)
else
printf_unfiltered (_("Deleted breakpoints "));
}
- annotate_breakpoints_changed ();
for (ix = 0; VEC_iterate(breakpoint_p, found, ix, b); ix++)
{
@@ -14441,7 +14435,6 @@ set_ignore_count (int bptnum, int count, int from_tty)
"crossings of breakpoint %d."),
count, bptnum);
}
- annotate_breakpoints_changed ();
observer_notify_breakpoint_modified (b);
return;
}
@@ -14706,8 +14699,7 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
bpt->disposition = disposition;
bpt->enable_count = count;
update_global_location_list (1);
- annotate_breakpoints_changed ();
-
+
observer_notify_breakpoint_modified (bpt);
}
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 5d3ed12..dd92509 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,13 @@
2013-01-22 Pedro Alves <palves@redhat.com>
+ * gdb.base/annota1.exp (breakpoints_invalid): New variable.
+ Adjust tests to breakpoints-invalid changes.
+ * gdb.cp/annota2.exp (breakpoints_invalid, frames_invalid): New
+ variables.
+ Adjust tests to breakpoints-invalid changes.
+
+2013-01-22 Pedro Alves <palves@redhat.com>
+
* gdb.base/annota1.exp (annotate ignore count change): Add
expected output for failure case.
diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
index 776738a..45638ba 100644
--- a/gdb/testsuite/gdb.base/annota1.exp
+++ b/gdb/testsuite/gdb.base/annota1.exp
@@ -25,6 +25,7 @@ if [is_remote target] then {
return 0
}
+set breakpoints_invalid "\r\n\032\032breakpoints-invalid\r\n"
#
# test running programs
@@ -190,7 +191,7 @@ gdb_test_multiple "print non_existent_value" "print non_existent_value" {
# we can test annotate-signal-handler-caller
#
gdb_test_multiple "break handle_USR1" "break handle_USR1" {
- -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex: file.*$srcfile, line.*\r\n$gdb_prompt$" {
+ -re "\r\n\032\032post-prompt\r\nBreakpoint.*at $hex: file.*$srcfile, line.*\r\n\032\032breakpoints-invalid\r\n.*$gdb_prompt$" {
pass "break handle_USR1"
}
}
@@ -199,7 +200,7 @@ gdb_test_multiple "break handle_USR1" "break handle_USR1" {
# break at printf. When we are stopped at printf, we can test
#
gdb_test_multiple "break printf" "break printf" {
- -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex.*$gdb_prompt$" {
+ -re "\r\n\032\032post-prompt\r\nBreakpoint.*at $hex.*\032\032breakpoints-invalid\r\n.*$gdb_prompt$" {
pass "break printf"
}
-re "\r\n\032\032post-prompt\r\nwarning: Breakpoint address adjusted from $hex to $hex.\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex.*$gdb_prompt$" {
@@ -210,7 +211,7 @@ gdb_test_multiple "break printf" "break printf" {
#
# get to printf
#
-set pat_begin "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n"
+set pat_begin "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n${breakpoints_invalid}"
set pat_adjust "warning: Breakpoint 3 address previously adjusted from $hex to $hex.\r\n"
set pat_end "\r\n\032\032breakpoint 3\r\n\r\nBreakpoint 3, \r\n\032\032frame-begin 0 $hex\r\n\r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*.*\032\032frame-function-name\r\n.*printf(@.*)?\r\n\032\032frame-args\r\n.*\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$"
@@ -279,19 +280,19 @@ if [target_info exists gdb,nosignals] {
# delete all the breakpoints
#
gdb_test_multiple "delete 1" "delete bp 1" {
- -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" {
+ -re "\r\n\032\032post-prompt\r\n${breakpoints_invalid}$gdb_prompt$" {
pass "delete bp 1"
}
}
gdb_test_multiple "delete 2" "delete bp 2" {
- -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" {
+ -re "\r\n\032\032post-prompt\r\n${breakpoints_invalid}$gdb_prompt$" {
pass "delete bp 2"
}
}
gdb_test_multiple "delete 3" "delete bp 3" {
- -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" {
+ -re "\r\n\032\032post-prompt\r\n${breakpoints_invalid}$gdb_prompt$" {
pass "delete bp 3"
}
}
@@ -301,10 +302,10 @@ gdb_test_multiple "delete 3" "delete bp 3" {
# to test the annotate output for the display command.
#
gdb_test_multiple "break main" "break at main" {
- -re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file ${escapedsrcfile}, line $main_line.*$gdb_prompt$" {
+ -re "post-prompt.*Breakpoint 4 at $hex: file ${escapedsrcfile}, line $main_line.*\032\032breakpoints-invalid.*$gdb_prompt$" {
pass "break at main"
}
- -re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file .*${srcfile}, line $main_line.*$gdb_prompt$" {
+ -re "post-prompt.*Breakpoint 4 at $hex: file .*${srcfile}, line $main_line.*\032\032breakpoints-invalid.*$gdb_prompt$" {
setup_xfail "*-*-*" 1270
fail "break at main"
}
@@ -424,7 +425,7 @@ if [target_info exists gdb,nosignals] {
} else {
setup_xfail hppa*-*-hpux11*
gdb_test_multiple "signal SIGTRAP" "signal sent" {
- -re ".*\032\032post-prompt\r\nContinuing with signal SIGTRAP.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032signalled\r\n\r\nProgram terminated with signal \r\n\032\032signal-name\r\nSIGTRAP\r\n\032\032signal-name-end\r\n, \r\n\032\032signal-string\r\nTrace.breakpoint trap\r\n\032\032signal-string-end\r\n.\r\nThe program no longer exists.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
+ -re ".*\032\032post-prompt\r\nContinuing with signal SIGTRAP.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032signalled\r\n\r\nProgram terminated with signal \r\n\032\032signal-name\r\nSIGTRAP\r\n\032\032signal-name-end\r\n, \r\n\032\032signal-string\r\nTrace.breakpoint trap\r\n\032\032signal-string-end\r\n.\r\nThe program no longer exists.\r\n${breakpoints_invalid}\r\n\032\032stopped\r\n$gdb_prompt$" {
pass "signal sent"
}
}
diff --git a/gdb/testsuite/gdb.cp/annota2.exp b/gdb/testsuite/gdb.cp/annota2.exp
index 0e2e005..a4f7b17 100644
--- a/gdb/testsuite/gdb.cp/annota2.exp
+++ b/gdb/testsuite/gdb.cp/annota2.exp
@@ -38,6 +38,9 @@ if [is_remote target] then {
return 0
}
+set breakpoints_invalid "\r\n\032\032breakpoints-invalid\r\n"
+set frames_invalid "\r\n\032\032frames-invalid\r\n"
+
#
# line number where we need to stop in main
#
@@ -99,7 +102,7 @@ gdb_test_multiple "print a" "print class" {
# `a.x is 1' is asynchronous regarding to `frames-invalid'.
#
gdb_test_multiple "continue" "continue until exit" {
- -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)*\r\na.x is 1\r\n\(\r\n\032\032frames-invalid\r\n\)*\r\n\032\032exited 0\r\n$inferior_exited_re normally.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
+ -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)*\r\na.x is 1\r\n\(\r\n\032\032frames-invalid\r\n\)*\r\n\032\032exited 0\r\n$inferior_exited_re normally.\r\n${breakpoints_invalid}\r\n\032\032stopped\r\n$gdb_prompt$" {
pass "continue until exit"
}
}
@@ -112,7 +115,7 @@ gdb_expect {
-re ".*Delete all breakpoints. \\(y or n\\) \r\n\032\032query.*$" {
send_gdb "y\n"
gdb_expect {
- -re "\r\n\032\032post-query\r\n$gdb_prompt$" { pass "delete bps" }
+ -re "\r\n\032\032post-query\r\n${breakpoints_invalid}$gdb_prompt$" { pass "delete bps" }
-re ".*$gdb_prompt$" { fail "delete bps" }
timeout { fail "delete bps (timeout)" }
}
@@ -125,7 +128,7 @@ gdb_expect {
# break at first line of main.
#
gdb_test_multiple "break 22" "break at main" {
- -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex: file.*$srcfile, line.*\r\n$gdb_prompt$" {
+ -re "\r\n\032\032post-prompt\r\nBreakpoint.*at $hex: file.*$srcfile, line.*\r\n\032\032breakpoints-invalid.*\r\n$gdb_prompt$" {
pass "breakpoint at main"
}
}
@@ -149,7 +152,7 @@ gdb_test_multiple "run" "run until main breakpoint" {
# set up a watch point on a.x
#
gdb_test_multiple "watch a.x" "set watch on a.x" {
- -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\n.*atchpoint 3: a.x\r\n$gdb_prompt$" {
+ -re "\r\n\032\032post-prompt\r\n.*atchpoint 3: a.x.*\r\n\032\032breakpoints-invalid\r\n.*$gdb_prompt$" {
pass "set watch on a.x"
}
}
@@ -159,10 +162,10 @@ gdb_test_multiple "watch a.x" "set watch on a.x" {
# annotate-watchpoint
#
gdb_test_multiple "next" "watch triggered on a.x" {
- -re "\r\n\032\032post-prompt\r\n\r\n(\032\032breakpoints-invalid\r\n\r\n)*\032\032starting\r\n\r\n(\032\032frames-invalid\r\n\r\n)*\032\032watchpoint 3\r\n.*atchpoint 3: a.x\r\n\r\nOld value = 0\r\nNew value = 1\r\n\r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*$srcfile\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$decimal\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n.*$gdb_prompt$" {
+ -re "\r\n\032\032post-prompt\r\n\032\032starting\r\n${frames_invalid}${breakpoints_invalid}\r\n\032\032watchpoint 3\r\n.*atchpoint 3: a.x\r\n\r\nOld value = 0\r\nNew value = 1\r\n\r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*$srcfile\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$decimal\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n${breakpoints_invalid}.*$gdb_prompt$" {
pass "watch triggered on a.x"
}
- -re "\r\n\032\032post-prompt\r\n\r\n(\032\032breakpoints-invalid\r\n\r\n)*\032\032starting\r\n\r\n(\032\032frames-invalid\r\n\r\n)*\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
+ -re "\r\n\032\032post-prompt\r\n\r\n\032\032starting\r\n${frames_invalid}\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n${breakpoints_invalid}$gdb_prompt$" {
kfail "gdb/38" "watch triggered on a.x"
}
}