From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10105 invoked by alias); 27 Jun 2002 22:37:50 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 10072 invoked from network); 27 Jun 2002 22:37:48 -0000 Received: from unknown (HELO mspmail1.retek.com) (64.238.80.50) by sources.redhat.com with SMTP; 27 Jun 2002 22:37:48 -0000 Received: by mspmail1.retek.int with Internet Mail Service (5.5.2653.19) id ; Thu, 27 Jun 2002 17:37:47 -0500 Message-ID: From: "Chu, Josh" To: "'gdb@sources.redhat.com'" Subject: 64bit gdb for KAI/KCC compiler Date: Thu, 27 Jun 2002 15:37:00 -0000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_NextPart_000_01C21E2B.04E3CC20" X-SW-Source: 2002-06/txt/msg00308.txt.bz2 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C21E2B.04E3CC20 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C21E2B.04E3CC20" ------_=_NextPart_001_01C21E2B.04E3CC20 Content-Type: text/plain; charset="iso-8859-1" Content-length: 1469 Ok, so here's the deal : KAI released a patch for gdb 5.0 that will allow gdb to read the EDG-style mangled names. I've attached the patch files that were to be applied to 5.0 (gdb.patch-5.0 and libiberty.patch-5.0). I tried manually applying these modifications to the 5.2 source, and it builds. However, there are some definite problems because gdb will now core dump occasionally, not to mention the names are still mangled. I've included the patch files to 5.0 and my modifications to the files in 5.2 : gdb/libiberty: cplus-dem.c gdb/gdb: dwarf2read.c hpread.c stabsread.c symfile.c to patch a 5.0 gdb base : ---- cd gdb/gdb patch < gdb.patch-5.0 ---- and --- cd- gdb/libiberty patch < libiberty.patch-5.0 ---- To patch a 5.2 gdb base with the same modifications : ---- cd gdb/gdb patch < gdb.patch-5.2 ---- and --- cd- gdb/libiberty patch < libiberty.patch-5.2 ---- After this is done, you can try to build and run. (export CC='gcc -m64' and ./configure first) I suppose this is a fairly vague question : but does anyone have a clue why the patches aren't working with 5.2? This would be a huge help for anyone who has a KAI compiler on a 64-bit system, as it would allow people to debug 64bit programs compiled with KCC. Or if someone who's familiar with the above-mentioned files could comment on the patched files and what could potentially be wrong with them, I would very much appreciate it. Thanks so much --JC ------_=_NextPart_001_01C21E2B.04E3CC20 Content-Type: text/html; charset="iso-8859-1" Content-length: 5649
Ok, so here's the deal : KAI released a patch for gdb 5.0 that will allow gdb to read the EDG-style mangled names.  I've attached the patch files that were to be applied to 5.0 (gdb.patch-5.0 and libiberty.patch-5.0).  I tried manually applying these modifications to the 5.2 source, and it builds.  However, there are some definite problems because gdb will now core dump occasionally, not to mention the names are still mangled.
I've included the patch files to 5.0 and my modifications to the files in 5.2 :
 
gdb/libiberty:
    cplus-dem.c
 
gdb/gdb:
    dwarf2read.c
    hpread.c
    stabsread.c
    symfile.c
 
 
to patch a 5.0 gdb base :
----
cd gdb/gdb
patch < gdb.patch-5.0
----
and
---
cd- gdb/libiberty
patch < libiberty.patch-5.0
----
 
To patch a 5.2 gdb base with the same modifications :
----
cd gdb/gdb
patch < gdb.patch-5.2
----
and
---
cd- gdb/libiberty
patch < libiberty.patch-5.2
----
 
 
After this is done, you can try to build and run.  (export CC='gcc -m64' and ./configure first)
 
I suppose this is a fairly vague question : but does anyone have a clue why the patches aren't working with 5.2?
This would be a huge help for anyone who has a KAI compiler on a 64-bit system, as it would allow people to debug 64bit programs compiled with KCC.  Or if someone who's familiar with the above-mentioned files could comment on the patched files and what could potentially be wrong with them, I would very much appreciate it.
Thanks so much
--JC
   
 
------_=_NextPart_001_01C21E2B.04E3CC20-- ------_=_NextPart_000_01C21E2B.04E3CC20 Content-Type: application/octet-stream; name="libiberty.patch-5.0" Content-Disposition: attachment; filename="libiberty.patch-5.0" Content-length: 2199 *** cplus-dem.c.orig Fri May 11 08:51:51 2001 --- cplus-dem.c Tue Apr 24 09:09:53 2001 *************** *** 2220,2229 **** --- 2220,2234 ---- if (gnu_special (work, mangled, declp)) return success; } } } + else if ( (EDG_DEMANGLING) && strncmp(*mangled, "__SO__", 6) == 0) + { + /* it's a ARM global destructor to be executed at program exit */ + (*mangled) += 6; + } else if ((ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING) && strncmp(*mangled, "__std__", 7) == 0) { /* it's a ARM global destructor to be executed at program exit */ (*mangled) += 7; work->destructor = 2; *************** *** 2276,2286 **** || (scan[2] == 't') || (scan[2] == 'K') || (scan[2] == 'H'))) { /* The ARM says nothing about the mangling of local variables. But cfront mangles local variables by prepending __ to them. As an extension to ARM demangling we handle this case. */ ! if ((LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING) && isdigit ((unsigned char)scan[2])) { *mangled = scan + 2; consume_count (mangled); string_append (declp, *mangled); --- 2281,2306 ---- || (scan[2] == 't') || (scan[2] == 'K') || (scan[2] == 'H'))) { /* The ARM says nothing about the mangling of local variables. But cfront mangles local variables by prepending __ to them. As an extension to ARM demangling we handle this case. */ ! /* MAB 6/1/00 -- hard-coded KCC local variable demangling */ ! if (EDG_DEMANGLING && isdigit((unsigned char)scan[2])) { ! const char *scout = *mangled; ! scout+=2; /* skip __ */ ! consume_count(&scout); ! if ( *scout=='_' ) { ! scout++; ! consume_count(&scout); ! if ( *scout=='_' && *(scout+1)!='\0' ) { ! *mangled=scout+1; ! string_append (declp, *mangled); ! *mangled += strlen (*mangled); ! success = 1; ! } ! } ! } else if ((LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING) && isdigit ((unsigned char)scan[2])) { *mangled = scan + 2; consume_count (mangled); string_append (declp, *mangled); ------_=_NextPart_000_01C21E2B.04E3CC20 Content-Type: application/octet-stream; name="libiberty.patch-5.2" Content-Disposition: attachment; filename="libiberty.patch-5.2" Content-length: 1778 *** cplus-dem.c Thu Jun 27 17:01:05 2002 --- cplus-dem.c.new Thu Jun 27 17:00:53 2002 *************** *** 2711,2716 **** --- 2711,2721 ---- } } } + else if ( (EDG_DEMANGLING) && strncmp(*mangled, "__SO__", 6) == 0) + { + /* it's a ARM global destructor to be executed at program exit */ + (*mangled) += 6; + } else if ((ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING) && strncmp(*mangled, "__std__", 7) == 0) { /* it's a ARM global destructor to be executed at program exit */ *************** *** 2767,2773 **** /* The ARM says nothing about the mangling of local variables. But cfront mangles local variables by prepending __ to them. As an extension to ARM demangling we handle this case. */ ! if ((LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING) && ISDIGIT ((unsigned char)scan[2])) { *mangled = scan + 2; --- 2772,2793 ---- /* The ARM says nothing about the mangling of local variables. But cfront mangles local variables by prepending __ to them. As an extension to ARM demangling we handle this case. */ ! /* MAB 6/1/00 -- hard-coded KCC local variable demangling */ ! if (EDG_DEMANGLING && isdigit((unsigned char)scan[2])) { ! const char *scout = *mangled; ! scout+=2; /* skip __ */ ! consume_count(&scout); ! if ( *scout=='_' ) { ! scout++; ! consume_count(&scout); ! if ( *scout=='_' && *(scout+1)!='\0' ) { ! *mangled=scout+1; ! string_append (declp, *mangled); ! *mangled += strlen (*mangled); ! success = 1; ! } ! } ! } else if ((LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING) && ISDIGIT ((unsigned char)scan[2])) { *mangled = scan + 2; ------_=_NextPart_000_01C21E2B.04E3CC20 Content-Type: application/octet-stream; name="gdb.patch-5.0" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="gdb.patch-5.0" Content-length: 20326 *** symfile.c.orig Mon Jun 18 09:55:22 2001=0A= --- symfile.c Fri May 11 08:58:39 2001=0A= ***************=0A= *** 2058,2070 ****=0A= int i;=0A= char *cp;=0A= =20=20=0A= if (filename !=3D NULL)=0A= if ((cp =3D strrchr (filename, '.')) !=3D NULL)=0A= ! for (i =3D 0; i < fl_table_next; i++)=0A= ! if (strcmp (cp, filename_language_table[i].ext) =3D=3D 0)=0A= ! return filename_language_table[i].lang;=0A= =20=20=0A= return language_unknown;=0A= }=0A= =0C=0A= /* allocate_symtab:=0A= --- 2058,2074 ----=0A= int i;=0A= char *cp;=0A= =20=20=0A= if (filename !=3D NULL)=0A= if ((cp =3D strrchr (filename, '.')) !=3D NULL)=0A= ! {=0A= ! if (strlen(filename)>6 && strcmp(cp-4,".int.c")=3D=3D0)=0A= ! return language_cplus;=0A= ! for (i =3D 0; i < fl_table_next; i++)=0A= ! if (strcmp (cp, filename_language_table[i].ext) =3D=3D 0)=0A= ! return filename_language_table[i].lang;=0A= ! }=0A= =20=20=0A= return language_unknown;=0A= }=0A= =0C=0A= /* allocate_symtab:=0A= *** stabsread.c.orig Mon Jun 18 09:55:39 2001=0A= --- stabsread.c Fri Jun 8 14:45:23 2001=0A= ***************=0A= *** 1305,1314 ****=0A= --- 1305,1329 ----=0A= or this is a forward reference to it. */=0A= *string =3D p;=0A= return -1;=0A= }=0A= }=0A= +=20=20=20=0A= + /* recogize an EDG compiler-generated temporary, like __T136266940 */=0A= + int=0A= + is_edg_temporary_var( sym )=0A= + struct symbol *sym;=0A= + {=0A= + char * pname =3D sym->ginfo.name;=0A= + if ( pname[0]=3D=3D'_' && pname[1]=3D=3D'_' && pname[2]=3D=3D'T' ) {=0A= + pname+=3D3;=0A= + while ( isdigit(*pname) ) pname++;=0A= + if ( *pname=3D=3D'\0' )=0A= + return 1;=0A= + }=0A= + return 0;=0A= + }=0A= =20=20=0A= /* ARGSUSED */=0A= struct symbol *=0A= define_symbol (valu, string, desc, type, objfile)=0A= CORE_ADDR valu;=0A= ***************=0A= *** 1723,1733 ****=0A= case 'l':=0A= SYMBOL_TYPE (sym) =3D read_type (&p, objfile);=0A= SYMBOL_CLASS (sym) =3D LOC_LOCAL;=0A= SYMBOL_VALUE (sym) =3D valu;=0A= SYMBOL_NAMESPACE (sym) =3D VAR_NAMESPACE;=0A= ! add_symbol_to_list (sym, &local_symbols);=0A= break;=0A= =20=20=0A= case 'p':=0A= if (*p =3D=3D 'F')=0A= /* pF is a two-letter code that means a function parameter in Fortran.= =0A= --- 1738,1749 ----=0A= case 'l':=0A= SYMBOL_TYPE (sym) =3D read_type (&p, objfile);=0A= SYMBOL_CLASS (sym) =3D LOC_LOCAL;=0A= SYMBOL_VALUE (sym) =3D valu;=0A= SYMBOL_NAMESPACE (sym) =3D VAR_NAMESPACE;=0A= ! if ( !EDG_DEMANGLING || !is_edg_temporary_var(sym) )=0A= ! add_symbol_to_list (sym, &local_symbols);=0A= break;=0A= =20=20=0A= case 'p':=0A= if (*p =3D=3D 'F')=0A= /* pF is a two-letter code that means a function parameter in Fortran.= =0A= ***************=0A= *** 2050,2062 ****=0A= obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));=0A= *typedef_sym =3D *sym;=0A= SYMBOL_CLASS (typedef_sym) =3D LOC_TYPEDEF;=0A= SYMBOL_VALUE (typedef_sym) =3D valu;=0A= SYMBOL_NAMESPACE (typedef_sym) =3D VAR_NAMESPACE;=0A= ! if (TYPE_NAME (SYMBOL_TYPE (sym)) =3D=3D 0)=0A= ! TYPE_NAME (SYMBOL_TYPE (sym))=0A= ! =3D obconcat (&objfile->type_obstack, "", "", SYMBOL_NAME (sym));= =0A= add_symbol_to_list (typedef_sym, &file_symbols);=0A= }=0A= break;=0A= =20=20=0A= case 'V':=0A= --- 2066,2087 ----=0A= obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));=0A= *typedef_sym =3D *sym;=0A= SYMBOL_CLASS (typedef_sym) =3D LOC_TYPEDEF;=0A= SYMBOL_VALUE (typedef_sym) =3D valu;=0A= SYMBOL_NAMESPACE (typedef_sym) =3D VAR_NAMESPACE;=0A= ! /* SYMBOL_TYPE (sym) and SYMBOL_TYPE (typedef_sym) are identical at th= is point */=0A= ! if (TYPE_NAME (SYMBOL_TYPE (sym)) =3D=3D 0) {=0A= ! if ( SYMBOL_LANGUAGE (sym)=3D=3Dlanguage_cplus && SYMBOL_CPLUS_DEMAN= GLED_NAME (sym) ) {=0A= ! /* name of type should be demangled C++ name, if there is one */= =0A= ! TYPE_NAME (SYMBOL_TYPE (typedef_sym))=0A= ! =3D obconcat (&objfile->type_obstack, "", "", SYMBOL_CPLUS_DEMANGLED_N= AME (sym));=0A= ! TYPE_TAG_NAME (SYMBOL_TYPE (typedef_sym))=0A= ! =3D obconcat (&objfile->type_obstack, "", "", SYMBOL_CPLUS_DEMANGLED_N= AME (sym));=0A= ! } else=0A= ! TYPE_NAME (SYMBOL_TYPE (sym))=0A= ! =3D obconcat (&objfile->type_obstack, "", "", SYMBOL_NAME (sym));=0A= ! }=0A= add_symbol_to_list (typedef_sym, &file_symbols);=0A= }=0A= break;=0A= =20=20=0A= case 'V':=0A= ***************=0A= *** 2078,2088 ****=0A= #endif=0A= SYMBOL_NAMESPACE (sym) =3D VAR_NAMESPACE;=0A= if (os9k_stabs)=0A= add_symbol_to_list (sym, &global_symbols);=0A= else=0A= ! add_symbol_to_list (sym, &local_symbols);=0A= break;=0A= =20=20=0A= case 'v':=0A= /* Reference parameter */=0A= SYMBOL_TYPE (sym) =3D read_type (&p, objfile);=0A= --- 2103,2114 ----=0A= #endif=0A= SYMBOL_NAMESPACE (sym) =3D VAR_NAMESPACE;=0A= if (os9k_stabs)=0A= add_symbol_to_list (sym, &global_symbols);=0A= else=0A= ! if ( !EDG_DEMANGLING && !is_edg_temporary_var(sym) )=0A= ! add_symbol_to_list (sym, &local_symbols);=0A= break;=0A= =20=20=0A= case 'v':=0A= /* Reference parameter */=0A= SYMBOL_TYPE (sym) =3D read_type (&p, objfile);=0A= ***************=0A= *** 3514,3523 ****=0A= --- 3540,3589 ----=0A= FIELD_BITSIZE (fip->list->field) =3D 0;=0A= }=0A= }=0A= }=0A= =20=20=0A= + /* fix the baseclasses for stabs created by edg front ends */=0A= + static void=20=0A= + edg_baseclass_fixup( type )=0A= + struct type *type;=0A= + {=0A= + int i;=0A= + int edg_n_baseclasses =3D 0;=0A= + if ( type=3D=3DNULL || TYPE_CPLUS_SPECIFIC(type)=3D=3DNULL ) {=0A= + /* no c++ info, better not touch it. */=0A= + return;=0A= + }=0A= + if ( TYPE_N_BASECLASSES(type) > 0 ) {=0A= + /* already have base classes for some reason, better not touch it */= =0A= + return;=0A= + }=0A= + for ( i=3D0; infields; i++ ) {=0A= + if ( strncmp( type->fields[i].name, "__b_", 4 )!=3D0 ) {=0A= + /* we're done. */=0A= + break;=0A= + }=0A= + edg_n_baseclasses++;=0A= + }=0A= + if ( edg_n_baseclasses=3D=3D0 ) {=0A= + return;=0A= + }=0A= + ALLOCATE_CPLUS_STRUCT_TYPE (type);=0A= + TYPE_N_BASECLASSES(type) =3D edg_n_baseclasses;=0A= +=20=0A= + /* allocate space for virtual flag bits */=0A= + {=0A= + int num_bytes =3D B_BYTES (TYPE_N_BASECLASSES (type));=0A= + char *pointer;=0A= +=20=0A= + pointer =3D (char *) TYPE_ALLOC (type, num_bytes);=0A= + TYPE_FIELD_VIRTUAL_BITS (type) =3D (B_TYPE *) pointer;=0A= + }=0A= + B_CLRALL (TYPE_FIELD_VIRTUAL_BITS (type), TYPE_N_BASECLASSES (type));= =0A= +=20=0A= + }=0A= +=20=0A= =20=20=0A= /* Read struct or class data fields. They have the form:=0A= =20=20=0A= NAME : [VISIBILITY] TYPENUM , BITPOS , BITSIZE ;=0A= =20=20=0A= ***************=0A= *** 4149,4158 ****=0A= --- 4215,4226 ----=0A= || !attach_fn_fields_to_type (&fi, type)=0A= || !read_tilde_fields (&fi, pp, type, objfile))=0A= {=0A= type =3D error_type (pp, objfile);=0A= }=0A= +=20=0A= + edg_baseclass_fixup(type);=0A= =20=20=0A= do_cleanups (back_to);=0A= return (type);=0A= }=0A= =20=20=0A= *** hp-symtab-read.c.orig Mon Jun 18 09:56:01 2001=0A= --- hp-symtab-read.c Fri May 18 08:38:53 2001=0A= ***************=0A= *** 1204,1213 ****=0A= --- 1204,1250 ----=0A= param_symbols =3D local_list;=0A= =20=20=0A= return type;=0A= }=0A= =20=20=0A= + /* KAI EDG-style compiler ends up with lowered base classes, fix those=0A= + up here. */=0A= + static void=0A= + edg_baseclass_fixup( ptype )=0A= + struct type * ptype;=0A= + {=0A= + int i;=0A= + int edg_n_baseclasses =3D 0;=0A= + if ( TYPE_N_BASECLASSES(ptype) > 0 ) {=0A= + /* already have base classes for some reason, better not touch it */= =0A= + return;=0A= + }=0A= + for ( i=3D0; infields; i++ ) {=0A= + if ( strncmp( ptype->fields[i].name, "__b_", 4 )!=3D0 ) {=0A= + /* we're done. */=0A= + break;=0A= + }=0A= + edg_n_baseclasses++;=0A= + }=0A= + if ( edg_n_baseclasses=3D=3D0 ) {=0A= + return;=0A= + }=0A= + ALLOCATE_CPLUS_STRUCT_TYPE (ptype);=0A= + TYPE_N_BASECLASSES(ptype) =3D edg_n_baseclasses;=0A= +=20=0A= + /* allocate space for virtual flag bits */=0A= + {=0A= + int num_bytes =3D B_BYTES (TYPE_N_BASECLASSES (ptype));=0A= + char *pointer;=0A= +=20=0A= + pointer =3D (char *) TYPE_ALLOC (ptype, num_bytes);=0A= + TYPE_FIELD_VIRTUAL_BITS (ptype) =3D (B_TYPE *) pointer;=0A= + }=0A= + B_CLRALL (TYPE_FIELD_VIRTUAL_BITS (ptype), TYPE_N_BASECLASSES (ptype));= =0A= + if (TYPE_DECLARED_TYPE (ptype)=3D=3DDECLARED_TYPE_STRUCT)=0A= + TYPE_DECLARED_TYPE (ptype)=3D=3DDECLARED_TYPE_CLASS;=0A= + }=0A= =20=20=0A= =20=20=0A= /* A file-level variable which keeps track of the current-template=0A= * being processed. Set in hpread_read_struct_type() while processing=0A= * a template type. Referred to in hpread_get_nth_templ_arg().=0A= ***************=0A= *** 1961,1970 ****=0A= --- 1998,2011 ----=0A= {=0A= n -=3D 1;=0A= TYPE_FIELD (type, n) =3D tmp_list->field;=0A= }=0A= =20=20=0A= + /* if C++ class comes through lowered C code, need to fix it up here */= =0A= + if (EDG_DEMANGLING)=0A= + edg_baseclass_fixup( type );=0A= +=20=0A= /* Copy the "function-field-list" (i.e., the list of member=0A= * functions in the class) to GDB's symbol table=20=0A= */=0A= TYPE_NFN_FIELDS (type) =3D n_fn_fields;=0A= TYPE_NFN_FIELDS_TOTAL (type) =3D n_fn_fields_total;=0A= ***************=0A= *** 2520,2535 ****=0A= {=0A= prefix =3D "";=0A= }=0A= =20=20=0A= /* Build the correct name. */=0A= ! structtype->name=0A= ! =3D (char *) obstack_alloc (&objfile->type_obstack,=0A= ! strlen (prefix) + strlen (suffix) + 1);=0A= ! TYPE_NAME (structtype) =3D strcpy (TYPE_NAME (structtype), prefix);=0A= ! TYPE_NAME (structtype) =3D strcat (TYPE_NAME (structtype), suffix);=0A= ! TYPE_TAG_NAME (structtype) =3D suffix;=0A= =20=20=0A= /* For classes/structs, we have to set the static member "physnames"=0A= to point to strings like "Class::Member" */=0A= if (TYPE_CODE (structtype) =3D=3D TYPE_CODE_STRUCT)=0A= fix_static_member_physnames (structtype, suffix, objfile);=0A= --- 2561,2592 ----=0A= {=0A= prefix =3D "";=0A= }=0A= =20=20=0A= /* Build the correct name. */=0A= ! structtype->name =3D NULL;=0A= ! if ( EDG_DEMANGLING ) {=0A= ! char *demangled =3D NULL;=09=0A= ! demangled =3D cplus_demangle (suffix, DMGL_PARAMS | DMGL_ANSI);=0A= ! if (demangled !=3D NULL)=0A= ! {=0A= ! structtype->name=0A= ! =3D (char *) obstack_alloc (&objfile->type_obstack,=0A= ! strlen (demangled) + 1 );=0A= ! TYPE_NAME (structtype) =3D strcpy (TYPE_NAME (structtype), demangled= );=0A= ! TYPE_TAG_NAME (structtype) =3D TYPE_NAME (structtype);=0A= ! free (demangled);=0A= ! }=0A= ! }=0A= ! if ( structtype->name=3D=3DNULL ) {=0A= ! structtype->name=0A= ! =3D (char *) obstack_alloc (&objfile->type_obstack,=0A= ! strlen (prefix) + strlen (suffix) + 1);=0A= ! TYPE_NAME (structtype) =3D strcpy (TYPE_NAME (structtype), prefix);=0A= ! TYPE_NAME (structtype) =3D strcat (TYPE_NAME (structtype), suffix);=0A= ! TYPE_TAG_NAME (structtype) =3D suffix;=0A= ! }=0A= =20=20=0A= /* For classes/structs, we have to set the static member "physnames"=0A= to point to strings like "Class::Member" */=0A= if (TYPE_CODE (structtype) =3D=3D TYPE_CODE_STRUCT)=0A= fix_static_member_physnames (structtype, suffix, objfile);=0A= ***************=0A= *** 2789,2798 ****=0A= --- 2846,2883 ----=0A= class_name +=3D 6;=0A= =20=20=0A= return class_name;=0A= }=0A= =20=20=0A= + /* KAI EDG-style compiler mangles local vars differently. Need to make= =0A= + sure C++ demangler is called if the right name patterns appear. */=0A= + static void=0A= + edg_local_var_demangling( struct pending * local_symbols, struct obstack = * ostack )=0A= + {=0A= + struct pending *next;=0A= + struct symbol *sym;=0A= + int j;=0A= + char *pn;=0A= + for (next =3D local_symbols; next; next =3D next->next)=0A= + {=0A= + for (j =3D next->nsyms - 1; j >=3D 0; j--)=0A= + {=0A= + sym =3D next->symbol[j];=0A= + pn =3D SYMBOL_NAME (sym);=0A= + if ( pn && pn[0]=3D=3D'_' && pn[1]=3D=3D'_' && pn[2]>=3D'0' && pn[2]<= =3D'9'=0A= + && SYMBOL_CPLUS_DEMANGLED_NAME(sym)=3D=3DNULL )=0A= + {=0A= + if (SYMBOL_LANGUAGE (sym) =3D=3D language_c ||=0A= + SYMBOL_LANGUAGE (sym) =3D=3D language_unknown) {=0A= + SYMBOL_LANGUAGE (sym) =3D language_auto;=0A= + }=0A= + SYMBOL_INIT_DEMANGLED_NAME(sym,ostack);=0A= + }=0A= + }=0A= + }=0A= + }=0A= +=20=0A= /* Internalize one native debug symbol.=20=0A= * Called in a loop from hpread_expand_symtab().=20=0A= * Arguments:=0A= * dn_bufp:=20=0A= * name:=20=0A= ***************=0A= *** 3009,3018 ****=0A= --- 3094,3107 ----=0A= *(char *) (VT (objfile) + dn_bufp->dfunc.alias)) /* not a null string = */=0A= SYMBOL_NAME (sym) =3D VT (objfile) + dn_bufp->dfunc.alias;=0A= else=0A= SYMBOL_NAME (sym) =3D VT (objfile) + dn_bufp->dfunc.name;=0A= =20=20=0A= + /* See if this is really a mangled C++ name */=0A= + if ( (EDG_DEMANGLING) && (dn_bufp->dfunc.language =3D=3D HP_LANGUAG= E_C) )=0A= + SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);=0A= +=20=0A= /* Special hack to get around HP compilers' insistence on=0A= * reporting "main" as "_MAIN_" for C/C++ */=0A= if ((strcmp (SYMBOL_NAME (sym), "_MAIN_") =3D=3D 0) &&=0A= (strcmp (VT (objfile) + dn_bufp->dfunc.name, "main") =3D=3D 0))=0A= SYMBOL_NAME (sym) =3D VT (objfile) + dn_bufp->dfunc.name;=0A= ***************=0A= *** 3308,3317 ****=0A= --- 3397,3408 ----=0A= objfile);=0A= valu =3D dn_temp->dfunc.hiaddr + offset;=0A= /* Insert func params into local list */=0A= merge_symbol_lists (¶m_symbols, &local_symbols);=0A= new =3D pop_context ();=0A= + if (EDG_DEMANGLING)=0A= + edg_local_var_demangling( local_symbols, &objfile->symbol_obstack );= =0A= /* Make a block for the local symbols within. */=0A= finish_block (new->name, &local_symbols, new->old_blocks,=0A= new->start_addr, valu, objfile);=0A= WITHIN_FUNCTION (objfile) =3D 0; /* This may have to change for Pascal= */=0A= local_symbols =3D new->locals;=0A= ***************=0A= *** 3336,3345 ****=0A= --- 3427,3438 ----=0A= valu +=3D offset + 9; /* Relocate for dynamic loading */=0A= new =3D pop_context ();=0A= desc =3D dn_bufp->dend.beginscope.dnttp.index;=0A= if (desc !=3D new->depth)=0A= complain (&lbrac_mismatch_complaint, (char *) symnum);=0A= + if (EDG_DEMANGLING)=0A= + edg_local_var_demangling( local_symbols, &objfile->symbol_obstack );=0A= =20=20=0A= /* Make a block for the local symbols within. */=0A= finish_block (new->name, &local_symbols, new->old_blocks,=0A= new->start_addr, valu, objfile);=0A= local_symbols =3D new->locals;=0A= *** dwarf2read.c.orig Mon Jun 18 09:56:22 2001=0A= --- dwarf2read.c Fri May 11 08:58:42 2001=0A= ***************=0A= *** 1550,1559 ****=0A= --- 1550,1587 ----=0A= child_die =3D sibling_die (child_die);=0A= }=0A= }=0A= }=0A= =20=20=0A= + /* KAI EDG-style compiler can have different local variable name=0A= + mangling for C++. Run through the demaingler to see if this is the ca= se */=0A= + static void /*mab*/=0A= + edg_local_var_demangling( struct pending * local_symbols, struct obstack = * ostack )=0A= + {=0A= + struct pending *next;=0A= + struct symbol *sym;=0A= + int j;=0A= + char *pn;=0A= + for (next =3D local_symbols; next; next =3D next->next)=0A= + {=0A= + for (j =3D next->nsyms - 1; j >=3D 0; j--)=0A= + {=0A= + sym =3D next->symbol[j];=0A= + pn =3D SYMBOL_NAME (sym);=0A= + if ( pn && pn[0]=3D=3D'_' && pn[1]=3D=3D'_' && pn[2]>=3D'0' && pn[2]<= =3D'9'=0A= + && SYMBOL_CPLUS_DEMANGLED_NAME(sym)=3D=3DNULL )=0A= + {=0A= + if (SYMBOL_LANGUAGE (sym) =3D=3D language_c ||=0A= + SYMBOL_LANGUAGE (sym) =3D=3D language_unknown) {=0A= + SYMBOL_LANGUAGE (sym) =3D language_auto;=0A= + }=0A= + SYMBOL_INIT_DEMANGLED_NAME(sym,ostack);=0A= + }=0A= + }=0A= + }=0A= + }=0A= +=20=0A= static void=0A= read_func_scope (die, objfile)=0A= struct die_info *die;=0A= struct objfile *objfile;=0A= {=0A= ***************=0A= *** 1615,1624 ****=0A= --- 1643,1654 ----=0A= child_die =3D sibling_die (child_die);=0A= }=0A= }=0A= =20=20=0A= new =3D pop_context ();=0A= + if (EDG_DEMANGLING)=0A= + edg_local_var_demangling( local_symbols, &objfile->symbol_obstack );= =0A= /* Make a block for the local symbols within. */=0A= finish_block (new->name, &local_symbols, new->old_blocks,=0A= lowpc, highpc, objfile);=0A= list_in_scope =3D &file_symbols;=0A= }=0A= ***************=0A= *** 1653,1662 ****=0A= --- 1683,1694 ----=0A= }=0A= new =3D pop_context ();=0A= =20=20=0A= if (local_symbols !=3D NULL)=0A= {=0A= + if (EDG_DEMANGLING)=0A= + edg_local_var_demangling( local_symbols, &objfile->symbol_obstack );=0A= finish_block (0, &local_symbols, new->old_blocks, new->start_addr,= =0A= highpc, objfile);=0A= }=0A= local_symbols =3D new->locals;=0A= }=0A= ***************=0A= *** 2117,2126 ****=0A= --- 2149,2193 ----=0A= =20=20=0A= TYPE_NFN_FIELDS (type) =3D fip->nfnfields;=0A= TYPE_NFN_FIELDS_TOTAL (type) =3D total_length;=0A= }=0A= =20=20=0A= + /* reconstruct baseclass information out of DIE field info */=0A= + /* EDG baseclasses are encoded as the first fields of the=0A= + struct, and they all have a __b_ prefix name */=0A= + static void=0A= + dwarf2_edg_baseclass_fixup( struct field_info * pfi )=20=0A= + {=0A= + int i;=0A= + int edg_n_baseclasses =3D 0;=0A= + int field_ct;=0A= + struct nextfield *pfield;=0A= + if ( pfi->nbaseclasses > 0 ) {=0A= + /* already have base classes for some reason, better not touch it */= =0A= + return;=0A= + }=0A= + pfield =3D pfi->fields;=0A= + field_ct =3D 0;=0A= + /* fields in this list are in reverse order */=0A= + /* first skip non-baseclass members */=0A= + while ( field_ct < pfi->nfields ) {=0A= + if ( strncmp( pfield->field.name, "__b_", 4 )=3D=3D0 ) break;=0A= + field_ct++;=0A= + pfield =3D pfield->next;=0A= + }=0A= + /* count baseclass members, if any */=0A= + while ( field_ct < pfi->nfields && strncmp( pfield->field.name, "__b_",= 4 )=3D=3D0 ) {=0A= + edg_n_baseclasses++;=0A= + field_ct++;=0A= + pfield =3D pfield->next;=0A= + }=0A= + if ( field_ct =3D=3D pfi->nfields=0A= + && edg_n_baseclasses > 0 ) {=0A= + pfi->nbaseclasses =3D edg_n_baseclasses;=0A= + }=0A= + }=0A= +=20=0A= /* Called when we find the DIE that starts a structure or union scope=0A= (definition) to process all dies that define the members of the=0A= structure or union.=0A= =20=20=0A= NOTE: we need to call struct_type regardless of whether or not the=0A= ***************=0A= *** 2220,2229 ****=0A= --- 2287,2301 ----=0A= {=0A= process_die (child_die, objfile);=0A= }=0A= child_die =3D sibling_die (child_die);=0A= }=0A= +=20=0A= + /* If the file was compiled by KAI C++ or some other=0A= + EDG front ends, the struct fields may need to be un-lowered. */= =0A= + if ( EDG_DEMANGLING )=20=0A= + dwarf2_edg_baseclass_fixup( &fi );=0A= =20=20=0A= /* Attach fields and member functions to the type. */=0A= if (fi.nfields)=0A= dwarf2_attach_fields_to_type (&fi, type, objfile);=0A= if (fi.nfnfields)=0A= ------_=_NextPart_000_01C21E2B.04E3CC20 Content-Type: application/octet-stream; name="gdb.patch-5.2" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="gdb.patch-5.2" Content-length: 17432 *** dwarf2read.c Thu Jun 27 15:41:58 2002=0A= --- dwarf2read.c.new Thu Jun 27 10:52:12 2002=0A= ***************=0A= *** 1653,1658 ****=0A= --- 1653,1686 ----=0A= }=0A= }=0A= =20=20=0A= + /* KAI EDG-style compiler can have different local variable name=0A= + mangling for C++. Run through the demaingler to see if this is the ca= se */=0A= + static void /*mab*/=0A= + edg_local_var_demangling( struct pending * local_symbols, struct obstack = * ostack )=0A= + {=0A= + struct pending *next;=0A= + struct symbol *sym;=0A= + int j;=0A= + char *pn;=0A= + for (next =3D local_symbols; next; next =3D next->next)=0A= + {=0A= + for (j =3D next->nsyms - 1; j >=3D 0; j--)=0A= + {=0A= + sym =3D next->symbol[j];=0A= + pn =3D SYMBOL_NAME (sym);=0A= + if ( pn && pn[0]=3D=3D'_' && pn[1]=3D=3D'_' && pn[2]>=3D'0' && pn[2]<= =3D'9'=0A= + && SYMBOL_CPLUS_DEMANGLED_NAME(sym)=3D=3DNULL )=0A= + {=0A= + if (SYMBOL_LANGUAGE (sym) =3D=3D language_c ||=0A= + SYMBOL_LANGUAGE (sym) =3D=3D language_unknown) {=0A= + SYMBOL_LANGUAGE (sym) =3D language_auto;=0A= + }=0A= + SYMBOL_INIT_DEMANGLED_NAME(sym,ostack);=0A= + }=0A= + }=0A= + }=0A= + }=0A= +=20=0A= static void=0A= read_func_scope (struct die_info *die, struct objfile *objfile,=0A= const struct comp_unit_head *cu_header)=0A= ***************=0A= *** 1717,1722 ****=0A= --- 1745,1752 ----=0A= }=0A= =20=20=0A= new =3D pop_context ();=0A= + if (EDG_DEMANGLING)=0A= + edg_local_var_demangling( local_symbols, &objfile->symbol_obstack );= =0A= /* Make a block for the local symbols within. */=0A= finish_block (new->name, &local_symbols, new->old_blocks,=0A= lowpc, highpc, objfile);=0A= ***************=0A= *** 1754,1759 ****=0A= --- 1784,1791 ----=0A= =20=20=0A= if (local_symbols !=3D NULL)=0A= {=0A= + if (EDG_DEMANGLING)=0A= + edg_local_var_demangling( local_symbols, &objfile->symbol_obstack );=0A= finish_block (0, &local_symbols, new->old_blocks, new->start_addr,= =0A= highpc, objfile);=0A= }=0A= ***************=0A= *** 2213,2218 ****=0A= --- 2245,2285 ----=0A= TYPE_NFN_FIELDS_TOTAL (type) =3D total_length;=0A= }=0A= =20=20=0A= + /* reconstruct baseclass information out of DIE field info */=0A= + /* EDG baseclasses are encoded as the first fields of the=0A= + struct, and they all have a __b_ prefix name */=0A= + static void=0A= + dwarf2_edg_baseclass_fixup( struct field_info * pfi )=20=0A= + {=0A= + int i;=0A= + int edg_n_baseclasses =3D 0;=0A= + int field_ct;=0A= + struct nextfield *pfield;=0A= + if ( pfi->nbaseclasses > 0 ) {=0A= + /* already have base classes for some reason, better not touch it */= =0A= + return;=0A= + }=0A= + pfield =3D pfi->fields;=0A= + field_ct =3D 0;=0A= + /* fields in this list are in reverse order */=0A= + /* first skip non-baseclass members */=0A= + while ( field_ct < pfi->nfields ) {=0A= + if ( strncmp( pfield->field.name, "__b_", 4 )=3D=3D0 ) break;=0A= + field_ct++;=0A= + pfield =3D pfield->next;=0A= + }=0A= + /* count baseclass members, if any */=0A= + while ( field_ct < pfi->nfields && strncmp( pfield->field.name, "__b_",= 4 )=3D=3D0 ) {=0A= + edg_n_baseclasses++;=0A= + field_ct++;=0A= + pfield =3D pfield->next;=0A= + }=0A= + if ( field_ct =3D=3D pfi->nfields=0A= + && edg_n_baseclasses > 0 ) {=0A= + pfi->nbaseclasses =3D edg_n_baseclasses;=0A= + }=0A= + }=0A= +=20=0A= /* Called when we find the DIE that starts a structure or union scope=0A= (definition) to process all dies that define the members of the=0A= structure or union.=0A= ***************=0A= *** 2316,2321 ****=0A= --- 2383,2393 ----=0A= child_die =3D sibling_die (child_die);=0A= }=0A= =20=20=0A= + /* If the file was compiled by KAI C++ or some other=0A= + EDG front ends, the struct fields may need to be un-lowered. */= =0A= + if ( EDG_DEMANGLING )=20=0A= + dwarf2_edg_baseclass_fixup( &fi );=0A= +=20=0A= /* Attach fields and member functions to the type. */=0A= if (fi.nfields)=0A= dwarf2_attach_fields_to_type (&fi, type, objfile);=0A= *** hpread.c Thu Jun 27 17:04:37 2002=0A= --- hpread.c.new Thu Jun 27 17:04:49 2002=0A= ***************=0A= *** 3543,3550 ****=0A= --- 3543,3587 ----=0A= return type;=0A= }=0A= =20=20=0A= + /* KAI EDG-style compiler ends up with lowered base classes, fix those=0A= + up here. */=0A= + static void=0A= + edg_baseclass_fixup( ptype )=0A= + struct type * ptype;=0A= + {=0A= + int i;=0A= + int edg_n_baseclasses =3D 0;=0A= + if ( TYPE_N_BASECLASSES(ptype) > 0 ) {=0A= + /* already have base classes for some reason, better not touch it */= =0A= + return;=0A= + }=0A= + for ( i=3D0; infields; i++ ) {=0A= + if ( strncmp( ptype->fields[i].name, "__b_", 4 )!=3D0 ) {=0A= + /* we're done. */=0A= + break;=0A= + }=0A= + edg_n_baseclasses++;=0A= + }=0A= + if ( edg_n_baseclasses=3D=3D0 ) {=0A= + return;=0A= + }=0A= + ALLOCATE_CPLUS_STRUCT_TYPE (ptype);=0A= + TYPE_N_BASECLASSES(ptype) =3D edg_n_baseclasses;=0A= =20=20=0A= + /* allocate space for virtual flag bits */=0A= + {=0A= + int num_bytes =3D B_BYTES (TYPE_N_BASECLASSES (ptype));=0A= + char *pointer;=0A= =20=20=0A= + pointer =3D (char *) TYPE_ALLOC (ptype, num_bytes);=0A= + TYPE_FIELD_VIRTUAL_BITS (ptype) =3D (B_TYPE *) pointer;=0A= + }=0A= + B_CLRALL (TYPE_FIELD_VIRTUAL_BITS (ptype), TYPE_N_BASECLASSES (ptype));= =0A= + if (TYPE_DECLARED_TYPE (ptype)=3D=3DDECLARED_TYPE_STRUCT)=0A= + TYPE_DECLARED_TYPE (ptype)=3D=3DDECLARED_TYPE_CLASS;=0A= + }=0A= +=20=0A= +=20=0A= /* A file-level variable which keeps track of the current-template=0A= * being processed. Set in hpread_read_struct_type() while processing=0A= * a template type. Referred to in hpread_get_nth_templ_arg().=0A= ***************=0A= *** 4299,4304 ****=0A= --- 4336,4345 ----=0A= TYPE_FIELD (type, n) =3D tmp_list->field;=0A= }=0A= =20=20=0A= + /* if C++ class comes through lowered C code, need to fix it up here */= =0A= + if (EDG_DEMANGLING)=0A= + edg_baseclass_fixup( type );=0A= +=20=0A= /* Copy the "function-field-list" (i.e., the list of member=0A= * functions in the class) to GDB's symbol table=20=0A= */=0A= ***************=0A= *** 4847,4858 ****=0A= }=0A= =20=20=0A= /* Build the correct name. */=0A= ! structtype->name=0A= ! =3D (char *) obstack_alloc (&objfile->type_obstack,=0A= ! strlen (prefix) + strlen (suffix) + 1);=0A= ! TYPE_NAME (structtype) =3D strcpy (TYPE_NAME (structtype), prefix);=0A= ! TYPE_NAME (structtype) =3D strcat (TYPE_NAME (structtype), suffix);=0A= ! TYPE_TAG_NAME (structtype) =3D suffix;=0A= =20=20=0A= /* For classes/structs, we have to set the static member "physnames"=0A= to point to strings like "Class::Member" */=0A= --- 4888,4915 ----=0A= }=0A= =20=20=0A= /* Build the correct name. */=0A= ! structtype->name =3D NULL;=0A= ! if ( EDG_DEMANGLING ) {=0A= ! char *demangled =3D NULL;=09=0A= ! demangled =3D cplus_demangle (suffix, DMGL_PARAMS | DMGL_ANSI);=0A= ! if (demangled !=3D NULL)=0A= ! {=0A= ! structtype->name=0A= ! =3D (char *) obstack_alloc (&objfile->type_obstack,=0A= ! strlen (demangled) + 1 );=0A= ! TYPE_NAME (structtype) =3D strcpy (TYPE_NAME (structtype), demangled= );=0A= ! TYPE_TAG_NAME (structtype) =3D TYPE_NAME (structtype);=0A= ! free (demangled);=0A= ! }=0A= ! }=0A= ! if ( structtype->name=3D=3DNULL ) {=0A= ! structtype->name=0A= ! =3D (char *) obstack_alloc (&objfile->type_obstack,=0A= ! strlen (prefix) + strlen (suffix) + 1);=0A= ! TYPE_NAME (structtype) =3D strcpy (TYPE_NAME (structtype), prefix);=0A= ! TYPE_NAME (structtype) =3D strcat (TYPE_NAME (structtype), suffix);=0A= ! TYPE_TAG_NAME (structtype) =3D suffix;=0A= ! }=0A= =20=20=0A= /* For classes/structs, we have to set the static member "physnames"=0A= to point to strings like "Class::Member" */=0A= ***************=0A= *** 5113,5118 ****=0A= --- 5170,5203 ----=0A= return class_name;=0A= }=0A= =20=20=0A= + /* KAI EDG-style compiler mangles local vars differently. Need to make= =0A= + sure C++ demangler is called if the right name patterns appear. */=0A= + static void=0A= + edg_local_var_demangling( struct pending * local_symbols, struct obstack = * ostack )=0A= + {=0A= + struct pending *next;=0A= + struct symbol *sym;=0A= + int j;=0A= + char *pn;=0A= + for (next =3D local_symbols; next; next =3D next->next)=0A= + {=0A= + for (j =3D next->nsyms - 1; j >=3D 0; j--)=0A= + {=0A= + sym =3D next->symbol[j];=0A= + pn =3D SYMBOL_NAME (sym);=0A= + if ( pn && pn[0]=3D=3D'_' && pn[1]=3D=3D'_' && pn[2]>=3D'0' && pn[2]<= =3D'9'=0A= + && SYMBOL_CPLUS_DEMANGLED_NAME(sym)=3D=3DNULL )=0A= + {=0A= + if (SYMBOL_LANGUAGE (sym) =3D=3D language_c ||=0A= + SYMBOL_LANGUAGE (sym) =3D=3D language_unknown) {=0A= + SYMBOL_LANGUAGE (sym) =3D language_auto;=0A= + }=0A= + SYMBOL_INIT_DEMANGLED_NAME(sym,ostack);=0A= + }=0A= + }=0A= + }=0A= + }=0A= +=20=0A= /* Internalize one native debug symbol.=20=0A= * Called in a loop from hpread_expand_symtab().=20=0A= * Arguments:=0A= ***************=0A= *** 5325,5330 ****=0A= --- 5410,5419 ----=0A= else=0A= SYMBOL_NAME (sym) =3D VT (objfile) + dn_bufp->dfunc.name;=0A= =20=20=0A= + /* See if this is really a mangled C++ name */=0A= + if ( (EDG_DEMANGLING) && (dn_bufp->dfunc.language =3D=3D HP_LANGUAG= E_C) )=0A= + SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);=0A= +=20=0A= /* Special hack to get around HP compilers' insistence on=0A= * reporting "main" as "_MAIN_" for C/C++ */=0A= if ((strcmp (SYMBOL_NAME (sym), "_MAIN_") =3D=3D 0) &&=0A= ***************=0A= *** 5624,5629 ****=0A= --- 5713,5720 ----=0A= /* Insert func params into local list */=0A= merge_symbol_lists (¶m_symbols, &local_symbols);=0A= new =3D pop_context ();=0A= + if (EDG_DEMANGLING)=0A= + edg_local_var_demangling( local_symbols, &objfile->symbol_obstack );= =0A= /* Make a block for the local symbols within. */=0A= finish_block (new->name, &local_symbols, new->old_blocks,=0A= new->start_addr, valu, objfile);=0A= ***************=0A= *** 5652,5657 ****=0A= --- 5743,5750 ----=0A= desc =3D dn_bufp->dend.beginscope.dnttp.index;=0A= if (desc !=3D new->depth)=0A= complain (&lbrac_mismatch_complaint, (char *) symnum);=0A= + if (EDG_DEMANGLING)=0A= + edg_local_var_demangling( local_symbols, &objfile->symbol_obstack );=0A= =20=20=0A= /* Make a block for the local symbols within. */=0A= finish_block (new->name, &local_symbols, new->old_blocks,=0A= *** stabsread.c Thu Jun 27 17:04:37 2002=0A= --- stabsread.c.new Thu Jun 27 17:04:53 2002=0A= ***************=0A= *** 1260,1265 ****=0A= --- 1260,1280 ----=0A= }=0A= }=0A= =20=20=0A= + /* recogize an EDG compiler-generated temporary, like __T136266940 */=0A= + int=0A= + is_edg_temporary_var( sym )=0A= + struct symbol *sym;=0A= + {=0A= + char * pname =3D sym->ginfo.name;=0A= + if ( pname[0]=3D=3D'_' && pname[1]=3D=3D'_' && pname[2]=3D=3D'T' ) {=0A= + pname+=3D3;=0A= + while ( isdigit(*pname) ) pname++;=0A= + if ( *pname=3D=3D'\0' )=0A= + return 1;=0A= + }=0A= + return 0;=0A= + }=0A= +=20=0A= /* ARGSUSED */=0A= struct symbol *=0A= define_symbol (CORE_ADDR valu, char *string, int desc, int type,=0A= ***************=0A= *** 1674,1680 ****=0A= SYMBOL_CLASS (sym) =3D LOC_LOCAL;=0A= SYMBOL_VALUE (sym) =3D valu;=0A= SYMBOL_NAMESPACE (sym) =3D VAR_NAMESPACE;=0A= ! add_symbol_to_list (sym, &local_symbols);=0A= break;=0A= =20=20=0A= case 'p':=0A= --- 1689,1696 ----=0A= SYMBOL_CLASS (sym) =3D LOC_LOCAL;=0A= SYMBOL_VALUE (sym) =3D valu;=0A= SYMBOL_NAMESPACE (sym) =3D VAR_NAMESPACE;=0A= ! if ( !EDG_DEMANGLING || !is_edg_temporary_var(sym) )=0A= ! add_symbol_to_list (sym, &local_symbols);=0A= break;=0A= =20=20=0A= case 'p':=0A= ***************=0A= *** 2025,2033 ****=0A= SYMBOL_CLASS (typedef_sym) =3D LOC_TYPEDEF;=0A= SYMBOL_VALUE (typedef_sym) =3D valu;=0A= SYMBOL_NAMESPACE (typedef_sym) =3D VAR_NAMESPACE;=0A= ! if (TYPE_NAME (SYMBOL_TYPE (sym)) =3D=3D 0)=0A= ! TYPE_NAME (SYMBOL_TYPE (sym))=0A= ! =3D obconcat (&objfile->type_obstack, "", "", SYMBOL_NAME (sym));= =0A= add_symbol_to_list (typedef_sym, &file_symbols);=0A= }=0A= break;=0A= --- 2041,2058 ----=0A= SYMBOL_CLASS (typedef_sym) =3D LOC_TYPEDEF;=0A= SYMBOL_VALUE (typedef_sym) =3D valu;=0A= SYMBOL_NAMESPACE (typedef_sym) =3D VAR_NAMESPACE;=0A= ! /* SYMBOL_TYPE (sym) and SYMBOL_TYPE (typedef_sym) are identical at th= is point */=0A= ! if (TYPE_NAME (SYMBOL_TYPE (sym)) =3D=3D 0) {=0A= ! if ( SYMBOL_LANGUAGE (sym)=3D=3Dlanguage_cplus && SYMBOL_CPLUS_DEMAN= GLED_NAME (sym) ) {=0A= ! /* name of type should be demangled C++ name, if there is one */= =0A= ! TYPE_NAME (SYMBOL_TYPE (typedef_sym))=0A= ! =3D obconcat (&objfile->type_obstack, "", "", SYMBOL_CPLUS_DEMANGLED_N= AME (sym));=0A= ! TYPE_TAG_NAME (SYMBOL_TYPE (typedef_sym))=0A= ! =3D obconcat (&objfile->type_obstack, "", "", SYMBOL_CPLUS_DEMANGLED_N= AME (sym));=0A= ! } else=0A= ! TYPE_NAME (SYMBOL_TYPE (sym))=0A= ! =3D obconcat (&objfile->type_obstack, "", "", SYMBOL_NAME (sym));=0A= ! }=0A= add_symbol_to_list (typedef_sym, &file_symbols);=0A= }=0A= break;=0A= ***************=0A= *** 2053,2059 ****=0A= if (os9k_stabs)=0A= add_symbol_to_list (sym, &global_symbols);=0A= else=0A= ! add_symbol_to_list (sym, &local_symbols);=0A= break;=0A= =20=20=0A= case 'v':=0A= --- 2078,2085 ----=0A= if (os9k_stabs)=0A= add_symbol_to_list (sym, &global_symbols);=0A= else=0A= ! if ( !EDG_DEMANGLING && !is_edg_temporary_var(sym) )=0A= ! add_symbol_to_list (sym, &local_symbols);=0A= break;=0A= =20=20=0A= case 'v':=0A= ***************=0A= *** 3590,3596 ****=0A= --- 3616,3662 ----=0A= }=0A= }=0A= =20=20=0A= + /* fix the baseclasses for stabs created by edg front ends */=0A= + static void=20=0A= + edg_baseclass_fixup( type )=0A= + struct type *type;=0A= + {=0A= + int i;=0A= + int edg_n_baseclasses =3D 0;=0A= + if ( type=3D=3DNULL || TYPE_CPLUS_SPECIFIC(type)=3D=3DNULL ) {=0A= + /* no c++ info, better not touch it. */=0A= + return;=0A= + }=0A= + if ( TYPE_N_BASECLASSES(type) > 0 ) {=0A= + /* already have base classes for some reason, better not touch it */= =0A= + return;=0A= + }=0A= + for ( i=3D0; infields; i++ ) {=0A= + if ( strncmp( type->fields[i].name, "__b_", 4 )!=3D0 ) {=0A= + /* we're done. */=0A= + break;=0A= + }=0A= + edg_n_baseclasses++;=0A= + }=0A= + if ( edg_n_baseclasses=3D=3D0 ) {=0A= + return;=0A= + }=0A= + ALLOCATE_CPLUS_STRUCT_TYPE (type);=0A= + TYPE_N_BASECLASSES(type) =3D edg_n_baseclasses;=0A= =20=20=0A= + /* allocate space for virtual flag bits */=0A= + {=0A= + int num_bytes =3D B_BYTES (TYPE_N_BASECLASSES (type));=0A= + char *pointer;=0A= +=20=0A= + pointer =3D (char *) TYPE_ALLOC (type, num_bytes);=0A= + TYPE_FIELD_VIRTUAL_BITS (type) =3D (B_TYPE *) pointer;=0A= + }=0A= + B_CLRALL (TYPE_FIELD_VIRTUAL_BITS (type), TYPE_N_BASECLASSES (type));= =0A= +=20=0A= + }=0A= +=20=0A= +=20=0A= /* Read struct or class data fields. They have the form:=0A= =20=20=0A= NAME : [VISIBILITY] TYPENUM , BITPOS , BITSIZE ;=0A= ***************=0A= *** 4208,4214 ****=0A= }=0A= =20=20=0A= /* Fix up any cv-qualified versions of this type. */=0A= ! finish_cv_type (type);=0A= do_cleanups (back_to);=0A= return (type);=0A= }=0A= --- 4274,4285 ----=0A= }=0A= =20=20=0A= /* Fix up any cv-qualified versions of this type. */=0A= ! /*finish_cv_type (type);*/=0A= !=20=0A= ! /* FIXIT : jchu - may need to comment-out above line since it=20=0A= ! * didn't exist in the original 5.0 src=0A= ! */=0A= ! edg_baseclass_fixup(type);=0A= do_cleanups (back_to);=0A= return (type);=0A= }=0A= *** symfile.c Thu Jun 27 17:04:37 2002=0A= --- symfile.c.new Thu Jun 27 17:04:57 2002=0A= ***************=0A= *** 1926,1934 ****=0A= =20=20=0A= if (filename !=3D NULL)=0A= if ((cp =3D strrchr (filename, '.')) !=3D NULL)=0A= ! for (i =3D 0; i < fl_table_next; i++)=0A= ! if (strcmp (cp, filename_language_table[i].ext) =3D=3D 0)=0A= ! return filename_language_table[i].lang;=0A= =20=20=0A= return language_unknown;=0A= }=0A= --- 1926,1938 ----=0A= =20=20=0A= if (filename !=3D NULL)=0A= if ((cp =3D strrchr (filename, '.')) !=3D NULL)=0A= ! {=0A= ! if (strlen(filename)>6 && strcmp(cp-4,".int.c")=3D=3D0)=0A= ! return language_cplus;=0A= ! for (i =3D 0; i < fl_table_next; i++)=0A= ! if (strcmp (cp, filename_language_table[i].ext) =3D=3D 0)=0A= ! return filename_language_table[i].lang;=0A= ! }=0A= =20=20=0A= return language_unknown;=0A= }=0A= ------_=_NextPart_000_01C21E2B.04E3CC20-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21831 invoked by alias); 28 Jun 2002 13:31:15 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 21822 invoked from network); 28 Jun 2002 13:31:13 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by sources.redhat.com with SMTP; 28 Jun 2002 13:31:13 -0000 Received: from 01-059.118.popsite.net ([66.19.120.59] helo=nevyn.them.org) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 17Nvq9-0005Iu-00; Fri, 28 Jun 2002 08:31:10 -0500 Received: from drow by nevyn.them.org with local (Exim 3.35 #1 (Debian)) id 17NvqC-0008MJ-00; Fri, 28 Jun 2002 09:31:12 -0400 Date: Fri, 28 Jun 2002 06:31:00 -0000 From: Daniel Jacobowitz To: "Chu, Josh" Cc: "'gdb@sources.redhat.com'" Subject: Re: 64bit gdb for KAI/KCC compiler Message-ID: <20020628133112.GB31848@nevyn.them.org> Mail-Followup-To: "Chu, Josh" , "'gdb@sources.redhat.com'" References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.1i X-SW-Source: 2002-06/txt/msg00314.txt.bz2 On Thu, Jun 27, 2002 at 05:36:03PM -0500, Chu, Josh wrote: > Ok, so here's the deal : KAI released a patch for gdb 5.0 that will allow > gdb to read the EDG-style mangled names. I've attached the patch files that > were to be applied to 5.0 (gdb.patch-5.0 and libiberty.patch-5.0). I tried > manually applying these modifications to the 5.2 source, and it builds. > However, there are some definite problems because gdb will now core dump > occasionally, not to mention the names are still mangled. > I've included the patch files to 5.0 and my modifications to the files in > 5.2 : > > gdb/libiberty: > cplus-dem.c > > gdb/gdb: > dwarf2read.c > hpread.c > stabsread.c > symfile.c > After this is done, you can try to build and run. (export CC='gcc -m64' and > ./configure first) What platform is this, Solaris? Looks like it from the m64. > I suppose this is a fairly vague question : but does anyone have a clue why > the patches aren't working with 5.2? > This would be a huge help for anyone who has a KAI compiler on a 64-bit > system, as it would allow people to debug 64bit programs compiled with KCC. > Or if someone who's familiar with the above-mentioned files could comment on > the patched files and what could potentially be wrong with them, I would > very much appreciate it. > Thanks so much I'm more curious why they worked with 5.0. I imagine they had very limited functionality, since there is a great deal more to do in C++ support than demangle names properly. I skimmed the patches and nothing jumps out at me as immediately wrong except for: ! if ( !EDG_DEMANGLING && !is_edg_temporary_var(sym) ) ! add_symbol_to_list (sym, &local_symbols); That should probably be || if you ever want to see a local static variable in GDB.... also, you do not need to comment out finish_cv_type. -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28128 invoked by alias); 28 Jun 2002 13:47:48 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 28056 invoked from network); 28 Jun 2002 13:47:44 -0000 Received: from unknown (HELO mspmail1.retek.com) (64.238.80.50) by sources.redhat.com with SMTP; 28 Jun 2002 13:47:44 -0000 Received: by mspmail1.retek.int with Internet Mail Service (5.5.2653.19) id ; Fri, 28 Jun 2002 08:47:40 -0500 Message-ID: From: "Chu, Josh" To: 'Daniel Jacobowitz' Cc: "'gdb@sources.redhat.com'" Subject: RE: 64bit gdb for KAI/KCC compiler Date: Fri, 28 Jun 2002 06:47:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-SW-Source: 2002-06/txt/msg00316.txt.bz2 Yeah this is for Solaris 64bit. The KCC support for gdb v5.0 was actually fine for 32bit...it just didn't compile under 64bit (5.0 doesn't compile for 64bit by itself either). I'm also checking into the KCC support group to see if they will support this. I will post the patches once(if) we get this working Thanks for taking a look at the code! --JC -----Original Message----- From: Daniel Jacobowitz [mailto:drow@mvista.com] Sent: Friday, June 28, 2002 8:31 AM To: Chu, Josh Cc: 'gdb@sources.redhat.com' Subject: Re: 64bit gdb for KAI/KCC compiler On Thu, Jun 27, 2002 at 05:36:03PM -0500, Chu, Josh wrote: > Ok, so here's the deal : KAI released a patch for gdb 5.0 that will allow > gdb to read the EDG-style mangled names. I've attached the patch files that > were to be applied to 5.0 (gdb.patch-5.0 and libiberty.patch-5.0). I tried > manually applying these modifications to the 5.2 source, and it builds. > However, there are some definite problems because gdb will now core dump > occasionally, not to mention the names are still mangled. > I've included the patch files to 5.0 and my modifications to the files in > 5.2 : > > gdb/libiberty: > cplus-dem.c > > gdb/gdb: > dwarf2read.c > hpread.c > stabsread.c > symfile.c > After this is done, you can try to build and run. (export CC='gcc -m64' and > ./configure first) What platform is this, Solaris? Looks like it from the m64. > I suppose this is a fairly vague question : but does anyone have a clue why > the patches aren't working with 5.2? > This would be a huge help for anyone who has a KAI compiler on a 64-bit > system, as it would allow people to debug 64bit programs compiled with KCC. > Or if someone who's familiar with the above-mentioned files could comment on > the patched files and what could potentially be wrong with them, I would > very much appreciate it. > Thanks so much I'm more curious why they worked with 5.0. I imagine they had very limited functionality, since there is a great deal more to do in C++ support than demangle names properly. I skimmed the patches and nothing jumps out at me as immediately wrong except for: ! if ( !EDG_DEMANGLING && !is_edg_temporary_var(sym) ) ! add_symbol_to_list (sym, &local_symbols); That should probably be || if you ever want to see a local static variable in GDB.... also, you do not need to comment out finish_cv_type. -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer