aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2010-07-21 11:25:53 +0000
committerPedro Alves <palves@redhat.com>2010-07-21 11:25:53 +0000
commit269b11a298661a350ca79807544d0b58b7d18a3d (patch)
treeddf04a7a4d289032f8936743b9ba8a4d52765bf3 /gdb/breakpoint.c
parentb806f530e2fcc9c58320575ac74138a9dad63467 (diff)
downloadgdb-269b11a298661a350ca79807544d0b58b7d18a3d.zip
gdb-269b11a298661a350ca79807544d0b58b7d18a3d.tar.gz
gdb-269b11a298661a350ca79807544d0b58b7d18a3d.tar.bz2
* breakpoint.c (bptype_string): New, abstracted out from
print_one_breakpoint_location. (print_one_breakpoint_location): Adjust. (breakpoint_1): Adjust the type column width dynamically.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c58
1 files changed, 36 insertions, 22 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index a9be450..b53b515 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -4433,16 +4433,9 @@ static void print_breakpoint_location (struct breakpoint *b,
do_cleanups (old_chain);
}
-/* Print B to gdb_stdout. */
-static void
-print_one_breakpoint_location (struct breakpoint *b,
- struct bp_location *loc,
- int loc_number,
- struct bp_location **last_loc,
- int print_address_bits,
- int allflag)
+static const char *
+bptype_string (enum bptype type)
{
- struct command_line *l;
struct ep_type_description
{
enum bptype type;
@@ -4476,7 +4469,27 @@ print_one_breakpoint_location (struct breakpoint *b,
{bp_static_tracepoint, "static tracepoint"},
{bp_jit_event, "jit events"},
};
-
+
+ if (((int) type >= (sizeof (bptypes) / sizeof (bptypes[0])))
+ || ((int) type != bptypes[(int) type].type))
+ internal_error (__FILE__, __LINE__,
+ _("bptypes table does not describe type #%d."),
+ (int) type);
+
+ return bptypes[(int) type].description;
+}
+
+/* Print B to gdb_stdout. */
+
+static void
+print_one_breakpoint_location (struct breakpoint *b,
+ struct bp_location *loc,
+ int loc_number,
+ struct bp_location **last_loc,
+ int print_address_bits,
+ int allflag)
+{
+ struct command_line *l;
static char bpenables[] = "nynny";
char wrap_indent[80];
struct ui_stream *stb = ui_out_stream_new (uiout);
@@ -4521,15 +4534,8 @@ print_one_breakpoint_location (struct breakpoint *b,
annotate_field (1);
if (part_of_multiple)
ui_out_field_skip (uiout, "type");
- else
- {
- if (((int) b->type >= (sizeof (bptypes) / sizeof (bptypes[0])))
- || ((int) b->type != bptypes[(int) b->type].type))
- internal_error (__FILE__, __LINE__,
- _("bptypes table does not describe type #%d."),
- (int) b->type);
- ui_out_field_string (uiout, "type", bptypes[(int) b->type].description);
- }
+ else
+ ui_out_field_string (uiout, "type", bptype_string (b->type));
/* 3 */
annotate_field (2);
@@ -4907,7 +4913,8 @@ breakpoint_1 (int bnum, int allflag, int (*filter) (const struct breakpoint *))
struct cleanup *bkpttbl_chain;
struct value_print_options opts;
int print_address_bits = 0;
-
+ int print_type_col_width = 14;
+
get_user_print_options (&opts);
/* Compute the number of rows in the table, as well as the
@@ -4923,10 +4930,16 @@ breakpoint_1 (int bnum, int allflag, int (*filter) (const struct breakpoint *))
if (allflag || user_settable_breakpoint (b))
{
- int addr_bit = breakpoint_address_bits (b);
+ int addr_bit, type_len;
+
+ addr_bit = breakpoint_address_bits (b);
if (addr_bit > print_address_bits)
print_address_bits = addr_bit;
+ type_len = strlen (bptype_string (b->type));
+ if (type_len > print_type_col_width)
+ print_type_col_width = type_len;
+
nr_printable_breakpoints++;
}
}
@@ -4947,7 +4960,8 @@ breakpoint_1 (int bnum, int allflag, int (*filter) (const struct breakpoint *))
ui_out_table_header (uiout, 7, ui_left, "number", "Num"); /* 1 */
if (nr_printable_breakpoints > 0)
annotate_field (1);
- ui_out_table_header (uiout, 14, ui_left, "type", "Type"); /* 2 */
+ ui_out_table_header (uiout, print_type_col_width, ui_left,
+ "type", "Type"); /* 2 */
if (nr_printable_breakpoints > 0)
annotate_field (2);
ui_out_table_header (uiout, 4, ui_left, "disp", "Disp"); /* 3 */