<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=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@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:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Courier New";}
span.pln
{mso-style-name:pln;}
span.pun
{mso-style-name:pun;}
.MsoChpDefault
{mso-style-type:export-only;}
@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="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Hello,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I’m having an issue setting breakpoints using lldb-mi.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I am trying to run a C++ program (which is itself a brainfsck interpreter), compiled for MIPS32r6 using Clang, linked with lld, and am trying to use lldb-mi as the debugger. I am using lldb-mi as my primary use for it is as an intermediary for a visual debugger, but I get the same behavior when using it myself.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Whenever I try to set a reasonable breakpoint at or below line #70 in Main.cpp, it works – it is resolved, it sends a Z0 packet to the gdb stub, and it works. However, when I attempt to set <i>any</i> breakpoint <i>above</i> line #70, it comes up as ‘unresolved’ (though the addresses shown in the list seem reasonable) and does not submit anything to the stub as a result.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>When I dumped the line table using both readelf and lldb, they were completely reasonable – almost every line until the end had an entry – there was no cut off at line #70.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>At this point, I’m unsure if I’m doing something wrong, or if lldb-mi is having some difficulty with my MIPS binary. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I’m building with the following options:<br><br><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>clang -std=c++14 -mcompact-branches=always -fasynchronous-unwind-tables -funwind-tables -fexceptions -fcxx-exceptions -mips32r6 -O0 -g -glldb ...<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>lld --discard-none -znorelro --eh-frame-hdr ...<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>And the resultant binary is here: <a href="http://filebin.ca/2tJzo2LLBJWO/MipsTest.bin">http://filebin.ca/2tJzo2LLBJWO/MipsTest.bin</a> (if you wish something to analyze).<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I’ve also uploaded the rather poor code for Main.cpp here: <a href="https://paste.ee/p/WYs8Y">https://paste.ee/p/WYs8Y</a><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I’ve also tested this on a second source file in the ELF (‘Recoder.cpp’) which stops working at a lower line number, but has similar behavior – there’s a hard cut-off where lldb stops working with breakpoints. The line table for that file also seems fine.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Just for example, when I set a breakpoint at or below 70 (note, I get the same behavior when not specifying -H):<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-left:.5in'>break set -H -f Main.cpp -l 70<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>(gdb)<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>=breakpoint-created,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000013488",func="main",file="Main.cpp",fullname="D:\Proj<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>ects\MipsTest2\MipsTest/Main.cpp",line="70",times="0",original-location="Main.cpp:70"}<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>(gdb)<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000013488",func="main",file="Main.cpp",fullname="D:\Pro<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>jects\MipsTest2\MipsTest/Main.cpp",line="70",times="0",original-location="Main.cpp:70"}<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>And this is what I see when I set a breakpoint after 70:<br><br><o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>break set -H -f Main.cpp -l 72<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>(gdb)<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>=breakpoint-created,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x00000000000134a0",func="main",file="Main.cpp",fullname="D:\Proj<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>ects\MipsTest2\MipsTest/Main.cpp",line="72",times="0",original-location="Main.cpp:72"}<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>However, the list looks as such:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-left:.5in'>break list<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>Current breakpoints:<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>1: file = 'Main.cpp', line = 70, exact_match = 0, locations = 1, resolved = 1, hit count = 1<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'> 1.1: where = MipsTest.bin`main + 520 at Main.cpp:70, address = 0x00013488, resolved, hit count = 1<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'><o:p> </o:p></p><p class=MsoNormal style='margin-left:.5in'>2: file = 'Main.cpp', line = 72, exact_match = 0, locations = 1<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'> 2.1: where = MipsTest.bin`main + 544 at Main.cpp:72, address = MipsTest.bin[0x000134a0], unresolved, hit count = 0<br><br><o:p></o:p></p><p class=MsoNormal>Note that the address seems completely reasonable but it remains unresolved, and does not submit anything to the stub.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks for any help or insight you might be able to provide,<o:p></o:p></p><p class=MsoNormal>Michael<o:p></o:p></p></div></body></html>