View Issue Details

IDProjectCategoryView StatusLast Update
0038117FPCCompilerpublic2020-11-23 04:09
ReporterMartin Friebe Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
PlatformWin 32 bitOSWin 
Product Version3.2.0 
Summary0038117: line info for not-called procedure always at address 0x0 (dwarf and stabs)
DescriptionSee the example code from 0038104

If a function is included (NO smart linking / not smart linkable), but the function is not called, then line info is generated.

- For dwarf the line info will be at 0x0 (for each function / so probably not missing relocation, as that would lead to addresses some bytes above 0x0)
- For stabs there is also line info, but no function info or address for the function.


It appears that the linker (build in, and also -Xe) is removing the code for those functions (at least they do not appear when disassembling, or at least not right after the included procedure (as -al would suggest)).
Actually,
- for stabs line info is removed, except for the nested procedure (the containing outer procedure's lines are omitted)
- for dwarf all line info is kept

If the function is removed line info should be removed too.
Otherwise it should have a correct address.
Steps To ReproduceThe code from issue 0038104
dwarf
CU: unit2.pas:
File name Line number Starting address
unit2.pas 20 0x426180
unit2.pas 21 0x426181
unit2.pas 24 0 // P2
unit2.pas 25 0x1
unit2.pas 33 0 // P3
unit2.pas 34 0x1
unit2.pas 30 0 // P3_1
unit2.pas 31 0x7


stabs
15 FUN 0 19 00424a40 133 P1:F1
16 SOL 0 0 00424a40 139 unit2.pas
17 SLINE 0 20 00000000 0
18 SLINE 0 21 00000001 0
19 LBRAC 0 0 00000000 0
20 RBRAC 0 0 00000003 0
21 RSYM 0 29 00000000 149 parentfp:R2
22 PSYM 0 29 fffffffc 161 parentfp:2
23 SLINE 0 30 00000000 0
24 SLINE 0 31 00000007 0
25 LBRAC 0 0 00000000 0
==There should also be
22 FUN 0 23 00424a50 149 P2:F1
23 SOL 0 0 00424a50 155 unit2.pas
24 SLINE 0 24 00000000 0
25 SLINE 0 25 00000001 0
and more

Additional InformationIn the related issue 0038104 GDB only gets the line info wrong, with stabs AND if FPC omits that following lines belong to a new function.

With stabs: Adding a function call, and generating proper info, and gdb will stop correctly.
With dwarf: stepping is not affected, but disassembling will not show line info for the addresses
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Relationships

related to 0038104 resolvedMartin Friebe Lazarus Debugger doesn't work correctly when using local procedures, jumps to a wrong line number in this unit using f7. 

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2020-11-23 04:09 Martin Friebe New Issue
2020-11-23 04:09 Martin Friebe Relationship added related to 0038104