<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=utf-8">
<meta name="Generator" content="Microsoft Word 14 (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:0in;
        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;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></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="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal" style="margin-left:.5in">In fact, for dumping a .debug_line.dwo, the unit should *not* be needed.  A .dwo doesn't have any addresses in it, and won't be v2, so all it needs to know is the 32/64 format, which is in the line-table header.<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:4.8pt"><br>
Hmm, so why do we pass in the pointer size to it at all? Guess that should be fixed.<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></a></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Well, true.  It needs a minor tweak to an assertion but for .dwo we don't need to pass it.<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" style="margin-left:4.8pt">Could you summarize any of the issues you hit trying to move the string section handles out of the DWARFUnit? I'd have thought they could readily go into (or already be present in) the DWARFContext?<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><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 style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">They are not in DWARFContext currently, although they can be retrieved from the DWARFObject and DWARFContext has a handle on the DWARFObject.<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 style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">One problem is that you have both normal and DWO string sections, and the DWARFUnit constructor was handed the relevant one, which means it's just "the string
 section" from the unit's perspective.  When the line table parser has the appropriate unit, there are no decisions left to make; FORM_strp points to "the string section," end of story.  If the line table parser has the context instead of the unit, and we want
 it to pick the right string section, the parser then has to know whether it's a normal or DWO line table.  The line tables themselves don't know this about themselves, so the caller has to tell the parser up front.<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 style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">And, when we're trying to extract a string (e.g. a pathname), the line-table parser defers to DWARFFormValue, which is expecting… a unit.  Because, for some
 forms, DWARFFormValue actually does need the unit (which normally it would have, because normally it's decoding a unit, not a line table).  And when the line-table parser wants to extract the string for a pathname, it doesn't want to be deciding which FormValue
 API to use (one that takes a unit, or one that doesn't) based on the form; the line-table parser doesn't want to know about forms at all.  That's what FormValue is for!  But, if the line-table header was produced using DW_FORM_strx, then the line-table parser
 really does need the actual unit, because FORM_strx is relative to a base offset in the compile unit.  Or at least, the parser needs string info that is aware of the base offset that came from the unit.<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 style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">So, yes, sometimes we don't need the unit in order to decode the line table, or at least the line table header.  But sometimes we do, depending on decisions
 made by the producer, and sometimes we do, because it simplifies the class APIs when somebody higher up the chain has packaged all the right stuff into one place.  Somewhere in there I can imagine there's an API that splits out the appropriate string info,
 just like FormParams got split out, without making life miserable for all the callers; but I haven't found it yet.</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><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 style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Who hopes this doesn't come across as all whiny.<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>
</div>
</body>
</html>