[LLVMdev] Problem with x86 32-bit debug information ?

James Molloy james.molloy at arm.com
Wed Mar 7 06:24:57 PST 2012


Hi Seb,

 

I'm going to reiterate - Clang can decide when it wants to optimise away a
variable. You asked for that behaviour when you specified -O2. You can't
expect deterministically the same behaviour on both x86 and x86-64 platforms
- the procedure call standards are different and different decisions go in
to deciding how to optimise.

 

You can't expect debug information for an optimised build to fully track
that of the source because by definition the source is being modified to
optimise.

 

Cheers,

 

James

 

From: Seb [mailto:babslachem at gmail.com] 
Sent: 07 March 2012 13:37
To: James Molloy
Cc: llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] Problem with x86 32-bit debug information ?

 

Hi James,

clang is able to generate correct debug informations for 64-bit target at
-O2. My feeling, given some other experiments I've done,  is that debug
information generated for x86 32-bit might be broken for parameters as long
as they are not 'homed' in the code (local copy to an automatic variable).
It seems that when llvm.declare is turned into a llvm.value for parameter
there is something incorrect with respect to parameters debug informations
that is generated by clang/llvm. I just would like confirmation of this.

Thanks for your answer
Best Regards
Seb

2012/3/7 James Molloy <james.molloy at arm.com>

Hi Seb,

 

Clang cannot generate debug information for something that it has optimised
away. You should reduce the optimisation level.

 

In general debug information is only really accurate at -O0.

 

Cheers,

 

James

 

From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On
Behalf Of Seb
Sent: 07 March 2012 13:17
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] Problem with x86 32-bit debug information ?

 

Hi all,

I'm using trunk version of LLVM/CLANG.
When I compile attached files on my 64-bit Ubuntu 10.04 LTS system as
follows:

clang -O2 -g check.c main.c -o check64

When I do gdb check64 and set a breakpoint to the check routine and executes
to the breakpoint, I've got:

Breakpoint 1, check (result=0x601110, expect=0x601020, n=53) at check.c:7
7    {

As you can see I can inspect 'n' value.

Now if I compile for x86 32-bit as follows:

clang -m32 -O2 -g check.c main.c -o check32

When I do gdb check32 and set a breakpoint to the check routine and executes
to the breakpoint, I've got:

Breakpoint 1, check (result=<value optimized out>, 
    expect=<value optimized out>, n=0) at check.c:7
7    {

As you can see I can NOT inspect 'n' value. Is there a way to inforce even
at -O2 clang to generate debug informations so that I can inspect 'n' value
?
Or is it a BUG from clang for x86 32-bit ?
Thanks for your answers.
Best Regards
Seb

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120307/ddccedab/attachment.html>


More information about the llvm-dev mailing list