www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3387] New: gdb: symbols in the backtrace are not demangled

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3387

           Summary: gdb: symbols in the backtrace are not demangled
           Product: D
           Version: 1.047
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: llucax gmail.com



PDT ---
In DMD 1.046 or older, the backtrace were broken but the symbol were demangled
(using the D GDB patch at least).

Starting at version 1.047, the symbols are not demangled anymore in GDB.

Same test program as bug 136:

--------
void main() {
    static int i = 0;
    while (i++ < 10)
        main();
    *(cast(int *)0) = 0;
}
--------

DMD evolution:

1.046
=====
--------------------
GNU gdb (GDB) 7.0.50.20090919
[...]
Reading symbols from /home/luca/tesis/dmd-1.049/dmd/linux/bug136...done.
(gdb) bt
No stack.
(gdb) run
Starting program: /home/luca/tesis/dmd-1.049/dmd/linux/bug136 
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x08049b12 in D main ()
Current language:  auto
The current source language is "auto; currently asm".
(gdb) bt




Backtrace stopped: previous frame inner to this frame (corrupt stack?)
--------------------


1.047
=====
--------------------
GNU gdb (GDB) 7.0.50.20090919
[...]
Reading symbols from /home/luca/tesis/dmd-1.049/dmd/linux/bug136...done.
(gdb) run
Starting program: /home/luca/tesis/dmd-1.049/dmd/linux/bug136 
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x08049b12 in _Dmain () at bin/bug136.d:6
6        *(cast(int *)0) = 0;
Current language:  auto
The current source language is "auto; currently d".
(gdb) bt




Backtrace stopped: previous frame inner to this frame (corrupt stack?)
--------------------


1.049
=====
--------------------
--------------------
GNU gdb (GDB) 7.0.50.20090919
[...]
Reading symbols from /home/luca/tesis/dmd-1.049/dmd/linux/bug136...done.
(gdb) run
Starting program: /home/luca/tesis/dmd-1.049/dmd/linux/bug136 
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x08049b12 in _Dmain () at bin/bug136.d:6
6        *(cast(int *)0) = 0;
Current language:  auto
The current source language is "auto; currently d".
(gdb) bt












--------------------

The backtrace looks nice in DMD 1.049 but the symbols can't be demangled by
GDB.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 12 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3387




PDT ---
BTW DMD 2.034 works fine:

----------
(gdb) bt
















------------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 12 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3387


Leandro Lucarella <llucax gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|1.047                       |1.051
           Severity|regression                  |normal



PDT ---
It doesn't look like a regression after all, it seems to depend on whatever -g
or -gc is used. With -g I get the properly demangled names, but with -gc I
don't. The problem is, -g is broken with GDB, so I can't use -g.

It would be a problem to have -gc producing the necessary debug info to get
properly demangled names?

Sorry for the noise.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 19 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3387


Robert Clipsham <robert octarineparrot.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|wrong-code                  |
             Status|NEW                         |RESOLVED
                 CC|                            |robert octarineparrot.com
         Resolution|                            |INVALID



22:46:37 BST ---
I've removed the wrong-code keyword, and closing this bug, as it isn't a dmd
issue. The code generated is correct, as -gc means D should pretend to be C...
Which means symbol names have to be mangled, as otherwise they are not valid C
symbols. It also means gdb won't demangle them, as it detects C and not D. The
correct solution for this bug is to add support for the D extensions to gdb,
there's nothing dmd can do about this without adding another debugging mode,
something I think is best avoided.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 02 2010