From 5cea2a26596faf0ea2e67dd9f885543ff638cdd0 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 2 Apr 2010 01:18:35 +0000 Subject: [PATCH] * breakpoint.h (struct counted_command_line): Moved definition to breakpoint.c, and forward declare. (breakpoint_commands): Declare. * breakpoint.c (struct counted_command_line): Moved here. (breakpoint_commands): New. * tracepoint.c (encode_actions): Use breakpoint_commands. * remote.c (remote_download_tracepoint): Ditto. --- gdb/ChangeLog | 10 ++++++++++ gdb/breakpoint.c | 16 ++++++++++++++++ gdb/breakpoint.h | 16 +++++++--------- gdb/remote.c | 2 +- gdb/tracepoint.c | 6 +++--- 5 files changed, 37 insertions(+), 13 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3c2f5d86aee..18eb942f826 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2010-04-02 Pedro Alves + + * breakpoint.h (struct counted_command_line): Moved definition to + breakpoint.c, and forward declare. + (breakpoint_commands): Declare. + * breakpoint.c (struct counted_command_line): Moved here. + (breakpoint_commands): New. + * tracepoint.c (encode_actions): Use breakpoint_commands. + * remote.c (remote_download_tracepoint): Ditto. + 2010-04-01 H.J. Lu * remote.c (remote_parse_stop_reply): Use hex_string instead diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 01ec269323e..46a50b9fa16 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -222,6 +222,22 @@ static void disable_trace_command (char *, int); static void trace_pass_command (char *, int); +/* 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; +}; + +struct command_line * +breakpoint_commands (struct breakpoint *b) +{ + return b->commands ? b->commands->commands : NULL; +} /* Flag indicating that a command has proceeded the inferior past the current breakpoint. */ diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 98a7157ea10..3da6188a17d 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -384,15 +384,9 @@ 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; -}; + breakpoints share a single command list. This is an implementation + detail to the breakpoints module. */ +struct counted_command_line; /* 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 @@ -814,6 +808,10 @@ extern void delete_breakpoint (struct breakpoint *); extern void breakpoint_auto_delete (bpstat); +/* Return the chain of command lines to execute when this breakpoint + is hit. */ +extern struct command_line *breakpoint_commands (struct breakpoint *b); + extern void break_command (char *, int); extern void hbreak_command_wrapper (char *, int); diff --git a/gdb/remote.c b/gdb/remote.c index 0108fdb4021..685be7a4fbf 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -9507,7 +9507,7 @@ remote_download_tracepoint (struct breakpoint *t) warning (_("Target does not support source download.")); } remote_download_command_source (t->number, loc->address, - t->commands->commands); + breakpoint_commands (t)); } do_cleanups (old_chain); diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index d7c9bfde00f..ac109970837 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -1439,7 +1439,7 @@ encode_actions (struct breakpoint *t, struct bp_location *tloc, gdbarch_virtual_frame_pointer (t->gdbarch, t->loc->address, &frame_reg, &frame_offset); - actions = t->commands->commands; + actions = breakpoint_commands (t); /* If there are default expressions to collect, make up a collect action and prepend to the action list to encode. Note that since @@ -1458,7 +1458,7 @@ encode_actions (struct breakpoint *t, struct bp_location *tloc, default_collect_action = xmalloc (sizeof (struct command_line)); make_cleanup (xfree, default_collect_action); - default_collect_action->next = t->commands->commands; + default_collect_action->next = actions; default_collect_action->line = line; actions = default_collect_action; } @@ -2417,7 +2417,7 @@ trace_dump_command (char *args, int from_tty) if (loc->address == regcache_read_pc (regcache)) stepping_frame = 0; - for (action = t->commands->commands; action; action = action->next) + for (action = breakpoint_commands (t); action; action = action->next) { struct cmd_list_element *cmd; -- 2.30.2