<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;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 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"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi Muhui,<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">It is quite likely that the indirect branch instruction (at IR or MIR level) was created without an explicit source location, and because it is its own basic
 block, it was given line 0 when the object code was emitted. I suspect some pass didn't really consider that the indirect branch would be treated as its own basic block, and simply didn't bother to add a source location when it should have. Naively it should
 have the same source location as the conditional branch.<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">Offhand I don't know where the decision to use a jump table is made, but once you find the pass that introduces this pattern it should be fairly easy to see
 how to fix 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"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr<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>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> llvm-dev [mailto:llvm-dev-bounces@lists.llvm.org]
<b>On Behalf Of </b>Muhui Jiang via llvm-dev<br>
<b>Sent:</b> Tuesday, January 22, 2019 8:00 AM<br>
<b>To:</b> llvm-dev<br>
<b>Subject:</b> [llvm-dev] Dwarf debugging information lost<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<div>
<p class="MsoNormal">Hi<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Below is a snippet of binary codes and the binary is compiled by clang with flag gdwarf-3. It is easy to see  that 0x912c is an indirect jump and instruction 0x9128 and 0x912c would be together as a basic block<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">.text:0000911C loc_911C                                ; CODE XREF: main+7F4 j<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">.text:0000911C                 SUB             R0, R0, #1<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">.text:00009120                 CMP             R0, #3  ; switch 4 cases<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">.text:00009124                 BHI             loc_9218 ; jumptable 0000912C default case<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">.text:00009128                 ADR             R1, off_9130<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">.text:0000912C                 LDR             PC, [R1,R0,LSL#2] ; switch jump<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">.text:00009130 off_9130        DCD loc_9778            ; DATA XREF: main+818 o<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">.text:00009130                 DCD loc_9108            ; jump table for switch statement<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">.text:00009130                 DCD loc_9778<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">.text:00009130                 DCD loc_9140<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I use llvm-dwarfdump -debug-line to dump the debug information. However, I find the related output below.0x912c is not described while the line of 0x9128 is zero, which does not help.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">  542 0x0000000000009108      0      0      3   0             0<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  543 0x000000000000911c    474      4      3   0             0<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  544 0x0000000000009128      0      4      3   0             0<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  545 0x0000000000009140    511     45      3   0             0  is_stmt<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I find nearly all the instructions that are indirect jumps would not be described by the dwarf debugging information. Anyone know the reason? Any comments or suggestions are welcome. Many Thanks<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Regards<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Muhui<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>