aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2001-06-18 18:48:06 +0000
committerAndrew Cagney <cagney@redhat.com>2001-06-18 18:48:06 +0000
commit7f3b047364374db2dddbade072311052349202b3 (patch)
tree7046598508ef6a74ce1f60b32f70e037e06afbe0 /gdb
parentb30bf9ee99a2fd704f3a335d185041e7432f3105 (diff)
downloadgdb-7f3b047364374db2dddbade072311052349202b3.zip
gdb-7f3b047364374db2dddbade072311052349202b3.tar.gz
gdb-7f3b047364374db2dddbade072311052349202b3.tar.bz2
* breakpoint.c (breakpoint_1): Restructure. Compute the
nr_printable_breakpoints. Move the header output to before the main print breakpoints loop. (user_settable_breakpoint): New function.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/breakpoint.c157
2 files changed, 96 insertions, 68 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a0614d7..c135e03 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2001-06-16 Andrew Cagney <ac131313@redhat.com>
+
+ * breakpoint.c (breakpoint_1): Restructure. Compute the
+ nr_printable_breakpoints. Move the header output to before the
+ main print breakpoints loop.
+ (user_settable_breakpoint): New function.
+
2001-06-18 Andrew Cagney <ac131313@redhat.com>
* infrun.c, breakpoint.c: Use strncmp as the "mi" test. Allow,
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index be5450b..7edba89 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3547,17 +3547,48 @@ gdb_breakpoint_query (/* output object, */ int bnum)
NULL, RETURN_MASK_ALL);
}
-/* Print information on breakpoint number BNUM, or -1 if all.
- If WATCHPOINTS is zero, process only breakpoints; if WATCHPOINTS
- is nonzero, process only watchpoints. */
+/* Return non-zero if B is user settable (breakpoints, watchpoints,
+ catchpoints, et.al.). */
+
+static int
+user_settable_breakpoint (const struct breakpoint *b)
+{
+ return (b->type == bp_breakpoint
+ || b->type == bp_catch_load
+ || b->type == bp_catch_unload
+ || b->type == bp_catch_fork
+ || b->type == bp_catch_vfork
+ || b->type == bp_catch_exec
+ || b->type == bp_catch_catch
+ || b->type == bp_catch_throw
+ || b->type == bp_hardware_breakpoint
+ || b->type == bp_watchpoint
+ || b->type == bp_read_watchpoint
+ || b->type == bp_access_watchpoint
+ || b->type == bp_hardware_watchpoint);
+}
+
+/* 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. */
static void
breakpoint_1 (int bnum, int allflag)
{
register struct breakpoint *b;
CORE_ADDR last_addr = (CORE_ADDR) -1;
- int found_a_breakpoint = 0;
+ int nr_printable_breakpoints;
+ /* Compute the number of rows in the table. */
+ nr_printable_breakpoints = 0;
+ ALL_BREAKPOINTS (b)
+ if (bnum == -1
+ || bnum == b->number)
+ {
+ if (allflag || user_settable_breakpoint (b))
+ nr_printable_breakpoints++;
+ }
+
#ifdef UI_OUT
if (addressprint)
ui_out_table_begin (uiout, 6, "BreakpointTable");
@@ -3565,78 +3596,68 @@ breakpoint_1 (int bnum, int allflag)
ui_out_table_begin (uiout, 5, "BreakpointTable");
#endif /* UI_OUT */
+#ifdef UI_OUT
+ if (nr_printable_breakpoints > 0)
+ {
+ annotate_breakpoints_headers ();
+ annotate_field (0);
+ ui_out_table_header (uiout, 3, ui_left, "Num"); /* 1 */
+ annotate_field (1);
+ ui_out_table_header (uiout, 14, ui_left, "Type"); /* 2 */
+ annotate_field (2);
+ ui_out_table_header (uiout, 4, ui_left, "Disp"); /* 3 */
+ annotate_field (3);
+ ui_out_table_header (uiout, 3, ui_left, "Enb"); /* 4 */
+ if (addressprint)
+ {
+ annotate_field (4);
+ if (TARGET_ADDR_BIT <= 32)
+ ui_out_table_header (uiout, 10, ui_left, "Address"); /* 5 */
+ else
+ ui_out_table_header (uiout, 18, ui_left, "Address"); /* 5 */
+ }
+ annotate_field (5);
+ ui_out_table_header (uiout, 40, ui_noalign, "What"); /* 6 */
+ ui_out_table_body (uiout);
+ annotate_breakpoints_table ();
+ }
+#else
+ if (nr_printable_breakpoints > 0)
+ {
+ annotate_breakpoints_headers ();
+ annotate_field (0);
+ printf_filtered ("Num ");
+ annotate_field (1);
+ printf_filtered ("Type ");
+ annotate_field (2);
+ printf_filtered ("Disp ");
+ annotate_field (3);
+ printf_filtered ("Enb ");
+ if (addressprint)
+ {
+ annotate_field (4);
+ if (TARGET_ADDR_BIT <= 32)
+ printf_filtered ("Address ");
+ else
+ printf_filtered ("Address ");
+ }
+ annotate_field (5);
+ printf_filtered ("What\n");
+ annotate_breakpoints_table ();
+ }
+#endif /* UI_OUT */
+
ALL_BREAKPOINTS (b)
if (bnum == -1
|| bnum == b->number)
{
/* We only print out user settable breakpoints unless the
allflag is set. */
- if (!allflag
- && b->type != bp_breakpoint
- && b->type != bp_catch_load
- && b->type != bp_catch_unload
- && b->type != bp_catch_fork
- && b->type != bp_catch_vfork
- && b->type != bp_catch_exec
- && b->type != bp_catch_catch
- && b->type != bp_catch_throw
- && b->type != bp_hardware_breakpoint
- && b->type != bp_watchpoint
- && b->type != bp_read_watchpoint
- && b->type != bp_access_watchpoint
- && b->type != bp_hardware_watchpoint)
- continue;
-
- if (!found_a_breakpoint++)
- {
- annotate_breakpoints_headers ();
-#ifdef UI_OUT
- annotate_field (0);
- ui_out_table_header (uiout, 3, ui_left, "Num"); /* 1 */
- annotate_field (1);
- ui_out_table_header (uiout, 14, ui_left, "Type"); /* 2 */
- annotate_field (2);
- ui_out_table_header (uiout, 4, ui_left, "Disp"); /* 3 */
- annotate_field (3);
- ui_out_table_header (uiout, 3, ui_left, "Enb"); /* 4 */
- if (addressprint)
- {
- annotate_field (4);
- if (TARGET_ADDR_BIT <= 32)
- ui_out_table_header (uiout, 10, ui_left, "Address"); /* 5 */
- else
- ui_out_table_header (uiout, 18, ui_left, "Address"); /* 5 */
- }
- annotate_field (5);
- ui_out_table_header (uiout, 40, ui_noalign, "What"); /* 6 */
- ui_out_table_body (uiout);
-#else
- annotate_field (0);
- printf_filtered ("Num ");
- annotate_field (1);
- printf_filtered ("Type ");
- annotate_field (2);
- printf_filtered ("Disp ");
- annotate_field (3);
- printf_filtered ("Enb ");
- if (addressprint)
- {
- annotate_field (4);
- if (TARGET_ADDR_BIT <= 32)
- printf_filtered ("Address ");
- else
- printf_filtered ("Address ");
- }
- annotate_field (5);
- printf_filtered ("What\n");
-#endif /* UI_OUT */
- annotate_breakpoints_table ();
- }
-
- print_one_breakpoint (b, &last_addr);
+ if (allflag || user_settable_breakpoint (b))
+ print_one_breakpoint (b, &last_addr);
}
- if (!found_a_breakpoint)
+ if (nr_printable_breakpoints == 0)
{
#ifdef UI_OUT
if (bnum == -1)