From b25959ec59e10f6956995cbf3bed1bbec7f36d5d Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Thu, 21 Jun 2001 15:39:54 +0000 Subject: [PATCH] * ui-out.h (ui_out_table_header): Add parameter ``col_name''. (table_header_ftype): Ditto. * cli-out.c (cli_table_header): Update. * ui-out.c (ui_out_table_header): Update. (uo_table_header): Update. (default_table_header): Update. (append_header_to_list): Update. (struct ui_out_header): Add field ``col_name''. (append_header_to_list): Use xstrdup. Initialize col_name. * breakpoint.c (breakpoint_1): Pass COL_NAME to ui_out_table_header. --- gdb/ChangeLog | 14 ++++++++++++++ gdb/breakpoint.c | 14 +++++++------- gdb/cli-out.c | 3 ++- gdb/mi/ChangeLog | 4 ++++ gdb/mi/mi-out.c | 3 ++- gdb/ui-out.c | 30 ++++++++++++++++++++---------- gdb/ui-out.h | 5 +++-- 7 files changed, 52 insertions(+), 21 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1e436d8d49..9761c7eed2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +2001-06-20 Andrew Cagney + + * ui-out.h (ui_out_table_header): Add parameter ``col_name''. + (table_header_ftype): Ditto. + * cli-out.c (cli_table_header): Update. + * ui-out.c (ui_out_table_header): Update. + (uo_table_header): Update. + (default_table_header): Update. + (append_header_to_list): Update. + (struct ui_out_header): Add field ``col_name''. + (append_header_to_list): Use xstrdup. Initialize col_name. + * breakpoint.c (breakpoint_1): Pass COL_NAME to + ui_out_table_header. + 2001-06-19 Andrew Cagney * cli-out.c: Include "gdb_assert.h'. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index e8c9c7390c..879a31eb21 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -3601,23 +3601,23 @@ breakpoint_1 (int bnum, int allflag) { annotate_breakpoints_headers (); annotate_field (0); - ui_out_table_header (uiout, 3, ui_left, "Num"); /* 1 */ + ui_out_table_header (uiout, 3, ui_left, "number", "Num"); /* 1 */ annotate_field (1); - ui_out_table_header (uiout, 14, ui_left, "Type"); /* 2 */ + ui_out_table_header (uiout, 14, ui_left, "type", "Type"); /* 2 */ annotate_field (2); - ui_out_table_header (uiout, 4, ui_left, "Disp"); /* 3 */ + ui_out_table_header (uiout, 4, ui_left, "disp", "Disp"); /* 3 */ annotate_field (3); - ui_out_table_header (uiout, 3, ui_left, "Enb"); /* 4 */ + ui_out_table_header (uiout, 3, ui_left, "enabled", "Enb"); /* 4 */ if (addressprint) { annotate_field (4); if (TARGET_ADDR_BIT <= 32) - ui_out_table_header (uiout, 10, ui_left, "Address"); /* 5 */ + ui_out_table_header (uiout, 10, ui_left, "addr", "Address");/* 5 */ else - ui_out_table_header (uiout, 18, ui_left, "Address"); /* 5 */ + ui_out_table_header (uiout, 18, ui_left, "addr", "Address");/* 5 */ } annotate_field (5); - ui_out_table_header (uiout, 40, ui_noalign, "What"); /* 6 */ + ui_out_table_header (uiout, 40, ui_noalign, "what", "What"); /* 6 */ ui_out_table_body (uiout); annotate_breakpoints_table (); } diff --git a/gdb/cli-out.c b/gdb/cli-out.c index 367c92aaf1..3e8e482f4d 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -45,7 +45,7 @@ static void cli_table_begin (struct ui_out *uiout, int nbrofcols, static void cli_table_body (struct ui_out *uiout); static void cli_table_end (struct ui_out *uiout); static void cli_table_header (struct ui_out *uiout, int width, - enum ui_align alig, + enum ui_align alig, const char *col_name, const char *colhdr); static void cli_begin (struct ui_out *uiout, enum ui_out_type type, int level, const char *lstid); @@ -147,6 +147,7 @@ cli_table_end (struct ui_out *uiout) void cli_table_header (struct ui_out *uiout, int width, enum ui_align alignment, + const char *col_name, const char *colhdr) { struct ui_out_data *data = ui_out_data (uiout); diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index fbf92ac875..447138c816 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -1,3 +1,7 @@ +2001-06-20 Andrew Cagney + + * mi-out.c (mi_table_header): Add parameter ``col_name''. + 2001-06-18 Andrew Cagney * mi-out.c: Include "gdb_assert.h". diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index 1aaac6afa3..1cc81806d3 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -44,7 +44,7 @@ static void mi_table_begin (struct ui_out *uiout, int nbrofcols, static void mi_table_body (struct ui_out *uiout); static void mi_table_end (struct ui_out *uiout); static void mi_table_header (struct ui_out *uiout, int width, - enum ui_align alig, + enum ui_align alig, const char *col_name, const char *colhdr); static void mi_begin (struct ui_out *uiout, enum ui_out_type type, int level, const char *id); @@ -138,6 +138,7 @@ mi_table_end (struct ui_out *uiout) void mi_table_header (struct ui_out *uiout, int width, int alignment, + const char *col_name, const char *colhdr) { struct ui_out_data *data = ui_out_data (uiout); diff --git a/gdb/ui-out.c b/gdb/ui-out.c index bb7784c88d..5fe212bcd0 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -39,6 +39,7 @@ struct ui_out_hdr int colno; int width; int alignment; + char *col_name; char *colhdr; struct ui_out_hdr *next; }; @@ -139,7 +140,7 @@ static void default_table_begin (struct ui_out *uiout, int nbrofcols, static void default_table_body (struct ui_out *uiout); static void default_table_end (struct ui_out *uiout); static void default_table_header (struct ui_out *uiout, int width, - enum ui_align alig, + enum ui_align alig, const char *col_name, const char *colhdr); static void default_begin (struct ui_out *uiout, enum ui_out_type type, @@ -213,7 +214,8 @@ static void uo_table_begin (struct ui_out *uiout, int nbrofcols, static void uo_table_body (struct ui_out *uiout); static void uo_table_end (struct ui_out *uiout); static void uo_table_header (struct ui_out *uiout, int width, - enum ui_align align, const char *colhdr); + enum ui_align align, const char *col_name, + const char *colhdr); static void uo_begin (struct ui_out *uiout, enum ui_out_type type, int level, const char *id); @@ -241,7 +243,8 @@ static void uo_flush (struct ui_out *uiout); extern void _initialize_ui_out (void); static void append_header_to_list (struct ui_out *uiout, int width, - int alignment, const char *colhdr); + int alignment, const char *col_name, + const char *colhdr); static int get_curr_header (struct ui_out *uiout, int *colno, int *width, int *alignment, char **colhdr); static void clear_header_list (struct ui_out *uiout); @@ -316,6 +319,7 @@ ui_out_table_end (struct ui_out *uiout) void ui_out_table_header (struct ui_out *uiout, int width, enum ui_align alignment, + const char *col_name, const char *colhdr) { if (!uiout->table_flag || uiout->body_flag) @@ -323,9 +327,9 @@ ui_out_table_header (struct ui_out *uiout, int width, enum ui_align alignment, "table header must be specified after table_begin \ and before table_body."); - append_header_to_list (uiout, width, alignment, colhdr); + append_header_to_list (uiout, width, alignment, col_name, colhdr); - uo_table_header (uiout, width, alignment, colhdr); + uo_table_header (uiout, width, alignment, col_name, colhdr); } void @@ -729,6 +733,7 @@ default_table_end (struct ui_out *uiout) static void default_table_header (struct ui_out *uiout, int width, enum ui_align alignment, + const char *col_name, const char *colhdr) { } @@ -837,11 +842,12 @@ uo_table_end (struct ui_out *uiout) void uo_table_header (struct ui_out *uiout, int width, enum ui_align align, + const char *col_name, const char *colhdr) { if (!uiout->impl->table_header) return; - uiout->impl->table_header (uiout, width, align, colhdr); + uiout->impl->table_header (uiout, width, align, col_name, colhdr); } void @@ -972,6 +978,7 @@ static void append_header_to_list (struct ui_out *uiout, int width, int alignment, + const char *col_name, const char *colhdr) { struct ui_out_hdr *temphdr; @@ -981,10 +988,13 @@ append_header_to_list (struct ui_out *uiout, temphdr->alignment = alignment; /* we have to copy the column title as the original may be an automatic */ if (colhdr != NULL) - { - temphdr->colhdr = xmalloc (strlen (colhdr) + 1); - strcpy (temphdr->colhdr, colhdr); - } + temphdr->colhdr = xstrdup (colhdr); + else + temphdr->colhdr = NULL; + if (col_name != NULL) + temphdr->col_name = xstrdup (colhdr); + else + temphdr->col_name = xstrdup (colhdr); temphdr->next = NULL; if (uiout->headerfirst == NULL) { diff --git a/gdb/ui-out.h b/gdb/ui-out.h index b302d843ad..e71c291fca 100644 --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -93,7 +93,8 @@ extern void ui_out_table_begin (struct ui_out *uiout, int nbrofcols, int nr_rows, const char *tblid); extern void ui_out_table_header (struct ui_out *uiout, int width, - enum ui_align align, const char *colhdr); + enum ui_align align, const char *col_name, + const char *colhdr); extern void ui_out_table_body (struct ui_out *uiout); @@ -197,7 +198,7 @@ typedef void (table_begin_ftype) (struct ui_out * uiout, typedef void (table_body_ftype) (struct ui_out * uiout); typedef void (table_end_ftype) (struct ui_out * uiout); typedef void (table_header_ftype) (struct ui_out * uiout, int width, - enum ui_align align, + enum ui_align align, const char *col_name, const char *colhdr); /* Note: level 0 is the top-level so LEVEL is always greater than zero. */ -- 2.34.1