Hi James,<br><br>I fully agree with you and understand your statement about -O2.<br><br>Now some questions for you:<br>Did you try to reproduce experiments described in my previous e-mail ?<br>Did you look at debug informations generated for 'n' parameter on x86 32-bit & x86 64-bit ?<br>
I'm working on my own front-end for LLVM and I had difficulties with debug information when they are related to x86 32-bits. So far there are two options:<br>1) metadata that I generate are incorrect.<br>2) LLVM is not handling in a correct manner those metadata for x86 32-bit target.<br>
I've already posted problem related to metadata that I generate and they are in LLVM 2.9 format. I've been adviced to move to most recent format. Before starting any move into that direction, I would like to be sure that LLVM trunk could solve the problem. Using clang at -O2 -g is giving me some indication that it won't solve my problem and that we are failing into option (2). <br>
So to summarize, I would be nice if someone can confirm that debug informations generated on this specific case are correct for x86 32-bit and that I would have to deal with that.<br><br>Thanks<br>Best Regards<br>Seb<br><br>
<div class="gmail_quote">2012/3/7 James Molloy <span dir="ltr"><<a href="mailto:james.molloy@arm.com">james.molloy@arm.com</a>></span><br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">









<div link="blue" vlink="purple" lang="EN-GB">

<div>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)">Hi Seb,<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)">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.<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)">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.<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)">Cheers,<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)">James<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)"><u></u> <u></u></span></p>

<div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(181,196,223) -moz-use-text-color -moz-use-text-color;padding:3pt 0cm 0cm">

<p class="MsoNormal"><b><span style="font-size:10pt;font-family:"Tahoma","sans-serif"" lang="EN-US">From:</span></b><span style="font-size:10pt;font-family:"Tahoma","sans-serif"" lang="EN-US"> Seb [mailto:<a href="mailto:babslachem@gmail.com" target="_blank">babslachem@gmail.com</a>] <br>

<b>Sent:</b> 07 March 2012 13:37<br>
<b>To:</b> James Molloy<br>
<b>Cc:</b> <a href="mailto:llvmdev@cs.uiuc.edu" target="_blank">llvmdev@cs.uiuc.edu</a><br>
<b>Subject:</b> Re: [LLVMdev] Problem with x86 32-bit debug information ?<u></u><u></u></span></p>

</div><div><div class="h5">

<p class="MsoNormal"><u></u> <u></u></p>

<p class="MsoNormal" style="margin-bottom:12pt">Hi James,<br>
<br>
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.<br>
<br>
Thanks for your answer<br>
Best Regards<br>
Seb<u></u><u></u></p>

<div>

<p class="MsoNormal">2012/3/7 James Molloy <<a href="mailto:james.molloy@arm.com" target="_blank">james.molloy@arm.com</a>><u></u><u></u></p>

<div>

<div>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)">Hi
Seb,</span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)"> </span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)">Clang
cannot generate debug information for something that it has optimised away. You
should reduce the optimisation level.</span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)"> </span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)">In
general debug information is only really accurate at –O0.</span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)"> </span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)">Cheers,</span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)"> </span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)">James</span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)"> </span><u></u><u></u></p>

<div style="border-width:1pt medium medium;border-style:solid none none;padding:3pt 0cm 0cm;border-color:-moz-use-text-color">

<p class="MsoNormal"><b><span style="font-size:10pt;font-family:"Tahoma","sans-serif"" lang="EN-US">From:</span></b><span style="font-size:10pt;font-family:"Tahoma","sans-serif"" lang="EN-US"> <a href="mailto:llvmdev-bounces@cs.uiuc.edu" target="_blank">llvmdev-bounces@cs.uiuc.edu</a>
[mailto:<a href="mailto:llvmdev-bounces@cs.uiuc.edu" target="_blank">llvmdev-bounces@cs.uiuc.edu</a>]
<b>On Behalf Of </b>Seb<br>
<b>Sent:</b> 07 March 2012 13:17<br>
<b>To:</b> <a href="mailto:llvmdev@cs.uiuc.edu" target="_blank">llvmdev@cs.uiuc.edu</a><br>
<b>Subject:</b> [LLVMdev] Problem with x86 32-bit debug information ?</span><u></u><u></u></p>

</div>

<div>

<div>

<p class="MsoNormal"> <u></u><u></u></p>

<p class="MsoNormal" style="margin-bottom:12pt">Hi all,<br>
<br>
I'm using trunk version of LLVM/CLANG.<br>
When I compile attached files on my 64-bit Ubuntu 10.04 LTS system as follows:<br>
<br>
clang -O2 -g check.c main.c -o check64<br>
<br>
When I do gdb check64 and set a breakpoint to the check routine and executes to
the breakpoint, I've got:<br>
<br>
Breakpoint 1, check (result=0x601110, expect=0x601020, n=53) at check.c:7<br>
7    {<br>
<br>
As you can see I can inspect 'n' value.<br>
<br>
Now if I compile for x86 32-bit as follows:<br>
<br>
clang -m32 -O2 -g check.c main.c -o check32<br>
<br>
When I do gdb check32 and set a breakpoint to the check routine and executes to
the breakpoint, I've got:<br>
<br>
Breakpoint 1, check (result=<value optimized out>, <br>
    expect=<value optimized out>, n=0) at check.c:7<br>
7    {<br>
<br>
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 ?<br>
Or is it a BUG from clang for x86 32-bit ?<br>
Thanks for your answers.<br>
Best Regards<br>
Seb<u></u><u></u></p>

</div>

</div>

</div>

</div>

</div>

<p class="MsoNormal"><u></u> <u></u></p>

</div></div></div>

</div>

</blockquote></div><br>