diff options
author | Keith Seitz <keiths@redhat.com> | 2001-04-23 20:27:54 +0000 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2001-04-23 20:27:54 +0000 |
commit | 562d3a3c18379f2113dc8ebed9a87530aaa7da99 (patch) | |
tree | bd963f869c77f39def5125a35607d4857d156c2d /gdb/gdbtk | |
parent | 799f89349eba5b3c6379b083fdded15a690bf623 (diff) | |
download | gdb-562d3a3c18379f2113dc8ebed9a87530aaa7da99.tar.gz |
* generic/gdbtk-cmds.c (gdb_get_breakpoint_info): If unable
to find the requested breakpoint for lookup, check if
it is about to be deleted and return information about
that breakpoint.
(gdb_get_tracepoint_info): Ditto for tracepoints.
* generic/gdbtk-hooks.c (gdbtk_deleted_bp): New global.
(gdbtk_delete_breakpoint): Remember the deleted breakpoint
for gdb_get_breakpoint_info, in case it is called during
the event notification.
(gdbtk_delete_tracepoints): Ditto for tracepoints.
Diffstat (limited to 'gdb/gdbtk')
-rw-r--r-- | gdb/gdbtk/ChangeLog | 13 | ||||
-rw-r--r-- | gdb/gdbtk/generic/gdbtk-cmds.c | 38 | ||||
-rw-r--r-- | gdb/gdbtk/generic/gdbtk-hooks.c | 20 |
3 files changed, 61 insertions, 10 deletions
diff --git a/gdb/gdbtk/ChangeLog b/gdb/gdbtk/ChangeLog index 6dc0122a4d4..0c1c64b995f 100644 --- a/gdb/gdbtk/ChangeLog +++ b/gdb/gdbtk/ChangeLog @@ -1,3 +1,16 @@ +2001-04-23 Keith Seitz <keiths@cygnus.com> + + * generic/gdbtk-cmds.c (gdb_get_breakpoint_info): If unable + to find the requested breakpoint for lookup, check if + it is about to be deleted and return information about + that breakpoint. + (gdb_get_tracepoint_info): Ditto for tracepoints. + * generic/gdbtk-hooks.c (gdbtk_deleted_bp): New global. + (gdbtk_delete_breakpoint): Remember the deleted breakpoint + for gdb_get_breakpoint_info, in case it is called during + the event notification. + (gdbtk_delete_tracepoints): Ditto for tracepoints. + 2001-04-20 Keith Seitz <keiths@cygnus.com> * library/srctextwin.ith (handle_set_hook): Rename to set_variable. diff --git a/gdb/gdbtk/generic/gdbtk-cmds.c b/gdb/gdbtk/generic/gdbtk-cmds.c index 31167c4fa57..4d9622a430e 100644 --- a/gdb/gdbtk/generic/gdbtk-cmds.c +++ b/gdb/gdbtk/generic/gdbtk-cmds.c @@ -64,6 +64,7 @@ /* Various globals we reference. */ extern char *source_path; +extern void *gdbtk_deleted_bp; static void setup_architecture_data (void); static int tracepoint_exists (char *args); @@ -2279,11 +2280,19 @@ gdb_get_tracepoint_info (ClientData clientData, Tcl_Interp *interp, if (tp == NULL) { - char *buff; - xasprintf (&buff, "Tracepoint #%d does not exist", tpnum); - Tcl_SetStringObj (result_ptr->obj_ptr, buff, -1); - free(buff); - return TCL_ERROR; + /* Hack. Check if this TP is being deleted. See comments + around the definition of gdbtk_deleted_bp in + gdbtk-hooks.c. */ + struct tracepoint *dtp = (struct tracepoint *) gdbtk_deleted_bp; + if (dtp != NULL && dtp->number == tpnum) + tp = dtp; + else { + char *buff; + xasprintf (&buff, "Tracepoint #%d does not exist", tpnum); + Tcl_SetStringObj (result_ptr->obj_ptr, buff, -1); + free(buff); + return TCL_ERROR; + } } Tcl_SetListObj (result_ptr->obj_ptr, 0, NULL); @@ -4066,11 +4075,20 @@ gdb_get_breakpoint_info (ClientData clientData, Tcl_Interp *interp, int objc, if (!b || b->type != bp_breakpoint) { - char *err_buf; - xasprintf (&err_buf, "Breakpoint #%d does not exist.", bpnum); - Tcl_SetStringObj (result_ptr->obj_ptr, err_buf, -1); - free(err_buf); - return TCL_ERROR; + /* Hack. Check if this BP is being deleted. See comments + around the definition of gdbtk_deleted_bp in + gdbtk-hooks.c. */ + struct breakpoint *dbp = (struct breakpoint *) gdbtk_deleted_bp; + if (dbp && dbp->number == bpnum) + b = dbp; + else + { + char *err_buf; + xasprintf (&err_buf, "Breakpoint #%d does not exist.", bpnum); + Tcl_SetStringObj (result_ptr->obj_ptr, err_buf, -1); + free(err_buf); + return TCL_ERROR; + } } sal = find_pc_line (b->address, 0); diff --git a/gdb/gdbtk/generic/gdbtk-hooks.c b/gdb/gdbtk/generic/gdbtk-hooks.c index c647aa1fa5f..5f70202a546 100644 --- a/gdb/gdbtk/generic/gdbtk-hooks.c +++ b/gdb/gdbtk/generic/gdbtk-hooks.c @@ -66,6 +66,20 @@ volatile int in_fputs = 0; that it should forcibly detach from the target. */ int gdbtk_force_detach = 0; +/* Set/cleared by gdbtk_delete_breakpoint/tracepoint. Unfortunately, + clear_command (in breakpoint.c) takes the breakpoint off of the + breakpoint_chain before deleting the breakpoint. The BreakpointEvent + which is created as a result of any breakpoint/tracepoint event + calls gdb_get_breakpoint_info will, therefore, not find a breakpoint + about which to return information. So we keep a handle on the deleted + breakpoint when we're deleting it, and teach gdb_get_breakpoint_info + to check for this variable whenever a breakpoint lookup fails. + + Why not just change BreakpointEvent? Good question. Answer: I refuse + to allow BreakpointEvents to be all public variables. They are not. + They ONLY depend on the breakpoint number (gdb's handle for them). */ +void *gdbtk_deleted_bp = NULL; + extern void (*pre_add_symbol_hook) (char *); extern void (*post_add_symbol_hook) (void); extern void (*selected_frame_level_changed_hook) (int); @@ -637,7 +651,10 @@ static void gdbtk_delete_breakpoint (b) struct breakpoint *b; { + /* Hack. See comments near top of this file. */ + gdbtk_deleted_bp = b; breakpoint_notify (b, "delete"); + gdbtk_deleted_bp = NULL; } static void @@ -767,7 +784,10 @@ static void gdbtk_delete_tracepoint (tp) struct tracepoint *tp; { + /* Hack. See comments near top of this file. */ + gdbtk_deleted_bp = tp; tracepoint_notify (tp, "delete"); + gdbtk_deleted_bp = NULL; } static void |