Article View: gnu.gdb.bug
Article #404gdb 4.6 cfront-style name demangling problem
From: Robert Mecklenburg
Date: Thu, 27 Aug 1992 05:39
Date: Thu, 27 Aug 1992 05:39
116 lines
3028 bytes
3028 bytes
gdb 4.6 on SGI IRIX 4.0.1 does not demangle cfront generated local
variables and structure data members correctly. Here is an example:
junk.c:
struct A {
int i;
};
main()
{
A a;
a.i = 10;
}
46 lotus:~$ gdb junk
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.6, Copyright 1992 Free Software Foundation, Inc...
No symbol "demangle" in current context.
(gdb) b 8
Breakpoint 1 at 0x400210: file junk.c, line 8.
(gdb) run
Starting program: /u/prof/mecklen/junk
Breakpoint 1, main () at junk.c:8
8 a.i = 10;
(gdb) i lo
a::a() = {
i__1A = 0
}
(gdb) p a
No symbol "a" in current context.
(gdb) p __1a
$1 = {
i__1A = 0
}
(gdb) p __1a.i
There is no member named i.
(gdb) p __1a.i__1A
$2 = 0
(gdb)
The code generated by cfront for this program is:
/* <<AT&T C++ Translator 2.00 06/30/89>> */
/* < junk.c > */
# 1 "junk.c"
void *__vec_new (void *, int , int , void *);
# 1
void __vec_ct (void *, int , int , void *);
# 1
void __vec_dt (void *, int , int , void *);
# 1
void __vec_delete (void *, int , int , void *, int , int );
typedef int (*__vptp)();
struct __mptr {short d; short i; __vptp f; };
# 1
struct A;struct A { /* sizeof A == 4 */
# 2
int i__1A ;
};
# 5
int main (void ){ _main();
# 6
{
# 7
struct A __1a ;
__1a . i__1A = 10 ;
}
}
# 9
/* the end */
A bogus fix that I tried is:
diff -r gdb-4.6/gdb/cplus-dem.c gdb-4.6.mashed/gdb/cplus-dem.c
341c344,348
< if (success && (*mangled != '\0'))
---
> if (success == 2)
> {
> string_append( &decl, mangled );
> }
> else if (success == 1 && (*mangled != '\0'))
886c893
< Returns 1 on success, 0 otherwise.
---
> Returns 2 if a cfront local symbol, 1 on other success, 0 otherwise.
918c925,926
< else if ((scan == *mangled) && (isdigit (scan[2]) || (scan[2] == 'Q')))
---
> else if (current_demangling_style == gnu_demangling &&
> (scan == *mangled) && (isdigit (scan[2]) || (scan[2] == 'Q')))
923a932,938
> else if (current_demangling_style == cfront_demangling &&
> (scan == *mangled) && isdigit (scan[2]))
> {
> /* A cfront local variable starts with "__<digit>". */
> *mangled = scan + 3;
> success = 2;
> }
Any fixes would be much appreciated.
Thanks,
Robert Mecklenburg
University of Utah
Technical Details
Message-ID:
<9208271739.AA13978@hellgate.utah.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!wupost!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!jensen.cs.utah.edu!mecklenShow Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!jensen.cs.utah.edu!mecklen From: mecklen@jensen.cs.utah.edu (Robert Mecklenburg) Subject: gdb 4.6 cfront-style name demangling problem Message-ID: <9208271739.AA13978@hellgate.utah.edu> Sender: gnulists@ai.mit.edu Organization: University of Utah CS Dept Distribution: gnu Date: Thu, 27 Aug 1992 05:39:41 GMT Approved: bug-gdb@prep.ai.mit.edu Lines: 117