www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - gdb + Windows 64: No debugging symbols found

reply =?UTF-8?B?0JLQuNGC0LDQu9C40Lkg0KTQsNC0?= =?UTF-8?B?0LXQtdCy?= writes:
We have:

     // app.d
     import std.stdio;

     void main()
     {
         writeln( "OK" );
     }

Build:
     dmd -m64 -g app.d

OS:
     Windows 10, x86_64
     MSYS2: gdb

Goal:
     gdb app.exe


Problem is:
     $ gdb ./app.exe
     GNU gdb (GDB) 9.2
     ...
     (No debugging symbols found in ./app.exe)

What is a right way to build .exe and debug with gdb ?
Dec 26 2020
next sibling parent Mike Parker <aldacron gmail.com> writes:
On Saturday, 26 December 2020 at 11:55:58 UTC, Виталий Фадеев 
wrote:

 Problem is:
     $ gdb ./app.exe
     GNU gdb (GDB) 9.2
     ...
     (No debugging symbols found in ./app.exe)

 What is a right way to build .exe and debug with gdb ?
The version of gdb that ships with MSYS is probably going to expect debug info in a different format than what dmd puts out on Windows (I assume it expects DWARF2). When using -m32(always the default on Windows when invoking dmd directly), it outputs debug info in an old version of the CodeView format (which you'll probably need an older version of WinDbg to work with). Otherwise (-m64, -m32mscoff), it creates a PDB file usable with the Visual Studio debugger and other debuggers that understand the PDB format (which is basically a wrapper for modern CodeView debug info). If there's a Windows version of gdb that supports CodeView/PDB, I'm unaware of it. I know some people use Mago: https://github.com/rainers/mago Some docs on PDB & CodeView: https://llvm.org/docs/PDB/index.html DMD and debug info on Windows: https://dlang.org/windbg.html
Dec 26 2020
prev sibling parent reply Basile B. <b2.temp gmx.com> writes:
On Saturday, 26 December 2020 at 11:55:58 UTC, Виталий Фадеев 
wrote:
 We have:
 [...]
 Problem is:
     $ gdb ./app.exe
     GNU gdb (GDB) 9.2
     ...
     (No debugging symbols found in ./app.exe)

 What is a right way to build .exe and debug with gdb ?
Try to build with latest version of LDC and use the -gdwarf option. This will generate debug info that GDB can understand.
Dec 26 2020
parent =?UTF-8?B?0JLQuNGC0LDQu9C40Lkg0KTQsNC0?= =?UTF-8?B?0LXQtdCy?= writes:
On Saturday, 26 December 2020 at 14:10:46 UTC, Basile B. wrote:
 On Saturday, 26 December 2020 at 11:55:58 UTC, Виталий Фадеев 
 wrote:
 We have:
 [...]
 Problem is:
     $ gdb ./app.exe
     GNU gdb (GDB) 9.2
     ...
     (No debugging symbols found in ./app.exe)

 What is a right way to build .exe and debug with gdb ?
Try to build with latest version of LDC and use the -gdwarf option. This will generate debug info that GDB can understand.
Mike Parker, Basile B., thanks!
Dec 26 2020