www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - How possible is it to put DWARF debug infos in MSCOFF objects ?

reply Basile B. <b2.temp gmx.com> writes:
Now that -m64 + LLD + MINGW works, the question is obvious.

The background idea is of course to allow the use of GDB under 
Windows. At first glance the debug info API is not uniform. This 
is visible if you compare dmd.backend.dwarf and dmd.backend.cgcv 
and the naive idea which would be to replace all the calls 
starting with 'cv8_' with their "dwarf_" equivalent won't work 
(let's say to test in a first time, later a new compiler switch 
could be added to select the debug info format).
Aug 17 2018
next sibling parent reply Basile B. <b2.temp gmx.com> writes:
On Friday, 17 August 2018 at 19:28:47 UTC, Basile B. wrote:
 Now that -m64 + LLD + MINGW works, the question is obvious.

 The background idea is of course to allow the use of GDB under 
 Windows. At first glance the debug info API is not uniform. 
 This is visible if you compare dmd.backend.dwarf and 
 dmd.backend.cgcv and the naive idea which would be to replace 
 all the calls starting with 'cv8_' with their "dwarf_" 
 equivalent won't work (let's say to test in a first time, later 
 a new compiler switch could be added to select the debug info 
 format).
Conctretly the idea is to do that : ------------------------- src/dmd/backend/mscoffobj.c ------------------------- index 45f1f4219..1b1d34376 100644 -26,8 +26,13 #include "mach.h" #include "outbuf.h" #include "filespec.h" -#include "cv4.h" -#include "cgcv.h" + +//#include "cv4.h" +//#include "cgcv.h" + +#include "dwarf2.h" +#include "dwarf.h" + #include "dt.h" #include "aa.h" -430,7 +435,8 MsCoffObj *MsCoffObj::init(Outbuffer *objbuf, const char *filename, const char * assert(SegData[UDATA]->SDseg == UDATA); if (config.fulltypes) - cv8_initfile(filename); + //cv8_initfile(filename); + dwarf_initfile(filename); assert(objbuf->size() == 0); return obj; } -464,7 +470,8 void MsCoffObj::initfile(const char *filename, const char *csegname, const char } #endif if (config.fulltypes) - cv8_initmodule(filename, modname); + //cv8_initmodule(filename, modname); + dwarf_initmodule(filename, modname); } /************************************ -670,7 +677,8 void MsCoffObj::termfile() //dbg_printf("MsCoffObj::termfile\n"); if (configv.addlinenumbers) { - cv8_termmodule(); + //cv8_termmodule(); + dwarf_termmodule(); } } -692,7 +700,8 void MsCoffObj::term(const char *objfilename) if (configv.addlinenumbers) { - cv8_termfile(objfilename); + //cv8_termfile(objfilename); + dwarf_termfile(objfilename); } #if SCPP -1032,7 +1041,7 void MsCoffObj::linnum(Srcpos srcpos, int seg, targ_size_t offset) if (srcpos.Slinnum == 0 || !srcpos.Sfilename) return; - cv8_linnum(srcpos, offset); + //cv8_linnum(srcpos, offset); } -1850,7 +1859,8 void MsCoffObj::func_start(Symbol *sfunc) sfunc->Soffset = Offset(cseg); if (config.fulltypes) - cv8_func_start(sfunc); + //cv8_func_start(sfunc); + dward_func_start(sfunc); } /******************************* -1863,7 +1873,8 void MsCoffObj::func_term(Symbol *sfunc) // sfunc->Sident, sfunc->Soffset,Offset(cseg),sfunc->Sxtrnnum); if (config.fulltypes) - cv8_func_term(sfunc); + //cv8_func_term(sfunc); + dwarf_func_term(sfunc); } /******************************** However this doesn't build for now and i don't get error messages for some reasons (dmc sterrr not redirected ?)
Aug 17 2018
parent reply Andre Pany <andre s-e-a-p.de> writes:
On Friday, 17 August 2018 at 19:35:40 UTC, Basile B. wrote:
 On Friday, 17 August 2018 at 19:28:47 UTC, Basile B. wrote:
 Now that -m64 + LLD + MINGW works, the question is obvious.

 The background idea is of course to allow the use of GDB under 
 Windows. At first glance the debug info API is not uniform. 
 This is visible if you compare dmd.backend.dwarf and 
 dmd.backend.cgcv and the naive idea which would be to replace 
 all the calls starting with 'cv8_' with their "dwarf_" 
 equivalent won't work (let's say to test in a first time, 
 later a new compiler switch could be added to select the debug 
 info format).
Just to make sure, do you know Mago-Mi? It is the Mago debug engine with a GDB compatible interface. That means at every place GBD is supported, also Mago-Mi can be used. For example IntelliJ D Language plugin or Visual Studio Code or DlangIDE... Unfortunately Mago-Mi has some issues, written down here https://wiki.dlang.org/SAOC_2018_ideas#Multi_IDE_debugger_support_.28for_windows.29 Kind regards André
Aug 17 2018
parent Basile B. <b2.temp gmx.com> writes:
On Friday, 17 August 2018 at 19:45:35 UTC, Andre Pany wrote:
 On Friday, 17 August 2018 at 19:35:40 UTC, Basile B. wrote:
 On Friday, 17 August 2018 at 19:28:47 UTC, Basile B. wrote:
 Now that -m64 + LLD + MINGW works, the question is obvious.

 The background idea is of course to allow the use of GDB 
 under Windows. [...]
Just to make sure, do you know Mago-Mi?
Yes however this doesn't mean that it's not worth generating DWARF info if it's technically possible.
Aug 17 2018
prev sibling parent Basile B. <b2.temp gmx.com> writes:
On Friday, 17 August 2018 at 19:28:47 UTC, Basile B. wrote:
 Now that -m64 + LLD + MINGW works, the question is obvious.

 The background idea is of course to allow the use of GDB under 
 Windows. At first glance the debug info API is not uniform. 
 This is visible if you compare dmd.backend.dwarf and 
 dmd.backend.cgcv and the naive idea which would be to replace 
 all the calls starting with 'cv8_' with their "dwarf_" 
 equivalent won't work (let's say to test in a first time, later 
 a new compiler switch could be added to select the debug info 
 format).
Actually i expected an answer with someone with expertise in the object formats and debug infos, for example Walter Bright or Rainer Shutze, what do you think ?
Aug 18 2018