From 45364c8a2a8b0bbdac88b937f30459281fc4f00d Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Wed, 3 Mar 1993 02:09:02 +0000 Subject: [PATCH] * c-exp.y (parse_number): Change high_bit to unsigned. * demangle.c: Change all references to cfront to ARM, since the actual algorithm is the one specified in the Annotated Reference Manual. This was confusing users into thinking that full cfront support was implemented. * dwarfread.c (CFRONT_PRODUCER): Remove, was never really used. * eval.c (evaluate_subexp): For STRUCTOP_PTR pass the arg type directly to lookup_struct_elt_type, which will do the dereferencing itself. * gdbtypes.c (lookup_struct_elt_type): Expand comments. Fix NULL dereferencing bug for unnamed structs, comment out questionable code. --- gdb/ChangeLog | 15 +++++++++++++++ gdb/NEWS | 6 ++++++ gdb/c-exp.y | 6 +++--- gdb/demangle.c | 8 ++++---- gdb/dwarfread.c | 10 ---------- gdb/gdbtypes.c | 16 +++++++++++++++- 6 files changed, 43 insertions(+), 18 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ebb3229..d00469d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +Tue Mar 2 17:57:56 1993 Fred Fish (fnf@cygnus.com) + + * c-exp.y (parse_number): Change high_bit to unsigned. + * demangle.c: Change all references to cfront to ARM, since the + actual algorithm is the one specified in the Annotated Reference + Manual. This was confusing users into thinking that full cfront + support was implemented. + * dwarfread.c (CFRONT_PRODUCER): Remove, was never really used. + * eval.c (evaluate_subexp): For STRUCTOP_PTR pass the arg type + directly to lookup_struct_elt_type, which will do the + dereferencing itself. + * gdbtypes.c (lookup_struct_elt_type): Expand comments. Fix + NULL dereferencing bug for unnamed structs, comment out + questionable code. + Mon Mar 1 17:54:41 1993 John Gilmore (gnu@cygnus.com) * coffread.c (process_coff_symbol): Change PCC argument correction diff --git a/gdb/NEWS b/gdb/NEWS index a6cde82..86d0ad2 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -6,6 +6,12 @@ (This is a prototype to remind us of things that should be announced in the next release...) +'Cfront' style demangling has had its name changed to 'ARM' style, to +emphasize that it was written from the specifications in the Annotated +Reference Manual, not to be compatible with AT&T cfront. Despite disclaimers, +it still generated too much confusion with users attempting to use gdb with +AT&T cfront. + H8/300 simulator H8/500 simulator (probably by the next release) Z8000 family simulator diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 981634a..f8c87c4 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -962,7 +962,7 @@ parse_number (p, len, parsed_float, putithere) register int base = input_radix; int unsigned_p = 0; int long_p = 0; - LONGEST high_bit; + unsigned LONGEST high_bit; struct type *signed_type; struct type *unsigned_type; @@ -1047,13 +1047,13 @@ parse_number (p, len, parsed_float, putithere) if ((TARGET_INT_BIT != TARGET_LONG_BIT && (n >> TARGET_INT_BIT)) || long_p) { - high_bit = ((LONGEST)1) << (TARGET_LONG_BIT-1); + high_bit = ((unsigned LONGEST)1) << (TARGET_LONG_BIT-1); unsigned_type = builtin_type_unsigned_long; signed_type = builtin_type_long; } else { - high_bit = ((LONGEST)1) << (TARGET_INT_BIT-1); + high_bit = ((unsigned LONGEST)1) << (TARGET_INT_BIT-1); unsigned_type = builtin_type_unsigned_int; signed_type = builtin_type_int; } diff --git a/gdb/demangle.c b/gdb/demangle.c index 45e130c..cdf7b40 100644 --- a/gdb/demangle.c +++ b/gdb/demangle.c @@ -31,7 +31,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Select the default C++ demangling style to use. The default is "auto", which allows gdb to attempt to pick an appropriate demangling style for the executable it has loaded. It can be set to a specific style ("gnu", - "lucid", "cfront", etc.) in which case gdb will never attempt to do auto + "lucid", "arm", etc.) in which case gdb will never attempt to do auto selection of the style unless you do an explicit "set demangle auto". To select one of these as the default, set DEFAULT_DEMANGLING_STYLE in the appropriate target configuration file. */ @@ -64,9 +64,9 @@ static const struct demangler {LUCID_DEMANGLING_STYLE_STRING, lucid_demangling, "Lucid (lcc) style demangling"}, - {CFRONT_DEMANGLING_STYLE_STRING, - cfront_demangling, - "ARM (cfront) style demangling"}, + {ARM_DEMANGLING_STYLE_STRING, + arm_demangling, + "ARM style demangling"}, {NULL, unknown_demangling, NULL} }; diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index c516800..b049fcd 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -197,10 +197,6 @@ typedef unsigned int DIE_REF; /* Reference to a DIE */ #define LCC_PRODUCER "NCR C/C++" #endif -#ifndef CFRONT_PRODUCER -#define CFRONT_PRODUCER "CFRONT " /* A wild a** guess... */ -#endif - /* start-sanitize-chill */ #ifndef CHILL_PRODUCER #define CHILL_PRODUCER "GNU Chill " @@ -1916,7 +1912,6 @@ handle_producer (producer) is not auto. We also leave the demangling style alone if we find a gcc (cc1) producer, as opposed to a g++ (cc1plus) producer. */ -#if 1 /* Works, but is experimental. -fnf */ if (AUTO_DEMANGLING) { if (STREQN (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER))) @@ -1927,12 +1922,7 @@ handle_producer (producer) { set_demangling_style (LUCID_DEMANGLING_STYLE_STRING); } - else if (STREQN (producer, CFRONT_PRODUCER, strlen (CFRONT_PRODUCER))) - { - set_demangling_style (CFRONT_DEMANGLING_STYLE_STRING); - } } -#endif } diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 4be115d..9bcdec0 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -691,6 +691,12 @@ lookup_template_type (name, type, block) } /* Given a type TYPE, lookup the type of the component of type named NAME. + + TYPE can be either a struct or union, or a pointer or reference to a struct or + union. If it is a pointer or reference, its target type is automatically used. + Thus '.' and '->' are interchangable, as specified for the definitions of the + expression element types STRUCTOP_STRUCT and STRUCTOP_PTR. + If NOERR is nonzero, return zero if NAME is not suitably defined. If NAME is the name of a baseclass type, return that type. */ @@ -701,6 +707,7 @@ lookup_struct_elt_type (type, name, noerr) int noerr; { int i; + char *typename; if (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_CODE (type) == TYPE_CODE_REF) @@ -718,8 +725,15 @@ lookup_struct_elt_type (type, name, noerr) check_stub_type (type); - if (STREQ (type_name_no_tag (type), name)) +#if 0 + /* FIXME: This change put in by Michael seems incorrect for the case where + the structure tag name is the same as the member name. I.E. when doing + "ptype bell->bar" for "struct foo { int bar; int foo; } bell;" + Disabled by fnf. */ + typename = type_name_no_tag (type); + if (typename != NULL && STREQ (typename, name)) return type; +#endif for (i = TYPE_NFIELDS (type) - 1; i >= TYPE_N_BASECLASSES (type); i--) { -- 2.7.4