[LLVMdev] Value of structure passed byval to a recurse function not initialized when accessed through GDB
Richard.Relph at amd.com
Tue Dec 4 07:56:30 PST 2012
At what point within recurse() are you asking gdb to display the value of argument a?
What I'm wondering about is if the debug information gdb is using to get at a might not be correct at the particular point you are checking a, particularly if that is before the prolog has completed execution.
The way debug information for arguments pushed on the stack is represented in DWARF requires some effort to get right at every instruction boundary, and the fact that what's being passed is a structure, but one that is less than an integer in size, may be exposing a bug in DWARF generation, not code generation.
Just a thought.
On Dec 4, 2012, at 5:34 AM, Karthik Bhat <karthikthecool at gmail.com> wrote:
> Hi All,
> I was debugging a clang binary when i found this problem. The
> following code is complied with clang.
> typedef struct s
> short s;
> } SVAL;
> void recurse (SVAL a, int depth)
> a.s = --depth;
> if (depth == 0)
> int main ()
> SVAL s; s.s = 5;
> recurse (s, 5);
> return 0;
> When i try to access value of a.s in function recurse through gdb(i.e
> gdb > p a.s) it gives me an uninitialized value.
> The problem occurs only when we have a function call within function
> to which we have passed a structure.
> Could someone guide me were can i look to fix this issue.
> I have started with LowerFormalArguments in X86ISelLowering.cpp file.
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
More information about the llvm-dev