How possible is it to put DWARF debug infos in MSCOFF objects ?

Basile B. b2.temp at gmx.com
Fri Aug 17 19:35:40 UTC 2018


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 ?)


More information about the Digitalmars-d mailing list