diff options
-rw-r--r-- | gdb/ChangeLog | 17 | ||||
-rw-r--r-- | gdb/breakpoint.c | 173 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 18 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/break.exp | 88 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/completion.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/ena-dis-br.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/help.exp | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.trace/infotrace.exp | 4 |
10 files changed, 225 insertions, 103 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 25fc8c650ab..3c7ce234b3c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,4 +1,19 @@ -2011-02-22 Michael Snyder <msnyder@vmware.com> +2011-02-23 Michael Snyder <msnyder@vmware.com> + + * breakpoint.c (breakpoint_1): Change first argument from an int + to a char pointer, so that the function now accepts a list of + breakpoints rather than just one. Use new function + 'number_is_in_list' to implement. + (breakpoints_info): Pass char * instead of int to breakpoint_1. + (watchpoints_info): Ditto. + (tracepoints_info): Ditto. + (maintenance_info_breakpoints): Ditto. + (_initialize_breakpoint): Update help strings to reflect the fact + that these functions can now take more than one argument. + * cli/cli-utils.c (number_is_in_list): New function. + * cli/cli-utils.h (number_is_in_list): Export. + +2011-02-23 Michael Snyder <msnyder@vmware.com> * memattr.c (mem_enable_command): Use get_number_or_range. (mem_disable_command): Ditto. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 623effa0daf..484a831040a 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -133,7 +133,8 @@ static void breakpoints_info (char *, int); static void watchpoints_info (char *, int); -static int breakpoint_1 (int, int, int (*) (const struct breakpoint *)); +static int breakpoint_1 (char *, int, + int (*) (const struct breakpoint *)); static int breakpoint_cond_eval (void *); @@ -5102,7 +5103,7 @@ user_breakpoint_p (struct breakpoint *b) breakpoints listed. */ static int -breakpoint_1 (int bnum, int allflag, +breakpoint_1 (char *args, int allflag, int (*filter) (const struct breakpoint *)) { struct breakpoint *b; @@ -5119,28 +5120,36 @@ breakpoint_1 (int bnum, int allflag, required for address fields. */ nr_printable_breakpoints = 0; ALL_BREAKPOINTS (b) - if (bnum == -1 - || bnum == b->number) - { - /* If we have a filter, only list the breakpoints it accepts. */ - if (filter && !filter (b)) - continue; - - if (allflag || user_breakpoint_p (b)) - { - int addr_bit, type_len; + { + /* If we have a filter, only list the breakpoints it accepts. */ + if (filter && !filter (b)) + continue; + + /* If we have an "args" string, it is a list of breakpoints to + accept. Skip the others. */ + if (args != NULL && *args != '\0') + { + if (allflag && parse_and_eval_long (args) != b->number) + continue; + if (!allflag && !number_is_in_list (args, b->number)) + continue; + } - addr_bit = breakpoint_address_bits (b); - if (addr_bit > print_address_bits) - print_address_bits = addr_bit; + if (allflag || user_breakpoint_p (b)) + { + int addr_bit, type_len; - type_len = strlen (bptype_string (b->type)); - if (type_len > print_type_col_width) - print_type_col_width = type_len; + addr_bit = breakpoint_address_bits (b); + if (addr_bit > print_address_bits) + print_address_bits = addr_bit; - nr_printable_breakpoints++; - } - } + type_len = strlen (bptype_string (b->type)); + if (type_len > print_type_col_width) + print_type_col_width = type_len; + + nr_printable_breakpoints++; + } + } if (opts.addressprint) bkpttbl_chain @@ -5169,16 +5178,16 @@ breakpoint_1 (int bnum, int allflag, annotate_field (3); ui_out_table_header (uiout, 3, ui_left, "enabled", "Enb"); /* 4 */ if (opts.addressprint) - { - if (nr_printable_breakpoints > 0) - annotate_field (4); - if (print_address_bits <= 32) - ui_out_table_header (uiout, 10, ui_left, - "addr", "Address"); /* 5 */ - else - ui_out_table_header (uiout, 18, ui_left, - "addr", "Address"); /* 5 */ - } + { + if (nr_printable_breakpoints > 0) + annotate_field (4); + if (print_address_bits <= 32) + ui_out_table_header (uiout, 10, ui_left, + "addr", "Address"); /* 5 */ + else + ui_out_table_header (uiout, 18, ui_left, + "addr", "Address"); /* 5 */ + } if (nr_printable_breakpoints > 0) annotate_field (5); ui_out_table_header (uiout, 40, ui_noalign, "what", "What"); /* 6 */ @@ -5187,22 +5196,34 @@ breakpoint_1 (int bnum, int allflag, annotate_breakpoints_table (); ALL_BREAKPOINTS (b) - { - QUIT; - if (bnum == -1 - || bnum == b->number) - { - /* If we have a filter, only list the breakpoints it accepts. */ - if (filter && !filter (b)) - continue; - - /* We only print out user settable breakpoints unless the - allflag is set. */ - if (allflag || user_breakpoint_p (b)) - print_one_breakpoint (b, &last_loc, print_address_bits, allflag); - } - } - + { + QUIT; + /* If we have a filter, only list the breakpoints it accepts. */ + if (filter && !filter (b)) + continue; + + /* If we have an "args" string, it is a list of breakpoints to + accept. Skip the others. */ + + if (args != NULL && *args != '\0') + { + if (allflag) /* maintenance info breakpoint */ + { + if (parse_and_eval_long (args) != b->number) + continue; + } + else /* all others */ + { + if (!number_is_in_list (args, b->number)) + continue; + } + } + /* We only print out user settable breakpoints unless the + allflag is set. */ + if (allflag || user_breakpoint_p (b)) + print_one_breakpoint (b, &last_loc, print_address_bits, allflag); + } + do_cleanups (bkpttbl_chain); if (nr_printable_breakpoints == 0) @@ -5211,12 +5232,12 @@ breakpoint_1 (int bnum, int allflag, empty list. */ if (!filter) { - if (bnum == -1) + if (args == NULL || *args == '\0') ui_out_message (uiout, 0, "No breakpoints or watchpoints.\n"); else ui_out_message (uiout, 0, - "No breakpoint or watchpoint number %d.\n", - bnum); + "No breakpoint or watchpoint matching '%s'.\n", + args); } } else @@ -5252,46 +5273,31 @@ default_collect_info (void) } static void -breakpoints_info (char *bnum_exp, int from_tty) +breakpoints_info (char *args, int from_tty) { - int bnum = -1; - - if (bnum_exp) - bnum = parse_and_eval_long (bnum_exp); - - breakpoint_1 (bnum, 0, NULL); + breakpoint_1 (args, 0, NULL); default_collect_info (); } static void -watchpoints_info (char *wpnum_exp, int from_tty) +watchpoints_info (char *args, int from_tty) { - int wpnum = -1, num_printed; - - if (wpnum_exp) - wpnum = parse_and_eval_long (wpnum_exp); - - num_printed = breakpoint_1 (wpnum, 0, is_watchpoint); + int num_printed = breakpoint_1 (args, 0, is_watchpoint); if (num_printed == 0) { - if (wpnum == -1) + if (args == NULL || *args == '\0') ui_out_message (uiout, 0, "No watchpoints.\n"); else - ui_out_message (uiout, 0, "No watchpoint number %d.\n", wpnum); + ui_out_message (uiout, 0, "No watchpoint matching '%s'.\n", args); } } static void -maintenance_info_breakpoints (char *bnum_exp, int from_tty) +maintenance_info_breakpoints (char *args, int from_tty) { - int bnum = -1; - - if (bnum_exp) - bnum = parse_and_eval_long (bnum_exp); - - breakpoint_1 (bnum, 1, NULL); + breakpoint_1 (args, 1, NULL); default_collect_info (); } @@ -11510,21 +11516,18 @@ create_tracepoint_from_upload (struct uploaded_tp *utp) omitted. */ static void -tracepoints_info (char *tpnum_exp, int from_tty) +tracepoints_info (char *args, int from_tty) { - int tpnum = -1, num_printed; - - if (tpnum_exp) - tpnum = parse_and_eval_long (tpnum_exp); + int num_printed; - num_printed = breakpoint_1 (tpnum, 0, is_tracepoint); + num_printed = breakpoint_1 (args, 0, is_tracepoint); if (num_printed == 0) { - if (tpnum == -1) + if (args == NULL || *args == '\0') ui_out_message (uiout, 0, "No tracepoints.\n"); else - ui_out_message (uiout, 0, "No tracepoint number %d.\n", tpnum); + ui_out_message (uiout, 0, "No tracepoint matching '%s'.\n", args); } default_collect_info (); @@ -12214,7 +12217,7 @@ breakpoint set.")); } add_info ("breakpoints", breakpoints_info, _("\ -Status of user-settable breakpoints, or breakpoint number NUMBER.\n\ +Status of specified breakpoints (all user-settable breakpoints if no argument).\n\ The \"Type\" column indicates one of:\n\ \tbreakpoint - normal breakpoint\n\ \twatchpoint - watchpoint\n\ @@ -12362,9 +12365,7 @@ the memory to which it refers.")); set_cmd_completer (c, expression_completer); add_info ("watchpoints", watchpoints_info, _("\ -Status of watchpoints, or watchpoint number NUMBER.")); - - +Status of specified watchpoints (all watchpoints if no argument).")); /* XXX: cagney/2005-02-23: This should be a boolean, and should respond to changes - contrary to the description. */ @@ -12430,7 +12431,7 @@ Do \"help tracepoints\" for info on other tracepoint commands.")); set_cmd_completer (c, location_completer); add_info ("tracepoints", tracepoints_info, _("\ -Status of tracepoints, or tracepoint number NUMBER.\n\ +Status of specified tracepoints (all tracepoints if no argument).\n\ Convenience variable \"$tpnum\" contains the number of the\n\ last tracepoint set.")); diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 8d9ce1dd005..69b0814cce5 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,9 @@ +2011-02-23 Michael Snyder <msnyder@vmware.com> + + * gdb.texinfo (Set Breaks): Add @dots{} to arguments of info break. + (Set Watchpoints): Add @dots{} to argument of info watchpoints. + (Listing Tracepoints): Add @dots{} to argument of info tracepoints. + 2011-02-22 Doug Evans <dje@google.com> * gdb.texinfo (Symbols In Python): Document lookup_global_symbol. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 74a626ef93c..32bcc7bdfe2 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -3438,12 +3438,12 @@ optionally be surrounded by spaces. @kindex info breakpoints @cindex @code{$_} and @code{info breakpoints} -@item info breakpoints @r{[}@var{n}@r{]} -@itemx info break @r{[}@var{n}@r{]} +@item info breakpoints @r{[}@var{n}@dots{}@r{]} +@itemx info break @r{[}@var{n}@dots{}@r{]} Print a table of all breakpoints, watchpoints, and catchpoints set and not deleted. Optional argument @var{n} means print information only -about the specified breakpoint (or watchpoint or catchpoint). For -each breakpoint, following columns are printed: +about the specified breakpoint(s) (or watchpoint(s) or catchpoint(s)). +For each breakpoint, following columns are printed: @table @emph @item Breakpoint Numbers @@ -3763,8 +3763,8 @@ by the program. Set a watchpoint that will break when @var{expr} is either read from or written into by the program. -@kindex info watchpoints @r{[}@var{n}@r{]} -@item info watchpoints +@kindex info watchpoints @r{[}@var{n}@dots{}@r{]} +@item info watchpoints @r{[}@var{n}@dots{}@r{]} This command prints a list of watchpoints, using the same format as @code{info break} (@pxref{Set Breaks}). @end table @@ -10289,10 +10289,10 @@ tracepoint hit. @subsection Listing Tracepoints @table @code -@kindex info tracepoints -@kindex info tp +@kindex info tracepoints @r{[}@var{n}@dots{}@r{]} +@kindex info tp @r{[}@var{n}@dots{}@r{]} @cindex information about tracepoints -@item info tracepoints @r{[}@var{num}@r{]} +@item info tracepoints @r{[}@var{num}@dots{}@r{]} Display information about the tracepoint @var{num}. If you don't specify a tracepoint number, displays information about all the tracepoints defined so far. The format is similar to that used for diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 9cc5fb08ee4..1855f7a9138 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,4 +1,12 @@ -2011-02-22 Michael Snyder <msnyder@vmware.com> +2011-02-23 Michael Snyder <msnyder@vmware.com> + + * gdb.base/break.exp: Add tests for "info break" with arguments. + * gdb.trace/infotrace.exp: Update patterns for error and help. + * gdb.base/completion.exp: Update pattern. + * gdb.base/ena-dis-br.exp: Update pattern. + * gdb.base/help.exp: Update patterns. + +2011-02-23 Michael Snyder <msnyder@vmware.com> * gdb.base/memattr.exp: New test. * gdb.base/memattr.c: Test load for memattr.exp. diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index dbcc7c0bac2..c02b4379cd3 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -150,6 +150,94 @@ gdb_test "info break" \ \[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_while_conditional at .*$srcfile:$bp_location4" \ "breakpoint info" +# +# Test info breakpoint with arguments +# + +set see1 0 +set see2 0 +set see3 0 +set see4 0 +set see5 0 +set see6 0 + +gdb_test_multiple "info break 2 4 6" "info break 2 4 6" { + -re "1\[\t \]+breakpoint *keep y\[^\r\n\]*:$main_line\[^\r\n\]*" { + set see1 1 + exp_continue + } + -re "2\[\t \]+breakpoint *keep y\[^\r\n\]* in marker2 at \[^\r\n\]*" { + set see2 1 + exp_continue + } + -re "3\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location7\[^\r\n\]*" { + set see3 1 + exp_continue + } + -re "4\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" { + set see4 1 + exp_continue + } + -re "5\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" { + set see5 1 + exp_continue + } + -re "6\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location2\[^\r\n\]*" { + set see6 1 + exp_continue + } + -re ".*$gdb_prompt $" { + if { !$see1 && $see2 && !$see3 && $see4 && !$see5 && $see6 } then { + pass "info break 2 4 6" + } else { + fail "info break 2 4 6" + } + } +} + +set see1 0 +set see2 0 +set see3 0 +set see4 0 +set see5 0 +set see6 0 + +gdb_test_multiple "info break 3-5" "info break 3-5" { + -re "1\[\t \]+breakpoint *keep y.* in main at .*:$main_line\[^\r\n\]*" { + set see1 1 + exp_continue + } + -re "2\[\t \]+breakpoint *keep y\[^\r\n\]* in marker2 at \[^\r\n\]*" { + set see2 1 + exp_continue + } + -re "3\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location7\[^\r\n\]*" { + set see3 1 + exp_continue + } + -re "4\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" { + set see4 1 + exp_continue + } + -re "5\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" { + set see5 1 + exp_continue + } + -re "6\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location2\[^\r\n\]*" { + set see6 1 + exp_continue + } + -re ".*$gdb_prompt $" { + if { !$see1 && !$see2 && $see3 && $see4 && $see5 && !$see6 } then { + pass "info break 3-5" + } else { + fail "info break 3-5" + } + } +} + +gdb_test "print !$see1 && !$see2 && $see3 && $see4 && $see5 && !$see6" "" "" + # FIXME: The rest of this test doesn't work with anything that can't # handle arguments. # Huh? There doesn't *appear* to be anything that passes arguments diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index 83be3845345..1ec542dabf3 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -352,7 +352,7 @@ gdb_expect { -re "^help info watchpoints $"\ { send_gdb "\n" gdb_expect { - -re "Status of watchpoints, .*\r\n.*$gdb_prompt $"\ + -re "Status of specified watchpoints.*\r\n.*$gdb_prompt $"\ { pass "complete help info wat" } -re ".*$gdb_prompt $" { fail "complete help info wat"} timeout {fail "(timeout) complete help info wat"} diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp index 9dd078caa96..46713b9ac98 100644 --- a/gdb/testsuite/gdb.base/ena-dis-br.exp +++ b/gdb/testsuite/gdb.base/ena-dis-br.exp @@ -154,7 +154,7 @@ gdb_test "continue" \ "continue to auto-deleted break marker3" gdb_test "info break $bp" \ - ".*No breakpoint or watchpoint number.*" \ + ".*No breakpoint or watchpoint matching.*" \ "info auto-deleted break marker3" # Verify that we can set a breakpoint and manually disable it (we've diff --git a/gdb/testsuite/gdb.base/help.exp b/gdb/testsuite/gdb.base/help.exp index 749aee750ff..be0d7837c9f 100644 --- a/gdb/testsuite/gdb.base/help.exp +++ b/gdb/testsuite/gdb.base/help.exp @@ -238,7 +238,9 @@ gdb_test "help info all-registers" "List of all registers and their contents, fo # test help info args gdb_test "help info args" "Argument variables of current stack frame\." "help info args" # test help info breakpoints -gdb_test "help info breakpoints" "Status of user-settable breakpoints, or breakpoint number NUMBER\..*\[\r\n\]+breakpoint set\." "help info breakpoints" +gdb_test "help info breakpoints" \ + "Status of specified breakpoints .all user-settable breakpoints if no argument.*\[\r\n\]+breakpoint set\." \ + "help info breakpoints" # test help info catch gdb_test "help info catch" "Exceptions that can be caught in the current stack frame\." "help info catch" # test help info copying @@ -290,7 +292,9 @@ gdb_test "help info variables" "All global and static variable names, or those m # test help info warranty gdb_test "help info warranty" "Various kinds of warranty you do not have\." "help info warranty" # test help info watchpoints -gdb_test "help info watchpoints" "Status of watchpoints, or watchpoint number NUMBER\." "help info watchpoints" +gdb_test "help info watchpoints" \ + "Status of specified watchpoints .all watchpoints if no argument.\." \ + "help info watchpoints" # test help inspect gdb_test "help inspect" "Same as \"print\" command, except that if you are running in the epoch\[\r\n\]+environment, the value is printed in its own window\." "help inspect" # test help jump diff --git a/gdb/testsuite/gdb.trace/infotrace.exp b/gdb/testsuite/gdb.trace/infotrace.exp index b1670895985..491cbf93266 100644 --- a/gdb/testsuite/gdb.trace/infotrace.exp +++ b/gdb/testsuite/gdb.trace/infotrace.exp @@ -73,7 +73,7 @@ gdb_test "info tracepoint $asm_test_num" \ # 2.3 info tracepoint (invalid tracepoint number) gdb_test "info tracepoint [expr $c_test_num + $asm_test_num]" \ - "No tracepoint number [expr $c_test_num + $asm_test_num]." \ + "No tracepoint matching '[expr $c_test_num + $asm_test_num]'." \ "2.3: info tracepoint (invalid tracepoint number)" # 2.4 info tracepoints (list of numbers) @@ -89,6 +89,6 @@ gdb_test_multiple "info tracepoints $c_test_num $asm_test_num " \ # 2.5 help info trace gdb_test "help info tracepoints" \ - "Status of tracepoints, or tracepoint number NUMBER.*" \ + "Status of specified tracepoints .all tracepoints if no argument.*" \ "2.5: help info tracepoints" |