From b02dede2530b98757773e64f3b6951eea587ab83 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Sun, 20 Jan 2002 19:20:16 +0000 Subject: [PATCH] 2002-01-20 Daniel Jacobowitz * gdbtypes.h (struct cplus_struct_type): Add is_artificial to member function fields. Add accessor macro TYPE_FN_FIELD_ARTIFICIAL. * dwarf2read.c (dwarf2_add_member_fn): Check for artificial methods. * c-typeprint.c (c_type_print_base): Skip artificial member functions. --- gdb/ChangeLog | 9 +++++++++ gdb/c-typeprint.c | 25 ++++++++++++++++++++----- gdb/dwarf2read.c | 5 +++++ gdb/gdbtypes.h | 4 +++- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 73ddf08dca4..1b4ef884940 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2002-01-20 Daniel Jacobowitz + + * gdbtypes.h (struct cplus_struct_type): Add is_artificial to + member function fields. Add accessor macro + TYPE_FN_FIELD_ARTIFICIAL. + * dwarf2read.c (dwarf2_add_member_fn): Check for artificial methods. + * c-typeprint.c (c_type_print_base): Skip artificial member + functions. + 2002-01-20 Daniel Jacobowitz * f-typeprint.c: Delete unused function f_type_print_args. diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index a202db437b2..667ead01ea5 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -642,9 +642,9 @@ void c_type_print_base (struct type *type, struct ui_file *stream, int show, int level) { - register int i; - register int len; - register int lastval; + int i; + int len, real_len; + int lastval; char *mangled_name; char *demangled_name; char *demangled_no_static; @@ -907,9 +907,21 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show, fprintf_filtered (stream, ";\n"); } - /* If there are both fields and methods, put a space between. */ + /* If there are both fields and methods, put a blank line + between them. Make sure to count only method that we will + display; artificial methods will be hidden. */ len = TYPE_NFN_FIELDS (type); - if (len && section_type != s_none) + real_len = 0; + for (i = 0; i < len; i++) + { + struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i); + int len2 = TYPE_FN_FIELDLIST_LENGTH (type, i); + int j; + for (j = 0; j < len2; j++) + if (!TYPE_FN_FIELD_ARTIFICIAL (f, j)) + real_len++; + } + if (real_len > 0 && section_type != s_none) fprintf_filtered (stream, "\n"); /* C++: print out the methods */ @@ -928,6 +940,9 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show, || is_destructor_name (physname) || method_name[0] == '~'; + /* Do not print out artificial methods. */ + if (TYPE_FN_FIELD_ARTIFICIAL (f, j)) + continue; QUIT; if (TYPE_FN_FIELD_PROTECTED (f, j)) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index b0b401ee373..5c4567831bf 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -2168,6 +2168,11 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, } } + /* Check for artificial methods. */ + attr = dwarf_attr (die, DW_AT_artificial); + if (attr && DW_UNSND (attr) != 0) + fnp->is_artificial = 1; + /* Get index in virtual function table if it is a virtual member function. */ attr = dwarf_attr (die, DW_AT_vtable_elem_location); if (attr) diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 3cb561348d3..31ab1da9f34 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -619,6 +619,7 @@ struct cplus_struct_type unsigned int is_final:1; unsigned int is_synchronized:1; unsigned int is_native:1; + unsigned int is_artificial:1; /* A stub method only has some fields valid (but they are enough to reconstruct the rest of the fields). */ @@ -628,7 +629,7 @@ struct cplus_struct_type unsigned int is_inlined:1; /* Unused. */ - unsigned int dummy:4; + unsigned int dummy:3; /* Index into that baseclass's virtual function table, minus 2; else if static: VOFFSET_STATIC; else: 0. */ @@ -867,6 +868,7 @@ extern void allocate_cplus_struct_type (struct type *); #define TYPE_FN_FIELD_FINAL(thisfn, n) ((thisfn)[n].is_final) #define TYPE_FN_FIELD_SYNCHRONIZED(thisfn, n) ((thisfn)[n].is_synchronized) #define TYPE_FN_FIELD_NATIVE(thisfn, n) ((thisfn)[n].is_native) +#define TYPE_FN_FIELD_ARTIFICIAL(thisfn, n) ((thisfn)[n].is_artificial) #define TYPE_FN_FIELD_ABSTRACT(thisfn, n) ((thisfn)[n].is_abstract) #define TYPE_FN_FIELD_STUB(thisfn, n) ((thisfn)[n].is_stub) #define TYPE_FN_FIELD_INLINED(thisfn, n) ((thisfn)[n].is_inlined) -- 2.30.2