From 9add0f1b436c28b8a22c2fee1b7b355eb9d0e28c Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 24 Mar 2010 21:12:18 +0000 Subject: * breakpoint.h (struct counted_command_line): New struct. (struct breakpoint) : Change type. (struct bpstats) : Change type. : New field. * breakpoint.c (alloc_counted_command_line): New function. (incref_counted_command_line): Likewise. (decref_counted_command_line): Likewise. (do_cleanup_counted_command_line): Likewise. (make_cleanup_decref_counted_command_line): Likewise. (breakpoint_set_commands): Use decref_counted_command_line and alloc_counted_command_line. (commands_command): Don't error if breakpoint commands are executing. (commands_from_control_command): Likewise. (bpstat_free): Update. (bpstat_copy): Likewise. (bpstat_clear_actions): Likewise. (bpstat_do_actions_1): Likewise. (bpstat_stop_status): Likewise. (print_one_breakpoint_location): Likewise. (delete_breakpoint): Likewise. (bpstat_alloc): Initialize new field. (tracepoint_save_command): Update. * tracepoint.c (encode_actions): Update. (trace_dump_command): Update. --- gdb/breakpoint.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'gdb/breakpoint.h') diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 3f194c6..4a1a7ad 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -376,6 +376,17 @@ DEF_VEC_I(int); typedef struct bp_location *bp_location_p; DEF_VEC_P(bp_location_p); +/* A reference-counted struct command_line. This lets multiple + breakpoints share a single command list. */ +struct counted_command_line +{ + /* The reference count. */ + int refc; + + /* The command list. */ + struct command_line *commands; +}; + /* Note that the ->silent field is not currently used by any commands (though the code is in there if it was to be, and set_raw_breakpoint does set it to 0). I implemented it because I thought it would be @@ -414,7 +425,7 @@ struct breakpoint be continued automatically before really stopping. */ int ignore_count; /* Chain of command lines to execute when this breakpoint is hit. */ - struct command_line *commands; + struct counted_command_line *commands; /* Stack depth (address of frame). If nonzero, break only if fp equals this. */ struct frame_id frame_id; @@ -698,8 +709,11 @@ struct bpstats bpstat next; /* Breakpoint that we are at. */ const struct bp_location *breakpoint_at; - /* Commands left to be done. */ - struct command_line *commands; + /* The associated command list. */ + struct counted_command_line *commands; + /* Commands left to be done. This points somewhere in + base_command. */ + struct command_line *commands_left; /* Old value associated with a watchpoint. */ struct value *old_val; -- cgit v1.1