View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0019466||FPC||Compiler||public||2011-06-03 00:28||2020-11-22 18:02|
|Reporter||Martin Friebe||Assigned To|
|Summary||0019466: Dwarf Stabs,line info not correct for line with "begin"|
|Description||This appears to happen for dwarf and stabs, with and with external linker.|
with the code below, line info is generated for the "begin" line (of TestMe).
At least "-symbol-list-lines p" does return info for that line.
However when single stepping the debugger will not stop on this line (a breakpoint will stop on the next line too)
Uncommenting the line "s := s +'a'" and it will work as expected.
Though even with the line commented (when the debugger does not stop on this line), code is generated for that line. From the assembler:
#  begin
# Var s located at ebp-4
.stabn 68,0,7,.Ll2 - P$PROJECT1_TESTME$ANSISTRING
#  writeln(s);
The problem occurs too with simplier code
But even this code has assembler instructions for the "begin" line.
Checking the disassembler of the actual produced exe, shows that the code was *not* inlined.
|Additional Information||program project1;|
procedure TestMe(s: string);
|Tags||No tags attached.|
|Fixed in Revision|
Further conversation on the mailinglist:
It may be that fpc is correct, and the issue is by "design" of gdb
I think the correct behaviour would be that the debugger never stops on the "begin" line itself. At that point, the function prologue hasn't been executed yet and hence most debug information will still be bogus (e.g. parameters won't be yet in their final destination).
Using temporary ansistrings (such as when concatenating strings) indeed adds code to the prologue that gdb does not recognize as belonging to the prologue (which is not really surprising, since it doesn't look different from other code), and hence cannot skip it automatically.
DWARFv3 has support for encoding the start/end of the function prologue and epilogue into the debug information, but FPC doesn't do this yet.
Just reviewing this, I believe this may be a gdb issue. Afaik gdb has some smart "prologue detection" => and this leads to the line being skipped.
Please feel free to close this issue, (not fixable)
We should at least try emitting a DW_LNS_set_prologue_end to fix this.
Edit: ah no, this is stabs. Not sure whether Stabs also has a prologue end marker.
|2011-06-03 00:28||Martin Friebe||New Issue|
|2011-06-08 13:04||Martin Friebe||Relationship added||related to 0015719|
|2011-06-08 13:05||Martin Friebe||Note Added: 0048955|
|2011-06-09 00:26||Jonas Maebe||Note Added: 0048979|
|2011-06-15 10:55||Jonas Maebe||Note Edited: 0048979|
|2020-11-22 17:58||Martin Friebe||Note Added: 0127113|
|2020-11-22 18:01||Jonas Maebe||Note Added: 0127114|
|2020-11-22 18:02||Jonas Maebe||Note Edited: 0127114||View Revisions|