[fpc-devel] Win32 DWARF problem (was: Debugger for FPC)

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Mar 19 10:18:10 CET 2009


Marc Weustink wrote on do, 19 mrt 2009:

> Marc Weustink wrote:
>>
>> If we cannot solve this, in case of DWARF2 i think we can leave   
>> those attributes out.
>
> I've tested this (by editing the .s file) and gdb still seems to work
> and doesn't complain anymore.

Can you test the attached patch? I tried to send it to Paul, but  
mail.ru thought it was spam...


Jonas



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

-------------- next part --------------
Index: dbgdwarf.pas
===================================================================
--- dbgdwarf.pas	(revision 12916)
+++ dbgdwarf.pas	(working copy)
@@ -2254,20 +2254,24 @@
         fitem : TFileIndexItem;
         flist : TFPList;
       begin
-        { insert .Ltext0 label }
-        templist:=TAsmList.create;
-        new_section(templist,sec_code,'',0);
-        templist.concat(tai_symbol.createname(target_asm.labelprefix+'text0',AT_DATA,0));
-        current_asmdata.asmlists[al_start].insertlist(templist);
-        templist.free;
+        { doesn't work for windows, because it puts no code per module in the .text section }
+        if not(target_info.system in system_all_windows) then
+          begin
+            { insert .Ltext0 label }
+            templist:=TAsmList.create;
+            new_section(templist,sec_code,'',0);
+            templist.concat(tai_symbol.createname(target_asm.labelprefix+'text0',AT_DATA,0));
+            current_asmdata.asmlists[al_start].insertlist(templist);
+            templist.free;
+    
+            { insert .Letext0 label }
+            templist:=TAsmList.create;
+            new_section(templist,sec_code,'',0);
+            templist.concat(tai_symbol.createname(target_asm.labelprefix+'etext0',AT_DATA,0));
+            current_asmdata.asmlists[al_end].insertlist(templist);
+            templist.free;
+          end;
 
-        { insert .Letext0 label }
-        templist:=TAsmList.create;
-        new_section(templist,sec_code,'',0);
-        templist.concat(tai_symbol.createname(target_asm.labelprefix+'etext0',AT_DATA,0));
-        current_asmdata.asmlists[al_end].insertlist(templist);
-        templist.free;
-
         { insert .Ldebug_abbrev0 label }
         templist:=TAsmList.create;
         new_section(templist,sec_debug_abbrev,'',0);
@@ -2513,9 +2517,14 @@
           append_labelentry_dataptr_rel(DW_AT_stmt_list,
             current_asmdata.RefAsmSymbol(target_asm.labelprefix+'debug_linesection0'),
             current_asmdata.RefAsmSymbol(target_asm.labelprefix+'debug_line0'));
-        append_labelentry(DW_AT_low_pc,current_asmdata.RefAsmSymbol(target_asm.labelprefix+'text0'));
-        append_labelentry(DW_AT_high_pc,current_asmdata.RefAsmSymbol(target_asm.labelprefix+'etext0'));
 
+        { see comments above where these labels are created and inserted }
+        if not(target_info.system in system_all_windows) then
+          begin
+            append_labelentry(DW_AT_low_pc,current_asmdata.RefAsmSymbol(target_asm.labelprefix+'text0'));
+            append_labelentry(DW_AT_high_pc,current_asmdata.RefAsmSymbol(target_asm.labelprefix+'etext0'));
+          end;
+
         finish_entry;
 
         { write all global/local variables. This will flag all required tdefs  }


More information about the fpc-devel mailing list