From 41447f92e2151bd8fcd5f3e4b8dd5e972aec9b67 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Fri, 30 Jan 2009 18:28:01 +0000 Subject: [PATCH] * breakpoint.c (create_breakpoint, create_breakpoints) (break_command_really, set_breakpoint): New parameter enabled. (create_breakpoint, break_command_really): Make breakpoint disabled if so requested. * breakpoint.h (set_breakpoint): New parameter enabled. * mi/mi-cmd-break.c (mi_cmd_break_insert): Handle the -d option. --- gdb/ChangeLog | 9 +++++++++ gdb/breakpoint.c | 25 +++++++++++++++---------- gdb/breakpoint.h | 3 ++- gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 4 +++- gdb/mi/mi-cmd-break.c | 11 ++++++++--- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.mi/mi-break.exp | 16 ++++++++++++++++ 8 files changed, 63 insertions(+), 15 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 474dbc2accd..cf6678edabb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2009-01-30 Vladimir Prus + + * breakpoint.c (create_breakpoint, create_breakpoints) + (break_command_really, set_breakpoint): New parameter enabled. + (create_breakpoint, break_command_really): Make breakpoint + disabled if so requested. + * breakpoint.h (set_breakpoint): New parameter enabled. + * mi/mi-cmd-break.c (mi_cmd_break_insert): Handle the -d option. + 2009-01-28 Doug Evans * amd64-tdep.h (amd64_displaced_step_copy_insn): Declare. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 65bbca9ab68..1463bfb65cb 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -5090,7 +5090,7 @@ create_breakpoint (struct symtabs_and_lines sals, char *addr_string, char *cond_string, enum bptype type, enum bpdisp disposition, int thread, int ignore_count, - struct breakpoint_ops *ops, int from_tty) + struct breakpoint_ops *ops, int from_tty, int enabled) { struct breakpoint *b = NULL; int i; @@ -5124,7 +5124,7 @@ create_breakpoint (struct symtabs_and_lines sals, char *addr_string, b->cond_string = cond_string; b->ignore_count = ignore_count; - b->enable_state = bp_enabled; + b->enable_state = enabled ? bp_enabled : bp_disabled; b->disposition = disposition; loc = b->loc; @@ -5299,7 +5299,8 @@ create_breakpoints (struct symtabs_and_lines sals, char **addr_string, char *cond_string, enum bptype type, enum bpdisp disposition, int thread, int ignore_count, - struct breakpoint_ops *ops, int from_tty) + struct breakpoint_ops *ops, int from_tty, + int enabled) { int i; for (i = 0; i < sals.nelts; ++i) @@ -5309,7 +5310,7 @@ create_breakpoints (struct symtabs_and_lines sals, char **addr_string, create_breakpoint (expanded, addr_string[i], cond_string, type, disposition, - thread, ignore_count, ops, from_tty); + thread, ignore_count, ops, from_tty, enabled); } update_global_location_list (1); @@ -5481,7 +5482,8 @@ break_command_really (char *arg, char *cond_string, int thread, int ignore_count, enum auto_boolean pending_break_support, struct breakpoint_ops *ops, - int from_tty) + int from_tty, + int enabled) { struct gdb_exception e; struct symtabs_and_lines sals; @@ -5614,7 +5616,7 @@ break_command_really (char *arg, char *cond_string, int thread, hardwareflag ? bp_hardware_breakpoint : bp_breakpoint, tempflag ? disp_del : disp_donttouch, - thread, ignore_count, ops, from_tty); + thread, ignore_count, ops, from_tty, enabled); } else { @@ -5635,6 +5637,7 @@ break_command_really (char *arg, char *cond_string, int thread, b->disposition = tempflag ? disp_del : disp_donttouch; b->condition_not_parsed = 1; b->ops = ops; + b->enable_state = enabled ? bp_enabled : bp_disabled; update_global_location_list (1); mention (b); @@ -5669,7 +5672,8 @@ break_command_1 (char *arg, int flag, int from_tty) 0 /* Ignore count */, pending_break_support, NULL /* breakpoint_ops */, - from_tty); + from_tty, + 1 /* enabled */); } @@ -5677,7 +5681,7 @@ void set_breakpoint (char *address, char *condition, int hardwareflag, int tempflag, int thread, int ignore_count, - int pending) + int pending, int enabled) { break_command_really (address, condition, thread, 0 /* condition and thread are valid. */, @@ -5685,7 +5689,7 @@ set_breakpoint (char *address, char *condition, ignore_count, pending ? AUTO_BOOLEAN_TRUE : AUTO_BOOLEAN_FALSE, - NULL, 0); + NULL, 0, enabled); } /* Adjust SAL to the first instruction past the function prologue. @@ -6536,7 +6540,8 @@ handle_gnu_v3_exceptions (int tempflag, char *cond_string, tempflag, 0, 0, AUTO_BOOLEAN_TRUE /* pending */, - &gnu_v3_exception_catchpoint_ops, from_tty); + &gnu_v3_exception_catchpoint_ops, from_tty, + 1 /* enabled */); return 1; } diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index b2db9ebedf5..94287de6fb4 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -705,7 +705,8 @@ extern void tbreak_command (char *, int); extern void set_breakpoint (char *address, char *condition, int hardwareflag, int tempflag, int thread, int ignore_count, - int pending); + int pending, + int enabled); extern void insert_breakpoints (void); diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index e11285c2bc4..8b3d084f1ca 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2009-01-30 Vladimir Prus + + * gdb.texinfo (GDB/MI Breakpoint Commands): Document the -d + option to -break-insert. + 2009-01-28 Daniel Jacobowitz Jerome Guitton diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 213438d6b40..9f545d5ff3a 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -19925,7 +19925,7 @@ N.A. @subsubheading Synopsis @smallexample - -break-insert [ -t ] [ -h ] [ -f ] + -break-insert [ -t ] [ -h ] [ -f ] [ -d ] [ -c @var{condition} ] [ -i @var{ignore-count} ] [ -p @var{thread} ] [ @var{location} ] @end smallexample @@ -19960,6 +19960,8 @@ refers to unknown files or functions), create a pending breakpoint. Without this flag, @value{GDBN} will report an error, and won't create a breakpoint, if @var{location} cannot be parsed. +@item -d +Create a disabled breakpoint. @end table @subsubheading Result diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c index af14b0a1b58..0de08ceef1d 100644 --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -71,12 +71,14 @@ mi_cmd_break_insert (char *command, char **argv, int argc) int ignore_count = 0; char *condition = NULL; int pending = 0; + int enabled = 1; + struct gdb_exception e; struct gdb_events *old_hooks; enum opt { HARDWARE_OPT, TEMP_OPT /*, REGEXP_OPT */ , CONDITION_OPT, - IGNORE_COUNT_OPT, THREAD_OPT, PENDING_OPT + IGNORE_COUNT_OPT, THREAD_OPT, PENDING_OPT, DISABLE_OPT }; static struct mi_opt opts[] = { @@ -86,6 +88,7 @@ mi_cmd_break_insert (char *command, char **argv, int argc) {"i", IGNORE_COUNT_OPT, 1}, {"p", THREAD_OPT, 1}, {"f", PENDING_OPT, 0}, + {"d", DISABLE_OPT, 0}, { 0, 0, 0 } }; @@ -123,6 +126,8 @@ mi_cmd_break_insert (char *command, char **argv, int argc) case PENDING_OPT: pending = 1; break; + case DISABLE_OPT: + enabled = 0; } } @@ -151,13 +156,13 @@ mi_cmd_break_insert (char *command, char **argv, int argc) set_breakpoint (address, condition, 0 /*hardwareflag */ , temp_p, thread, ignore_count, - pending); + pending, enabled); break; case HW_BP: set_breakpoint (address, condition, 1 /*hardwareflag */ , temp_p, thread, ignore_count, - pending); + pending, enabled); break; #if 0 case REGEXP_BP: diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index e4ec6324338..9e636b927dd 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-01-30 Vladimir Prus + + * gdb.mi/mi-break.exp (test_disabled_creation): New. + Call it. + 2009-01-28 Doug Evans * gdb.arch/amd64-disp-step.S: New file. diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp index 84dcf0aa92f..6ea59fc3f23 100644 --- a/gdb/testsuite/gdb.mi/mi-break.exp +++ b/gdb/testsuite/gdb.mi/mi-break.exp @@ -183,6 +183,20 @@ proc test_error {} { "update varobj for function call" } +proc test_disabled_creation {} { + global mi_gdb_prompt + global hex + global line_callee2_body + + mi_gdb_test "-break-insert -d basics.c:callee2" \ + "\\^done,bkpt=\{number=\"6\",type=\"breakpoint\",disp=\"keep\",enabled=\"n\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",fullname=\".*\",line=\"$line_callee2_body\",times=\"0\",original-location=\".*\"\}" \ + "test disabled creation" + + mi_gdb_test "-break-delete" \ + "\\^done" \ + "test disabled creation: cleanup" +} + test_tbreak_creation_and_listing test_rbreak_creation_and_listing @@ -190,5 +204,7 @@ test_ignore_count test_error +test_disabled_creation + mi_gdb_exit return 0 -- 2.30.2