This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug translator/13420] prologue detection fails for function parameters in unoptimized (-g only, no -O) code
- From: "fche at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sourceware dot org
- Date: Thu, 26 Dec 2013 13:04:45 +0000
- Subject: [Bug translator/13420] prologue detection fails for function parameters in unoptimized (-g only, no -O) code
- Auto-submitted: auto-generated
- References: <bug-13420-6586 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=13420
--- Comment #5 from Frank Ch. Eigler <fche at redhat dot com> ---
By the way, the .debug_line pattern for a toy program that demonstrates this:
% cat ~/foo.c
int foo (int j)
{
printf("%d", j);
}
int main ()
{
int x = 5;
foo (x);
}
% gcc -g -o foo foo.c
% objdump -drs foo
[...]
0000000000400530 <foo>:
400530: 55 push %rbp
400531: 48 89 e5 mov %rsp,%rbp
400534: 48 83 ec 10 sub $0x10,%rsp
400538: 89 7d fc mov %edi,-0x4(%rbp)
40053b: 8b 45 fc mov -0x4(%rbp),%eax
40053e: 89 c6 mov %eax,%esi
400540: bf 00 06 40 00 mov $0x400600,%edi
400545: b8 00 00 00 00 mov $0x0,%eax
40054a: e8 c1 fe ff ff callq 400410 <printf@plt>
40054f: c9 leaveq
400550: c3 retq
% readelf -w foo
<1><2d>: Abbrev Number: 2 (DW_TAG_subprogram)
<2e> DW_AT_external : 1
<2e> DW_AT_name : foo
<32> DW_AT_decl_file : 1
<33> DW_AT_decl_line : 1
<34> DW_AT_prototyped : 1
<34> DW_AT_type : <0x6d>
<38> DW_AT_low_pc : 0x400530
<40> DW_AT_high_pc : 0x21
<48> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<4a> DW_AT_GNU_all_tail_call_sites: 1
<4a> DW_AT_sibling : <0x6d>
<2><4e>: Abbrev Number: 3 (DW_TAG_formal_parameter)
<4f> DW_AT_name : j
<51> DW_AT_decl_file : 1
<52> DW_AT_decl_line : 1
<53> DW_AT_type : <0x6d>
<57> DW_AT_location : 2 byte block: 91 6c (DW_OP_fbreg: -20)
[...]
Line Number Statements:
Extended opcode 2: set Address to 0x400530
Special opcode 6: advance Address by 0 to 0x400530 and Line by 1 to 2
Special opcode 160: advance Address by 11 to 0x40053b and Line by 1 to 3
Advance PC by constant 17 to 0x40054c
Special opcode 48: advance Address by 3 to 0x40054f and Line by 1 to 4
Special opcode 36: advance Address by 2 to 0x400551 and Line by 3 to 7
It is at instruction 0x40053b at which the location becomes accurate
(after %edi, the incoming parameter, is saved to the stack). stap's -P
algorithm stops looking at the special-opcode-6 part, where the line number
was incremented from 1 to 2, but the address wasn't changed.
--
You are receiving this mail because:
You are the assignee for the bug.