[Issue 8172] New: OSX: symbols mangled on gdb,ggdb,cgdb,lldb but not on ubuntu; no line numbers on stacktraces

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 31 00:52:23 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8172

           Summary: OSX: symbols mangled on gdb,ggdb,cgdb,lldb but not on
                    ubuntu; no line numbers on stacktraces
           Product: D
           Version: D2
          Platform: All
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: thelastmammoth at gmail.com


--- Comment #0 from thelastmammoth at gmail.com 2012-05-31 00:54:11 PDT ---
I'm trying to have proper debug info for D on OSX (D2, 2.059 but it shouldn't
matter). Currently I can only do that on ubuntu. I see several posts about this
topic but they seem out of date and the information is scattered.

I tried several options:
****
A) OSX
1) gdb (default provided by apple: gdb 6.3.50)
2) ggdb (from macports: version 7.3) => doesn't seem to work at all even for
simple C hello world
3) gdb-7.4.1 (manual build from gdb website, somehow requires to run as sudo
otherwise complains : please check gdb is codesigned - see taskgated, but
despite instructions online running as sudo was the only way to make it work)
4) cgdb
5) lldb

B) Ubuntu
1) gdb 7.2 (according to http://www.dsource.org/projects/gdb-patches, a patch
for D is part of GDB " as of 7.2)
****

I'm compiling a simple hello world with a forced seg fault: compiled with dmd
-g main.d. 
cat main.d:
module main; void fun(){int *x = null; *x = 1;} void main(){fun;}

Here are the results on $debugger_name main:
A.1: mangled names, line numbers: 0x00000001000014e3 in _D4main3funFZv () at
main.d:2
A.2: just addresses: 0x000000010bb5a4e3 in ?? ()
A.3: mangled names, no line numbers: 0x00000001000014e3 in D4main3funFZv ()
A.4: mangled names, line numbers: 0x00000001000014e3 in _D4main3funFZv () at
main.d:2
A.5: mangled names, line numbers: frame #0: 0x00000001000014e3
main`D4main3funFZv + 15 at main.d:2
B.1: demangled names, line numbers 0x00000000004016c7 in main.fun () at
main.d:2

Note, even on OSX the D demangling would be easy via dfilt or ddemangle [cf git
repo: dmd/tools/ddemangle.d for a tool or dmd/druntime/src/core/demangle.d for
the function]): 
dfilt D4fun25fun2bFPiZv => void main.fun()

Would you have any ideas how to make it work on OSX?

****
Another related issue is wrt stacktraces: the situation is reversed, ie it
displays the demangled names, but no line numbers:
6   main2                           0x000000010b6b94db void main.__assert(int)
+ 23

There were some previous threads about requiring to add to dmd.conf
"-L--export-dynamic" but that will not let dmd run. 
I'm not sure whether it's relevant, but I am able to get proper stack traces in
C++ programs on OSX using code similar to
http://www.tekkotsu.org/dox/StackTrace_8h.html

****
btw is there a way to print stack trace without having an assertion failed in
D?

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


More information about the Digitalmars-d-bugs mailing list