* 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.
This commit is contained in:
Pedro Alves 2010-07-21 11:25:53 +00:00
parent b806f530e2
commit 269b11a298
2 changed files with 43 additions and 22 deletions

View File

@ -1,3 +1,10 @@
2010-07-21 Pedro Alves <pedro@codesourcery.com>
* 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.
2010-07-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* symfile.c (find_separate_debug_file_by_debuglink): Remove

View File

@ -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 */