<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Texte brut Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.5pt;
        font-family:Consolas;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Arial","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.TextebrutCar
        {mso-style-name:"Texte brut Car";
        mso-style-priority:99;
        mso-style-link:"Texte brut";
        font-family:Consolas;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=FR link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Hi,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I did some (very) little work on this in november, but didn’t
had time to get patch out. Some bit of information you could find interesting:<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>A mail from cfe-dev (response from chris):<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US>> I
started coding and have a few functionalities working but I hesitate <o:p></o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US>> between
two possible implementations.<o:p></o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US>><o:p> </o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US>> What I
started doing is:<o:p></o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US>><o:p> </o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US>> - Add
members and accessor functions to CodeGenModule and <o:p></o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US>>
CodeGenFuntion.<o:p></o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US>> - Insert
code directly in the code generating function of these class, <o:p></o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US>>
conditionnaly activated on a flag:<o:p></o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US><o:p> </o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US>I'd suggest
adding a new class, e.g. CodeGenDebugInfo that holds the debug related
information.  This is the model that llvm-gcc uses it it's llvm-convert.cpp and
llvm-debug.cpp files.  The nice thing about this is that you can then do stuff
like:<o:p></o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US><o:p> </o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US>void
CodeGenFunction::GenerateCode(const FunctionDecl *FD) { [...]<o:p></o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US><o:p> </o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US>  // Create
subprogram descriptor.<o:p></o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US>  if
(DebugInfo)<o:p></o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US>   
DebugInfo->CreateSubProgramDesc(...);<o:p></o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US><o:p> </o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US><o:p> </o:p></span></p>

<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-US>The nice
thing about this model is that it keeps the debug info emission code localized
in one file, while making the hooks into it obvious.<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-US><o:p> </o:p></span></p>

<p class=MsoPlainText><span lang=EN-US>Another mail, I wrote to llvm (without
answer):<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US><o:p> </o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>From the
implementation of DISerialiser, It seems to me I need to keep all my
 debug information object alive until the end of the compilation unit
(until the destruction/last use of the instance of DISerialiser). For example,
I would need to keep all the SubprogramDesc for all the functions from the
translation unit. Have I correctly understood?<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US><o:p> </o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>(the problem is
that the map of the serialized data is keyed by the address of the descriptor.
If the descriptor is deleted, a new (and different) descriptor could take the
same address and cause an hard to find bug. As far As I can see, the data
isn’t acceded after being serialized, so if not for the previous point,
it would be safe to delete the descriptor after use/serialization).<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-US><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>This make the lifetime management of the object harder. I had a
patch for changing this behavior, allowing us to delete the descriptor once  serialized,
but nobody seemed interested.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>And attached a  first try to add function definition debug
information. It is out of date and had never been working but you may find a
few interesting thing (I mostly copied a part of llvm gcc) [not llvm::scoped_ptr
has been renamed llvm::OwnedPtr or something like this since then].<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Regards,<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Cédric<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>De :</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
cfe-dev-bounces@cs.uiuc.edu [mailto:cfe-dev-bounces@cs.uiuc.edu] <b>De la part
de</b> Sanjiv.Gupta@microchip.com<br>
<b>Envoyé :</b> mercredi 23 avril 2008 11:42<br>
<b>À :</b> cfe-dev@cs.uiuc.edu<br>
<b>Objet :</b> [cfe-dev] Debug Info Generation in Clang.<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Hi,<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'>I
would like to use Clang front-end for our toolchain.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'>One
feature that we would like to see in Clang is the source level debugging
information generation.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'>What
is the latest state of clang debug info generation? Is anything being done
about it?<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'>If
yes, how can I contribute?<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'>If
not, I would like to take that up. What would be a good starting point? <o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Thanks,<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Sanjiv<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p> </o:p></span></p>

</div>

</div>

</body>

</html>