View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0035566 | FPC | Compiler | public | 2019-05-12 13:25 | 2019-10-13 18:09 |
Reporter | Martin Friebe | Assigned To | Sven Barth | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | reopened | ||
Platform | 64bit Intel | OS | win 10 | OS Version | 10 |
Product Version | Product Build | 42039 | |||
Target Version | Fixed in Version | 3.3.1 | |||
Summary | 0035566: dwarf-3 for widestring (rev 42039, 42038) is wrong | ||||
Description | For windows style widestring the size is always stored in a 4 byte field. The dwarf expression now correctly subtracts 4. But then uses DW_OP_deref, with for 64 bit apps, loads a 64bit value. The correct expression should be DW_OP_deref_size, 4 See Patch. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 42087,43182 | ||||
FPCOldBugId | |||||
FPCTarget | - | ||||
Attached Files |
|
related to | 0035386 | closed | Sven Barth | Wrong dwarf-3 info for ansistring when cross compiling to 32 bit |
|
widestring_fix_deref_size.patch (2,248 bytes)
Index: dbgdwarf.pas =================================================================== --- dbgdwarf.pas (revision 42039) +++ dbgdwarf.pas (working copy) @@ -4268,7 +4268,7 @@ if not (is_widestring(def) and (tf_winlikewidestring in target_info.flags)) then upperopcodes:=13 else - upperopcodes:=15; + upperopcodes:=16; { lower bound is always 1, upper bound (length) needs to be calculated } append_entry(DW_TAG_subrange_type,false,[ DW_AT_lower_bound,DW_FORM_udata,1, @@ -4287,16 +4287,21 @@ current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_skip))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit_unaligned(3)); { no -> load length } - if upperopcodes=15 then + if upperopcodes=16 then { for Windows WideString the size is always a DWORD } current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit4))) else current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit0)+sizesinttype.size)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_minus))); - current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_deref))); + if upperopcodes=16 then begin + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_deref_size))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(4)); + end + else + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_deref))); { for widestrings, the length is specified in bytes, so divide by two } - if (upperopcodes=15) then + if (upperopcodes=16) then begin current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit1))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_shr))); |
|
Slowly, but surely I'm learning how the DWARF debug info is supposed to work. :P (though I did not see any difference in debugger behviour... *shrugs*) Thank you for the patch. Please test and close if okay. |
|
Works, thanks |
|
Unfortunately the patch missed something. And somehow so did my previous testing.... If upperopcodes=16 then there are more (or larger => more bytes) instructions appended to deref the result. But if the string is nil, all of those bytes must be skipped. The current value "skip 3" only works for upperopcodes<>16 See Patch --- Also this was merged to 3.2. So it would be good if the update could be merged too. |
|
dwarf3_widestring_skip_correction.diff (1,376 bytes)
*** y:/Temp/mtmp/dbgdwarf.pas-revBASE.svn001.tmp.pas Sun May 19 00:59:31 2019 --- B:/FPC/SVN/fixes_3_2/compiler/dbgdwarf.pas Sat Oct 12 20:37:27 2019 *************** *** 4279,4285 **** { yes -> length = 0 } current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit0))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_skip))); ! current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit_unaligned(3)); { no -> load length } if upperopcodes=16 then { for Windows WideString the size is always a DWORD } --- 4279,4288 ---- { yes -> length = 0 } current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit0))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_skip))); ! if upperopcodes=16 then ! current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit_unaligned(6)) ! else ! current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit_unaligned(3)); { no -> load length } if upperopcodes=16 then { for Windows WideString the size is always a DWORD } |
|
Can we have the patch in unified format, too? Thanks. |
|
Thanks for the patch, fixed. |
Date Modified | Username | Field | Change |
---|---|---|---|
2019-05-12 13:25 | Martin Friebe | New Issue | |
2019-05-12 13:25 | Martin Friebe | Status | new => assigned |
2019-05-12 13:25 | Martin Friebe | Assigned To | => Sven Barth |
2019-05-12 13:25 | Martin Friebe | File Added: widestring_fix_deref_size.patch | |
2019-05-12 13:25 | Martin Friebe | Relationship added | related to 0035386 |
2019-05-16 22:57 | Sven Barth | Status | assigned => resolved |
2019-05-16 22:57 | Sven Barth | Resolution | open => fixed |
2019-05-16 22:57 | Sven Barth | Fixed in Version | => 3.3.1 |
2019-05-16 22:57 | Sven Barth | Fixed in Revision | => 42087 |
2019-05-16 22:57 | Sven Barth | FPCTarget | => - |
2019-05-16 22:57 | Sven Barth | Note Added: 0116225 | |
2019-05-18 19:02 | Martin Friebe | Status | resolved => closed |
2019-05-18 19:02 | Martin Friebe | Note Added: 0116248 | |
2019-10-12 20:43 | Martin Friebe | Status | closed => feedback |
2019-10-12 20:43 | Martin Friebe | Resolution | fixed => reopened |
2019-10-12 20:43 | Martin Friebe | Note Added: 0118525 | |
2019-10-12 20:44 | Martin Friebe | File Added: dwarf3_widestring_skip_correction.diff | |
2019-10-13 05:16 | Cyrax | Note Added: 0118541 | |
2019-10-13 11:31 | Jonas Maebe | Status | feedback => resolved |
2019-10-13 11:31 | Jonas Maebe | Fixed in Revision | 42087 => 42087,43182 |
2019-10-13 11:31 | Jonas Maebe | Note Added: 0118554 | |
2019-10-13 18:09 | Martin Friebe | Status | resolved => closed |