This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug debug/49382] New: -O2 -g: DW_AT_location at the very first PC is already modified
- From: "jan.kratochvil at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 12 Jun 2011 11:14:53 +0000
- Subject: [Bug debug/49382] New: -O2 -g: DW_AT_location at the very first PC is already modified
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49382
Summary: -O2 -g: DW_AT_location at the very first PC is already
modified
Product: gcc
Version: 4.5.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jan.kratochvil@redhat.com
CC: jakub@gcc.gnu.org
Target: x86_64-unknown-linux-gnu
int i;
void __attribute__((noinline, noclone))
clobber (int x)
{
i = x;
}
void __attribute__((noinline, noclone))
func (int x)
{
clobber (x++);
i = 1; /* line 11 */
}
int main (void) { func (5); return 0; }
gcc -c -Wall -g -O2
PASS gcc (GCC) 4.4.7 20110611 (prerelease)
FAIL gcc (GCC) 4.5.4 20110612 (prerelease)
FAIL gcc (GCC) 4.6.1 20110612 (prerelease)
FAIL gcc (GCC) 4.7.0 20110612 (experimental)
<1><5c>: Abbrev Number: 2 (DW_TAG_subprogram)
<5e> DW_AT_name : (indirect string, offset: 0x3d): func
<65> DW_AT_low_pc : 0x10
<6d> DW_AT_high_pc : 0x20
<2><7c>: Abbrev Number: 5 (DW_TAG_formal_parameter)
<7d> DW_AT_name : x
<85> DW_AT_location : 0x0 (location list)
FAIL:
Offset Begin End Expression
000000 00000000000010 0000000000000014 (DW_OP_breg5 (rdi): 1;
DW_OP_stack_value)
000000 <End of list>
+
0000000000000010 <func>:
void __attribute__((noinline, noclone))
func (int x)
{
clobber (x++);
10: e8 00 00 00 00 callq 15 <func+0x5>
11: R_X86_64_PC32 clobber-0x4
PASS:
Offset Begin End Expression
000000 00000000000010 0000000000000015 (DW_OP_reg5 (rdi))
000000 <End of list>
One should see X and not X + 1.
(gdb) break *func
Breakpoint 1 at 0x400480: file /home/jkratoch/t/entrypc.c, line 10.
(gdb) run
FAIL:
Breakpoint 1, func (x=6) at /home/jkratoch/t/entrypc.c:10
PASS:
Breakpoint 1, func (x=5) at /home/jkratoch/t/entrypc.c:10
Also at the very first PC one needs to know the register to match it
DW_TAG_GNU_call_site_parameter->DW_AT_location in the caller.