Compile and disassemble is the most useful feature in forever!
That said, it would be really awesome if symbol names in the disassembly were un-mangled; D has a tendency to produce some horrible symbol names!
0000000000000029: lea rcx,[rbp-10h]
000000000000002D: sub rsp,20h
0000000000000031: call _D3std6format61__T11formatValueTS3std5array17__T8AppenderTAyaZ8AppenderTmTaZ11formatValueFS3std5array17__T8AppenderTAyaZ8AppendermKS3std6format18__T10FormatSpecTaZ10FormatSpecZ16__T9__lambda4TmZ9__lambda4FNaNbNiNeKmZAxa
0000000000000036: add rsp,20h
000000000000003A: mov qword ptr [rbp-60h],rax
... difficult to know what's being called in these instances ;)
Comment #1 by r.sagitario — 2015-06-14T12:28:13Z
Actually, you can get that already by piping the assembly output through ddemangle. Set the disassembly command to something like:
"$(VCINSTALLDIR)\bin\dumpbin" /disasm:nobytes "$(InputPath)" | ddemangle >"$(TargetPath)"
Maybe this should even be the default, though I'm unsure ddemangle is distributed with LDC or GDC.
Comment #2 by r9shackleford — 2015-06-14T13:21:50Z
@Rainer
GDC is generally bundled with binutils which includes D symbol demangling in the relevant tools(e.g, c++filt, objdump, etc)
Comment #3 by r.sagitario — 2015-06-16T20:50:42Z
> GDC is generally bundled with binutils which includes D symbol demangling in the relevant tools(e.g, c++filt, objdump, etc)
I don't see any D demangling support in objdump/c++filt in the latest GDC build I could find at http://gdcproject.org/downloads. Any hidden option I should use?
Comment #4 by ibuclaw — 2015-06-16T22:02:35Z
(In reply to Rainer Schuetze from comment #3)
> > GDC is generally bundled with binutils which includes D symbol demangling in the relevant tools(e.g, c++filt, objdump, etc)
>
> I don't see any D demangling support in objdump/c++filt in the latest GDC
> build I could find at http://gdcproject.org/downloads. Any hidden option I
> should use?
-s dlang or --format=dlang
Comment #5 by r.sagitario — 2015-06-16T22:17:48Z
Maybe the Windows versions don't have it?
I tried
>"c:\l\GDC-2.066\bin\c++filt.exe" --version
GNU c++filt (crosstool-NG 1.20.0 - 20150413-2.066.1-f378f9ab41) 2.23.1
>"c:\l\GDC-2.066\bin\c++filt.exe" --format=dlang
c:\l\GDC-2.066\bin\c++filt.exe: unknown demangling style `dlang'
Comment #6 by ibuclaw — 2015-06-17T08:09:02Z
(In reply to Rainer Schuetze from comment #5)
> Maybe the Windows versions don't have it?
>
> I tried
>
> >"c:\l\GDC-2.066\bin\c++filt.exe" --version
> GNU c++filt (crosstool-NG 1.20.0 - 20150413-2.066.1-f378f9ab41) 2.23.1
>
> >"c:\l\GDC-2.066\bin\c++filt.exe" --format=dlang
> c:\l\GDC-2.066\bin\c++filt.exe: unknown demangling style `dlang'
Support was added in binutils 2.25
Comment #7 by turkeyman — 2015-06-22T14:04:41Z
What will happen for binaries with both D and C++ symbols?
Comment #8 by r.sagitario — 2015-06-22T17:59:20Z
> What will happen for binaries with both D and C++ symbols?
Good question. I was just about to adapt the demangling of linker messages to fit this use case aswell, but C++ symbols are not supported (nor by ddemangle which also doesn't support compressed symbols on Win32). Having two different C++ manglings is not so great, too.
For gdc builds you could chain two calls to c++filt if a binary is available.
Comment #9 by r.sagitario — 2015-06-26T09:36:51Z
> Support was added in binutils 2.25
I've build this version, but noticed that it doesn't demangle full text files, just the arguments given on the command line. Instead, it reports "Internal error: no symbol alphabet for current style". That has an easy fix, though.
As cxxfilt will very likely never support compressed symbols aswell as MS mangled symbols, I've compiled my own version supporting all 3 manglings (D/gcc/cl) including compression.
Disassembly with demangled symbols is now enabled if the global option "Demangle symbols in linker messages/disassembly" is checked. Try it in https://github.com/D-Programming-Language/visuald/releases/tag/v0.3.42-beta2
Comment #10 by turkeyman — 2015-06-28T00:27:58Z
Seems to be working great now!
Comment #11 by ibuclaw — 2015-06-29T08:59:21Z
(In reply to Rainer Schuetze from comment #9)
> > Support was added in binutils 2.25
>
> I've build this version, but noticed that it doesn't demangle full text
> files, just the arguments given on the command line. Instead, it reports
> "Internal error: no symbol alphabet for current style". That has an easy
> fix, though.
>
> As cxxfilt will very likely never support compressed symbols aswell as MS
> mangled symbols, I've compiled my own version supporting all 3 manglings
> (D/gcc/cl) including compression.
>
Nice wrapper you've got there. The next version of binutils/gdb will have pretty much near complete 2.068 support. In my local tests, it managed to demangle all symbols in Phobos and druntime (core.demangle barely got 20% - and even then some were massively incorrect).
> The next version of binutils/gdb will have pretty much near complete 2.068
> support. In my local tests, it managed to demangle all symbols in Phobos
> and druntime (core.demangle barely got 20% - and even then some were
> massively incorrect).
I could use the D demangler from binutils in my tool, too. Also, the mago debug engine might need an update to its demangler.
Do you plan to submit those fixes to core.demangle, too?