This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug c++/21222] A function with a particular number of arguments corrupts a value calculated on the stack when stepping through the function
- From: "kungfujesus06 at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Fri, 10 Mar 2017 21:28:12 +0000
- Subject: [Bug c++/21222] A function with a particular number of arguments corrupts a value calculated on the stack when stepping through the function
- Auto-submitted: auto-generated
- References: <bug-21222-4717@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=21222
--- Comment #8 from Adam Stylinski <kungfujesus06 at gmail dot com> ---
(In reply to Keith Seitz from comment #7)
> As you note, this is likely a display problem.
>
> So the next question is, what does "info addr lambda" say? I wonder if the
> debug info is incorrect.
>
> On my system (which does not support VEX):
>
> 12 float lambda = C_LIGHT / f;
> (gdb) n
> 13 printf("lambda = %f\n", lambda);
> (gdb) p lambda
> $1 = 0.031557098
> (gdb) info addr lambda
> Symbol "lambda" is a complex DWARF expression:
> 0: DW_OP_fbreg -20
> .
> (gdb) inf frame
> Stack level 0, frame at 0x7fffffffd990:
> rip = 0x400679 in testFunc (21222.cc:13); saved rip = 0x4006dd
> called by frame at 0x7fffffffd9d0
> source language c++.
> Arglist at 0x7fffffffd980, args: a=0x0, n=0, sx=0x0, sy=0x0, rc=0x0, nr=0,
> b=4, f=9.50000026e+09, c=0x0, d=0x0, e=0x0, gx=0x0, gy=0x0
> Locals at 0x7fffffffd980, Previous frame's sp is 0x7fffffffd990
> Saved registers:
> rbp at 0x7fffffffd980, rip at 0x7fffffffd988
> (gdb) p *(float*)(0x7fffffffd990-20)
> $2 = 0.031557098
>
> What compiler/version are you using?
I'm using g++ 6.3.1. I believe this is more than a display issue, as if I
attach the debugger here when the binary performs the printf I see the
corrupted value. There's definitely something going on with GDB & VEX
instructions (this doesn't happen if using the legacy SSE ones).
Breakpoint 1, testFunc (a=0x0, n=0, sx=0x0, sy=0x0, rc=0x0, nr=0, b=4,
f=9.50000026e+09, c=0x0, d=0x0, e=0x0, gx=0x0, gy=0x0) at testfunc.cpp:12
12 float lambda = C_LIGHT / f;
(gdb) n
13 printf("lambda = %f\n", lambda);
(gdb) info addr lambda
Symbol "lambda" is a complex DWARF expression:
0: DW_OP_fbreg -20
.
(gdb) inf frame
Stack level 0, frame at 0x7fffffffde80:
rip = 0x400562 in testFunc (testfunc.cpp:13); saved rip = 0x4005c6
called by frame at 0x7fffffffdec0
source language c++.
Arglist at 0x7fffffffde70, args: a=0x0, n=0, sx=0x0, sy=0x0, rc=0x0, nr=0,
b=4, f=9.50000026e+09, c=0x0, d=0x0, e=0x0, gx=0x0, gy=0x0
Locals at 0x7fffffffde70, Previous frame's sp is 0x7fffffffde80
Saved registers:
rbp at 0x7fffffffde70, rip at 0x7fffffffde78
(gdb) p *(float*)(0x7fffffffde80 - 20)
$1 = -5.38359187e+25
--
You are receiving this mail because:
You are on the CC list for the bug.