dwarf debug info line number information wrong
Original Reporter info from Mantis: tom_at_work
-
Reporter name: Thomas Schatzl
Original Reporter info from Mantis: tom_at_work
- Reporter name: Thomas Schatzl
Description:
Compile the following program with -ghl:
{$mode objfpc} {$H+}
uses fgl,sysutils;
const strs : array[0..14] of integer = (1,2,2,7,0,12,3,4,5,3,6,7,8,9,0);
type
TInterestingData = integer;
TMySet = specialize TFPGmap<integer, TInterestingData>;
function mycompare(const a,b : integer) : integer;
begin
result := a-b;
end;
var
s : TMySet;
idx, i,j : Integer;
b : TInterestingData;
begin
s := TMySet.Create(); s.sorted := false;
s.OnCompare := @mycompare;
for i := low(strs) to high(strs) do begin
idx := s.IndexOf(strs[i]);
if (idx <> -1) then begin
b := s[strs[i]];
end else begin
b := i;
s[strs[i]] := b;
end;
// do something with existing interesting data
writeln(b * b);
end;
s.Free;
end.
It crashes (although it shouldn't, but this is another problem) with the following output:
0
1
4
9
16
25
36
49
64
9
100
49
144
169
An unhandled exception occurred at $000000001000061C :
EAccessViolation : Access violation<br/>
$000000001000061C line 900 of test.pas
$0000000010000D9C line 28 of test.pas
$00000000100003CC
[...]
Clearly there is no line 900 in test.pas; seems to be a problem with the generics used. Note that the objdump output also gives the same
objdump -g -W ./test
gives the following errors:
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Warning: Unable to locate entry 7 in the abbreviation table
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Error: DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8
objdump: Warning: Unable to locate entry 7 in the abbreviation table
objdump: ./test: no recognized debugging information
(I think the errors are because it's a 32 bit program)
However gdb gives the following error:
$ gdb test
GNU gdb 6.4.90-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "powerpc64-unknown-linux-gnu"...Dwarf Error: Could not find abbrev number 7 [in module /home/thomas/source/fpc/fixing/test]
Hence debug information seems to be unusable for debugging.
Mantis conversion info:
- Mantis ID: 9671
- Version: 2.3.1
- Fixed in version: 2.6.0
- Fixed in revision: 14525 (#3fa46810)