Re: [PATCH] Hooks still needed for annotations

Nick Roberts
2005-06-04T03:19:46Z

> The way to prevent them from being removed again is to add test cases.

OK, I've done this. Running the tests revealed a small bug with
"set annotate" -- it didn't call _initialize_annotate to set the hooks.
This must be why the tests didn't fail when the hooks were removed in the
first place.

I've only tested for breakpoints-invalid annotations when breakpoints
have been deleted as I could simply adapt existing tests. They should
also be present when breakpoints are enabled/disabled. However, this test
should be sufficient to prevent the inadvertant removal of the hooks.

Nick

2005-06-04 Nick Roberts <nickrob@snap.net.nz>

* event-top.c (change_annotation_level): Call _initialize_annotate.

* interps.c (clear_interpreter_hooks):
Re-instate deprecated_delete_breakpoint_hook and
deprecated_modify_breakpoint_hook for annotations.

2005-06-04 Nick Roberts <nickrob@snap.net.nz>

* gdb.base/annota1.exp, gdb.base/annota3.exp, gdb.cp/annota3.exp:
Test for breakpoints-invalid when deleting breakpoints.

*** /home/nick/src/gdb/event-top.c.~1.40.~ 2005-03-17 12:23:51.000000000 +1300
--- /home/nick/src/gdb/event-top.c 2005-06-04 14:36:37.000000000 +1200
***************
*** 43,48 ****
--- 43,50 ----
/* readline defines this. */
#undef savestring

+ extern void _initialize_annotate (void);
+
static void rl_callback_read_char_wrapper (gdb_client_data client_data);
static void command_line_handler (char *rl);
static void command_line_handler_continuation (struct continuation_arg *arg);
***************
*** 359,364 ****
--- 361,367 ----
pop_prompt ();
}
}
+ _initialize_annotate ();
}

/* Pushes a new prompt on the prompt stack. Each prompt has three

*** /home/nick/src/gdb/event-top.c.~1.40.~ 2005-03-17 12:23:51.000000000 +1300
--- /home/nick/src/gdb/event-top.c 2005-06-04 14:36:37.000000000 +1200
***************
*** 43,48 ****
--- 43,50 ----
/* readline defines this. */
#undef savestring

+ extern void _initialize_annotate (void);
+
static void rl_callback_read_char_wrapper (gdb_client_data client_data);
static void command_line_handler (char *rl);
static void command_line_handler_continuation (struct continuation_arg *arg);
***************
*** 359,364 ****
--- 361,367 ----
pop_prompt ();
}
}
+ _initialize_annotate ();
}

/* Pushes a new prompt on the prompt stack. Each prompt has three

*** /home/nick/src/gdb/interps.c.~1.15.~ 2005-04-26 21:44:15.000000000 +1200
--- /home/nick/src/gdb/interps.c 2005-06-04 15:12:16.000000000 +1200
***************
*** 326,333 ****
deprecated_query_hook = 0;
deprecated_warning_hook = 0;
deprecated_create_breakpoint_hook = 0;
- deprecated_delete_breakpoint_hook = 0;
- deprecated_modify_breakpoint_hook = 0;
deprecated_interactive_hook = 0;
deprecated_registers_changed_hook = 0;
deprecated_readline_begin_hook = 0;
--- 326,331 ----

*** /home/nick/src/gdb/testsuite/gdb.base/annota1.exp.~1.17.~ 2005-04-28 17:17:24.000000000 +1200
--- /home/nick/src/gdb/testsuite/gdb.base/annota1.exp 2005-06-04 14:50:08.000000000 +1200
***************
*** 315,321 ****
#
send_gdb "delete 1\n"
gdb_expect {
! -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" \
{ pass "delete bp 1" }
-re ".*$gdb_prompt$" { fail "delete bp 1" }
timeout { fail "delete bp 1 (timeout)" }
--- 315,321 ----
#
send_gdb "delete 1\n"
gdb_expect {
! -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\n$gdb_prompt$" \
{ pass "delete bp 1" }
-re ".*$gdb_prompt$" { fail "delete bp 1" }
timeout { fail "delete bp 1 (timeout)" }
***************
*** 323,329 ****

send_gdb "delete 2\n"
gdb_expect {
! -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" \
{ pass "delete bp 2" }
-re ".*$gdb_prompt$" { fail "delete bp 2 " }
timeout { fail "delete bp 2 (timeout)" }
--- 323,329 ----

send_gdb "delete 2\n"
gdb_expect {
! -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\n$gdb_prompt$" \
{ pass "delete bp 2" }
-re ".*$gdb_prompt$" { fail "delete bp 2 " }
timeout { fail "delete bp 2 (timeout)" }
***************
*** 331,337 ****

send_gdb "delete 3\n"
gdb_expect {
! -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" \
{ pass "delete bp 3" }
-re ".*$gdb_prompt$" { fail "delete bp 3" }
timeout { fail "delete bp 3 (timeout)" }
--- 331,337 ----

send_gdb "delete 3\n"
gdb_expect {
! -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\n$gdb_prompt$" \
{ pass "delete bp 3" }
-re ".*$gdb_prompt$" { fail "delete bp 3" }
timeout { fail "delete bp 3 (timeout)" }

*** /home/nick/src/gdb/testsuite/gdb.base/annota3.exp.~1.5.~ 2004-07-26 03:41:51.000000000 +1200
--- /home/nick/src/gdb/testsuite/gdb.base/annota3.exp 2005-06-04 14:45:03.000000000 +1200
***************
*** 258,273 ****
--- 258,276 ----
send_gdb "delete 1\n"
gdb_expect_list "delete bp 1" "$gdb_prompt$" {
"\r\n\032\032post-prompt\r\n"
+ "\r\n\032\032breakpoints-invalid\r\n"
}

send_gdb "delete 2\n"
gdb_expect_list "delete bp 2" "$gdb_prompt$" {
"\r\n\032\032post-prompt\r\n"
+ "\r\n\032\032breakpoints-invalid\r\n"
}

send_gdb "delete 3\n"
gdb_expect_list "delete bp 3" "$gdb_prompt$" {
"\r\n\032\032post-prompt\r\n"
+ "\r\n\032\032breakpoints-invalid\r\n"
}

#

*** /home/nick/src/gdb/testsuite/gdb.cp/annota3.exp.~1.3.~ 2004-02-28 09:23:12.000000000 +1300
--- /home/nick/src/gdb/testsuite/gdb.cp/annota3.exp 2005-06-04 14:56:46.000000000 +1200
***************
*** 140,146 ****
-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 ".*$gdb_prompt$" { fail "delete bps" }
timeout { fail "delete bps (timeout)" }
}
--- 140,146 ----
-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\r\n\032\032breakpoints-invalid\r\n$gdb_prompt$" { pass "delete bps" }
-re ".*$gdb_prompt$" { fail "delete bps" }
timeout { fail "delete bps (timeout)" }
}