aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog18
-rw-r--r--gdb/breakpoint.c160
-rw-r--r--gdb/breakpoint.h2
-rw-r--r--gdb/doc/ChangeLog4
-rw-r--r--gdb/doc/gdb.texinfo13
-rw-r--r--gdb/mi/mi-cmd-break.c2
-rw-r--r--gdb/testsuite/ChangeLog8
-rw-r--r--gdb/testsuite/gdb.base/completion.exp2
-rw-r--r--gdb/testsuite/gdb.base/default.exp2
-rw-r--r--gdb/testsuite/gdb.base/help.exp2
-rw-r--r--gdb/testsuite/gdb.base/watchpoint.exp10
-rw-r--r--gdb/testsuite/gdb.trace/infotrace.exp2
12 files changed, 137 insertions, 88 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8d68f7a..d47b862 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,22 @@
2010-04-04 Stan Shebs <stan@codesourcery.com>
+ Nathan Sidwell <nathan@codesourcery.com>
+
+ * breakpoint.c (breakpoint_1): Add filter argument, return number of
+ breakpoints printed.
+ (is_hardware_watchpoint): Make argument const.
+ (is_watchpoint): Ditto.
+ (is_tracepoint): Merge of tracepoint_type and breakpoint_is_tracepoint,
+ use it everywhere.
+ (breakpoints_info): Pass NULL to breakpoint_1.
+ (maintenance_info_breakpoints): Ditto.
+ (watchpoints_info): New function.
+ (tracepoints_info): Use breakpoint_1 filter.
+ (set_ignore_count): Warn that tracepoint ignore count will be ignored.
+ (_initialize_breakpoint): Make "info watchpoints" its own command.
+ * breakpoint.h (is_tracepoint): Rename from breakpoint_is_tracepoint.
+ * mi/mi-cmd-break.c (mi_cmd_break_commands): Use is_tracepoint.
+
+2010-04-04 Stan Shebs <stan@codesourcery.com>
* tracepoint.c (tfile_fetch_registers): Add fallback case.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index c6f2e29..2efb766 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -130,7 +130,9 @@ static int watchpoint_locations_match (struct bp_location *loc1,
static void breakpoints_info (char *, int);
-static void breakpoint_1 (int, int);
+static void watchpoints_info (char *, int);
+
+static int breakpoint_1 (int, int, int (*) (const struct breakpoint *));
static bpstat bpstat_alloc (const struct bp_location *, bpstat);
@@ -204,9 +206,9 @@ static void update_global_location_list (int);
static void update_global_location_list_nothrow (int);
-static int is_hardware_watchpoint (struct breakpoint *bpt);
+static int is_hardware_watchpoint (const struct breakpoint *bpt);
-static int is_watchpoint (struct breakpoint *bpt);
+static int is_watchpoint (const struct breakpoint *bpt);
static void insert_breakpoint_locations (void);
@@ -366,7 +368,7 @@ static int overlay_events_enabled;
#define ALL_TRACEPOINTS(B) \
for (B = breakpoint_chain; B; B = B->next) \
- if (tracepoint_type (B))
+ if (is_tracepoint (B))
/* Chains of all breakpoints defined. */
@@ -464,14 +466,6 @@ clear_breakpoint_hit_counts (void)
b->hit_count = 0;
}
-/* Encapsulate tests for different types of tracepoints. */
-
-static int
-tracepoint_type (const struct breakpoint *b)
-{
- return (b->type == bp_tracepoint || b->type == bp_fast_tracepoint);
-}
-
/* Allocate a new counted_command_line with reference count of 1.
The new structure owns COMMANDS. */
@@ -817,20 +811,14 @@ check_no_tracepoint_commands (struct command_line *commands)
}
}
+/* Encapsulate tests for different types of tracepoints. */
+
int
-breakpoint_is_tracepoint (const struct breakpoint *b)
+is_tracepoint (const struct breakpoint *b)
{
- switch (b->type)
- {
- case bp_tracepoint:
- case bp_fast_tracepoint:
- return 1;
- default:
- return 0;
-
- }
+ return (b->type == bp_tracepoint || b->type == bp_fast_tracepoint);
}
-
+
/* A helper function that validsates that COMMANDS are valid for a
breakpoint. This function will throw an exception if a problem is
found. */
@@ -839,7 +827,7 @@ static void
validate_commands_for_breakpoint (struct breakpoint *b,
struct command_line *commands)
{
- if (breakpoint_is_tracepoint (b))
+ if (is_tracepoint (b))
{
/* We need to verify that each top-level element of commands
is valid for tracepoints, that there's at most one while-stepping
@@ -949,7 +937,7 @@ do_map_commands_command (struct breakpoint *b, void *data)
l = read_command_lines (str,
info->from_tty, 1,
- (breakpoint_is_tracepoint (b)
+ (is_tracepoint (b)
? check_tracepoint_command : 0),
b);
@@ -1175,7 +1163,7 @@ insert_catchpoint (struct ui_out *uo, void *args)
/* Return true if BPT is of any hardware watchpoint kind. */
static int
-is_hardware_watchpoint (struct breakpoint *bpt)
+is_hardware_watchpoint (const struct breakpoint *bpt)
{
return (bpt->type == bp_hardware_watchpoint
|| bpt->type == bp_read_watchpoint
@@ -1186,7 +1174,7 @@ is_hardware_watchpoint (struct breakpoint *bpt)
software. */
static int
-is_watchpoint (struct breakpoint *bpt)
+is_watchpoint (const struct breakpoint *bpt)
{
return (is_hardware_watchpoint (bpt)
|| bpt->type == bp_watchpoint);
@@ -1589,7 +1577,7 @@ should_be_inserted (struct bp_location *bpt)
/* Tracepoints are inserted by the target at a time of its choosing,
not by us. */
- if (tracepoint_type (bpt->owner))
+ if (is_tracepoint (bpt->owner))
return 0;
return 1;
@@ -3703,7 +3691,7 @@ bpstat_check_location (const struct bp_location *bl,
/* By definition, the inferior does not report stops at
tracepoints. */
- if (tracepoint_type (b))
+ if (is_tracepoint (b))
return 0;
if (b->type != bp_watchpoint
@@ -4758,7 +4746,7 @@ print_one_breakpoint_location (struct breakpoint *b,
because the condition is an internal implementation detail
that we do not want to expose to the user. */
annotate_field (7);
- if (tracepoint_type (b))
+ if (is_tracepoint (b))
ui_out_text (uiout, "\ttrace only if ");
else
ui_out_text (uiout, "\tstop only if ");
@@ -4938,7 +4926,7 @@ user_settable_breakpoint (const struct breakpoint *b)
return (b->type == bp_breakpoint
|| b->type == bp_catchpoint
|| b->type == bp_hardware_breakpoint
- || tracepoint_type (b)
+ || is_tracepoint (b)
|| b->type == bp_watchpoint
|| b->type == bp_read_watchpoint
|| b->type == bp_access_watchpoint
@@ -4946,11 +4934,14 @@ user_settable_breakpoint (const struct breakpoint *b)
}
/* Print information on user settable breakpoint (watchpoint, etc)
- number BNUM. If BNUM is -1 print all user settable breakpoints.
- If ALLFLAG is non-zero, include non- user settable breakpoints. */
+ number BNUM. If BNUM is -1 print all user-settable breakpoints.
+ If ALLFLAG is non-zero, include non-user-settable breakpoints. If
+ FILTER is non-NULL, call it on each breakpoint and only include the
+ ones for which it returns non-zero. Return the total number of
+ breakpoints listed. */
-static void
-breakpoint_1 (int bnum, int allflag)
+static int
+breakpoint_1 (int bnum, int allflag, int (*filter) (const struct breakpoint *))
{
struct breakpoint *b;
struct bp_location *last_loc = NULL;
@@ -4968,6 +4959,10 @@ breakpoint_1 (int bnum, int allflag)
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_settable_breakpoint (b))
{
int addr_bit = breakpoint_address_bits (b);
@@ -5023,6 +5018,10 @@ breakpoint_1 (int bnum, int allflag)
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_settable_breakpoint (b))
@@ -5034,11 +5033,15 @@ breakpoint_1 (int bnum, int allflag)
if (nr_printable_breakpoints == 0)
{
- if (bnum == -1)
- ui_out_message (uiout, 0, "No breakpoints or watchpoints.\n");
- else
- ui_out_message (uiout, 0, "No breakpoint or watchpoint number %d.\n",
- bnum);
+ /* If there's a filter, let the caller decide how to report empty list. */
+ if (!filter)
+ {
+ if (bnum == -1)
+ ui_out_message (uiout, 0, "No breakpoints or watchpoints.\n");
+ else
+ ui_out_message (uiout, 0, "No breakpoint or watchpoint number %d.\n",
+ bnum);
+ }
}
else
{
@@ -5049,6 +5052,8 @@ breakpoint_1 (int bnum, int allflag)
/* FIXME? Should this be moved up so that it is only called when
there have been breakpoints? */
annotate_breakpoints_table_end ();
+
+ return nr_printable_breakpoints;
}
static void
@@ -5059,7 +5064,26 @@ breakpoints_info (char *bnum_exp, int from_tty)
if (bnum_exp)
bnum = parse_and_eval_long (bnum_exp);
- breakpoint_1 (bnum, 0);
+ breakpoint_1 (bnum, 0, NULL);
+}
+
+static void
+watchpoints_info (char *wpnum_exp, 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);
+
+ if (num_printed == 0)
+ {
+ if (wpnum == -1)
+ ui_out_message (uiout, 0, "No watchpoints.\n");
+ else
+ ui_out_message (uiout, 0, "No watchpoint number %d.\n", wpnum);
+ }
}
static void
@@ -5070,7 +5094,7 @@ maintenance_info_breakpoints (char *bnum_exp, int from_tty)
if (bnum_exp)
bnum = parse_and_eval_long (bnum_exp);
- breakpoint_1 (bnum, 1);
+ breakpoint_1 (bnum, 1, NULL);
}
static int
@@ -5399,7 +5423,7 @@ set_breakpoint_location_function (struct bp_location *loc)
{
if (loc->owner->type == bp_breakpoint
|| loc->owner->type == bp_hardware_breakpoint
- || tracepoint_type (loc->owner))
+ || is_tracepoint (loc->owner))
{
find_pc_partial_function (loc->address, &(loc->function_name),
NULL, NULL);
@@ -5686,7 +5710,7 @@ disable_breakpoints_in_shlibs (void)
if (((b->type == bp_breakpoint)
|| (b->type == bp_jit_event)
|| (b->type == bp_hardware_breakpoint)
- || (tracepoint_type (b)))
+ || (is_tracepoint (b)))
&& loc->pspace == current_program_space
&& !loc->shlib_disabled
#ifdef PC_SOLIB
@@ -9042,7 +9066,7 @@ update_global_location_list (int should_insert)
|| !loc->enabled
|| loc->shlib_disabled
|| !breakpoint_address_is_meaningful (b)
- || tracepoint_type (b))
+ || is_tracepoint (b))
continue;
/* Permanent breakpoint should always be inserted. */
@@ -9702,6 +9726,14 @@ set_ignore_count (int bptnum, int count, int from_tty)
ALL_BREAKPOINTS (b)
if (b->number == bptnum)
{
+ if (is_tracepoint (b))
+ {
+ if (from_tty && count != 0)
+ printf_filtered (_("Ignore count ignored for tracepoint %d."),
+ bptnum);
+ return;
+ }
+
b->ignore_count = count;
if (from_tty)
{
@@ -10421,29 +10453,20 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
static void
tracepoints_info (char *tpnum_exp, int from_tty)
{
- struct breakpoint *b;
- int tps_to_list = 0;
+ int tpnum = -1, num_printed;
+
+ if (tpnum_exp)
+ tpnum = parse_and_eval_long (tpnum_exp);
- /* In the no-arguments case, say "No tracepoints" if none found. */
- if (tpnum_exp == 0)
+ num_printed = breakpoint_1 (tpnum, 0, is_tracepoint);
+
+ if (num_printed == 0)
{
- ALL_TRACEPOINTS (b)
- {
- if (b->number >= 0)
- {
- tps_to_list = 1;
- break;
- }
- }
- if (!tps_to_list)
- {
- ui_out_message (uiout, 0, "No tracepoints.\n");
- return;
- }
+ if (tpnum == -1)
+ ui_out_message (uiout, 0, "No tracepoints.\n");
+ else
+ ui_out_message (uiout, 0, "No tracepoint number %d.\n", tpnum);
}
-
- /* Otherwise be the same as "info break". */
- breakpoints_info (tpnum_exp, from_tty);
}
/* The 'enable trace' command enables tracepoints.
@@ -10492,7 +10515,7 @@ delete_trace_command (char *arg, int from_tty)
{
ALL_BREAKPOINTS_SAFE (b, temp)
{
- if (tracepoint_type (b)
+ if (is_tracepoint (b)
&& b->number >= 0)
delete_breakpoint (b);
}
@@ -11134,8 +11157,9 @@ A watchpoint stops execution of your program whenever the value of\n\
an expression is either read or written."));
set_cmd_completer (c, expression_completer);
- add_info ("watchpoints", breakpoints_info,
- _("Synonym for ``info breakpoints''."));
+ add_info ("watchpoints", watchpoints_info, _("\
+Status of watchpoints, or watchpoint number NUMBER."));
+
/* XXX: cagney/2005-02-23: This should be a boolean, and should
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index a17a9dd..912cc3c 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1030,7 +1030,7 @@ extern struct breakpoint *get_tracepoint_by_number (char **arg, int multi_p,
is newly allocated; the caller should free when done with it. */
extern VEC(breakpoint_p) *all_tracepoints (void);
-extern int breakpoint_is_tracepoint (const struct breakpoint *b);
+extern int is_tracepoint (const struct breakpoint *b);
/* Function that can be passed to read_command_line to validate
that each command is suitable for tracepoint command list. */
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 3d1e2cd..9d9939f 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,5 +1,9 @@
2010-04-04 Stan Shebs <stan@codesourcery.com>
+ * gdb.texinfo (Setting Breakpoints): "info watch" no longer a synonym.
+ (Setting Watchpoints): Update description of "info watch".
+ (Disabling Breakpoints): Only "info break" lists all.
+
* gdb.texinfo (Tracepoint Restrictions): Document PC inference.
(tdump): Explain how tdump works.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index e61bd7e..8a4181c 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -3388,7 +3388,6 @@ The @code{rbreak} command can be used to set breakpoints in
@cindex @code{$_} and @code{info breakpoints}
@item info breakpoints @r{[}@var{n}@r{]}
@itemx info break @r{[}@var{n}@r{]}
-@itemx info watchpoints @r{[}@var{n}@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
@@ -3705,8 +3704,8 @@ or written into by the program.
@kindex info watchpoints @r{[}@var{n}@r{]}
@item info watchpoints
-This command prints a list of watchpoints, breakpoints, and catchpoints;
-it is the same as @code{info break} (@pxref{Set Breaks}).
+This command prints a list of watchpoints, using the same format as
+@code{info break} (@pxref{Set Breaks}).
@end table
@value{GDBN} sets a @dfn{hardware watchpoint} if possible. Hardware
@@ -4135,10 +4134,10 @@ it had been deleted, but remembers the information on the breakpoint so
that you can @dfn{enable} it again later.
You disable and enable breakpoints, watchpoints, and catchpoints with
-the @code{enable} and @code{disable} commands, optionally specifying one
-or more breakpoint numbers as arguments. Use @code{info break} or
-@code{info watch} to print a list of breakpoints, watchpoints, and
-catchpoints if you do not know which numbers to use.
+the @code{enable} and @code{disable} commands, optionally specifying
+one or more breakpoint numbers as arguments. Use @code{info break} to
+print a list of all breakpoints, watchpoints, and catchpoints if you
+do not know which numbers to use.
Disabling and enabling a breakpoint that has multiple locations
affects all of its locations.
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
index c5a098e..ae83b98 100644
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -303,7 +303,7 @@ mi_cmd_break_commands (char *command, char **argv, int argc)
mi_command_line_array_ptr = 1;
mi_command_line_array_cnt = argc;
- if (breakpoint_is_tracepoint (b))
+ if (is_tracepoint (b))
break_command = read_command_lines_1 (mi_read_next_line, 1,
check_tracepoint_command, b);
else
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8566e4a..c748f94 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,13 @@
2010-04-04 Stan Shebs <stan@codesourcery.com>
+ * gdb.base/completion.exp: Update for new "info watchpoints".
+ * gdb.base/default.exp: Ditto.
+ * gdb.base/help.exp: Ditto.
+ * gdb.base/watchpoint.exp: Ditto.
+ * gdb.trace/infotrace.exp: Update "info tracpoints" output.
+
+2010-04-04 Stan Shebs <stan@codesourcery.com>
+
* gdb.trace/tfile.exp: Sharpen tfind test.
2010-04-04 Jan Kratochvil <jan.kratochvil@redhat.com>
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index 8b1e09a..fbd8599 100644
--- a/gdb/testsuite/gdb.base/completion.exp
+++ b/gdb/testsuite/gdb.base/completion.exp
@@ -354,7 +354,7 @@ gdb_expect {
-re "^help info watchpoints $"\
{ send_gdb "\n"
gdb_expect {
- -re "Synonym for .*\r\n.*$gdb_prompt $"\
+ -re "Status of 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/default.exp b/gdb/testsuite/gdb.base/default.exp
index bed00e6..97d5407 100644
--- a/gdb/testsuite/gdb.base/default.exp
+++ b/gdb/testsuite/gdb.base/default.exp
@@ -353,7 +353,7 @@ gdb_test "info vector" "The program has no registers now." "info vector"
#test info warranty
gdb_test "info warranty" "15. *Disclaimer of Warranty.*" "info warranty"
#test info watchpoints
-gdb_test "info watchpoints" "No breakpoints or watchpoints." "info watchpoints"
+gdb_test "info watchpoints" "No watchpoints." "info watchpoints"
#test inspect
gdb_test "inspect" "The history is empty." "inspect"
#test jump
diff --git a/gdb/testsuite/gdb.base/help.exp b/gdb/testsuite/gdb.base/help.exp
index d71641b9..487879b 100644
--- a/gdb/testsuite/gdb.base/help.exp
+++ b/gdb/testsuite/gdb.base/help.exp
@@ -294,7 +294,7 @@ 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" "Synonym for ``info breakpoints''\." "help info watchpoints"
+gdb_test "help info watchpoints" "Status of watchpoints, or watchpoint number NUMBER\." "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.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp
index 7de577b..968998f 100644
--- a/gdb/testsuite/gdb.base/watchpoint.exp
+++ b/gdb/testsuite/gdb.base/watchpoint.exp
@@ -102,9 +102,7 @@ proc initialize {} {
}
}
- # "info watch" is the same as "info break"
-
- if [gdb_test "info watch" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n3\[ \]*.*watchpoint.*ival3" "watchpoint found in watchpoint/breakpoint table" ] {
+ if [gdb_test "info watch" "3\[ \]*.*watchpoint.*ival3" "watchpoint found in watchpoint/breakpoint table" ] {
return 0;
}
@@ -176,11 +174,9 @@ proc test_simple_watchpoint {} {
set wp_set 1
- # "info watch" is the same as "info break"
-
send_gdb "info watch\n"
gdb_expect {
- -re "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n3\[ \]*.*watchpoint.*ival3\r\n$gdb_prompt $" {
+ -re "3\[ \]*.*watchpoint.*ival3\r\n$gdb_prompt $" {
pass "watchpoint found in watchpoint/breakpoint table"
}
-re ".*$gdb_prompt $" {
@@ -297,7 +293,7 @@ proc test_disabling_watchpoints {} {
global hex
# "info watch" is the same as "info break"
- gdb_test "info watch" "\[0-9\]+\[ \]*breakpoint.*marker1.*\r\n\[0-9\]+\[ \]*breakpoint.*marker2.*\r\n\[0-9]+\[ \]*.*watchpoint.*ival3\r\n\.*\[0-9\]+ times.*" "watchpoints found in watchpoint/breakpoint table"
+ gdb_test "info watch" "\[0-9]+\[ \]*.*watchpoint.*ival3\r\n\.*\[0-9\]+ times.*" "watchpoints found in watchpoint/breakpoint table"
# Ensure that the watchpoint is disabled when we startup.
diff --git a/gdb/testsuite/gdb.trace/infotrace.exp b/gdb/testsuite/gdb.trace/infotrace.exp
index f5c18d5..2718efd 100644
--- a/gdb/testsuite/gdb.trace/infotrace.exp
+++ b/gdb/testsuite/gdb.trace/infotrace.exp
@@ -74,7 +74,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 breakpoint or watchpoint number [expr $c_test_num + $asm_test_num]." \
+ "No tracepoint number [expr $c_test_num + $asm_test_num]." \
"2.3: info tracepoint (invalid tracepoint number)"
# 2.4 info tracepoints (list of numbers)