<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;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-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;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
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 style='text-indent:35.4pt'>Hi,<o:p></o:p></p>

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

<p class=MsoNormal><span lang=EN-US>   I am trying to add debugging information
to a front-end. Following the example off llvm-gcc, I pretty much understood
how MachineModuleInfo work but I have a question about the lifetime of the
debug object.<o:p></o:p></span></p>

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

<p class=MsoNormal><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><span lang=EN-US><o:p> </o:p></span></p>

<p class=MsoNormal><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=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US>This is a little inefficient from a memory
stand point, but not so much since the debug info shouldn’t take so much
space after all. But from the easiness to use (and to help writing bug free
program) wouldn’t it be simpler not too impose those restriction?<o:p></o:p></span></p>

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

<p class=MsoNormal><span lang=EN-US>I think that a small change could
accomplish this (cf patch). This patch isn’t really tested (I just
verified that it compile) and is only an idea, perhaps I am totally wrong (didn’t
take the time to understand all of MachineModuleInfo.cpp). It cost an unsigned
per Descriptor. Perhaps this solution is no better.<o:p></o:p></span></p>

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

<p class=MsoNormal><span lang=EN-US>(in fact I was just lazy and didn’t
want to keep a list of all my descriptor for cleanup at the end :S) <o:p></o:p></span></p>

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

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

<p class=MsoNormal><span lang=EN-US>Cédric Venet<o:p></o:p></span></p>

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

</div>

</body>

</html>