<div dir="ltr">Hi Ted,<div><br></div><div>Indeed, my lldb-server was returning the x86 triple.</div><div>I have managed to return the good triple by "hacking" the function "GDBRemoteCommunicationServerCommon::Handle_qHostInfo" to return my "ArchSpec" instead of going through the "HostInfo::GetArchitecture()" function.</div><div><br></div><div>I think my problem is more about how I added my architecture into lldb. I will start a new thread about it.</div><div><br></div><div>Thank you Ted for the answers, it was very helpful.</div><div>Romaric</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 13, 2019 at 6:38 PM Ted Woodward <<a href="mailto:tedwood@quicinc.com">tedwood@quicinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div class="gmail-m_-7934574149966314482WordSection1">
<p class="MsoNormal">Hi Romaric,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The call to Disassembler::FindPlugin should have arch set to your triple. If m_options.arch is not set on the disassembly command line, it will get it from the target:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">if</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> (!m_options.arch.IsValid())<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black"> m_options.arch
</span><span style="font-size:9.5pt;font-family:Consolas;color:teal">=</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> target->GetArchitecture();<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">That leads me to wonder if your triple is set correctly after you do the run. What is the output from these commands, when you’re stopped?:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">target list<u></u><u></u></p>
<p class="MsoNormal">platform status<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">My guess is you’re connected to a remote gdb-server on a simulator for dpu, and it’s telling lldb that the triple is x86_64.x.x.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">If target list says the arch is dpu before the run, and x86_64 after the run, we should look at the RSP log. Before the run, type<u></u><u></u></p>
<p class="MsoNormal">log enable -f <file> gdb-remote packets<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Attach the file to your next message.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Ted<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in 0in 4pt">
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b> Romaric Jodin <<a href="mailto:rjodin@upmem.com" target="_blank">rjodin@upmem.com</a>> <br>
<b>Sent:</b> Thursday, June 13, 2019 1:16 AM<br>
<b>To:</b> Ted Woodward <<a href="mailto:tedwood@quicinc.com" target="_blank">tedwood@quicinc.com</a>><br>
<b>Cc:</b> LLDB <<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>><br>
<b>Subject:</b> [EXT] Re: [lldb-dev] Disassembling issue<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hi Ted,<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Thank you for the answer.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I'm not sure I understand you well. It seems to me that my program call "Disassembler::FindPlugin" with the "m_options.arch" set to "x86_64". But my toolchain does not contain a LLVM supporting x86_64, so it feels normal to me that it is
not able to create this disassembler. What is weird is that the first time I'm executing it, it managed to do so.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I also have kind of the same issue with breakpoint. It's like if I'm missing the debug information after I do the "run" command:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<blockquote style="margin-left:30pt;margin-right:0in">
<div>
<p class="MsoNormal">(lldb) file test<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Current executable set to 'test' (dpu).<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">(lldb) b main<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Breakpoint 1: where = test`main + 24 at test.c:8, address = 0x80000078<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">(lldb) r<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Process 21312 launched: '/home/rjodin/work/dpu_tools/llvm/lldb/test/test' (dpu)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Process 21312 stopped<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">* thread #1, name = 'DPUthread0', stop reason = Thread finished<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> frame #0: 0x00000000800000c0<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">(lldb) b main<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Breakpoint 2: no locations (pending).<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">WARNING: Unable to resolve breakpoint to any actual locations.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</blockquote>
<p class="MsoNormal">When I'm doing the disassembly, I can manage to disassemble if I add the option with my architecture to the command line, but as you can see below, I also do not have the debug information that I had at the first disassembly:<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<blockquote style="margin-left:30pt;margin-right:0in">
<div>
<p class="MsoNormal">(lldb) file test<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Current executable set to 'test' (dpu).<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">(lldb) dis -s 0x80000000<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">test`__bootstrap:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">test[0x80000000] <+0>: jnz id, 0x80000020<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">test[0x80000008] <+8>: move r0, 0xff<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">test[0x80000010] <+16>: release r0, 0x0, nz, 0x80000018<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">test[0x80000018] <+24>: sub r0, r0, 0x1, pl, 0x80000010<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">(lldb) r<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Process 21312 launched: '/home/rjodin/work/dpu_tools/llvm/lldb/test/test' (dpu)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Process 21312 stopped<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">* thread #1, name = 'DPUthread0', stop reason = Thread finished<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> frame #0: 0x00000000800000a0<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">(lldb) dis -s 0x80000000<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">error: Unable to find Disassembler plug-in for the 'x86_64' architecture.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">(lldb) dis -s 0x80000000 -A dpu<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> 0x80000000: jnz id, 0x80000020<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> 0x80000008: move r0, 0xff<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> 0x80000010: release r0, 0x0, nz, 0x80000018<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> 0x80000018: sub r0, r0, 0x1, pl, 0x80000010<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</blockquote>
<p class="MsoNormal">Any ideas about it?<u></u><u></u></p>
<div>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Romaric<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Wed, Jun 12, 2019 at 6:55 PM Ted Woodward <<a href="mailto:tedwood@quicinc.com" target="_blank">tedwood@quicinc.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">The error is coming from source/Commands/CommandObjectDisassemble.cpp . It’s not able to create the disassembler for your architecture. The call to Disassembler::FindPlugin fails.<u></u><u></u></p>
<p class="MsoNormal">My guess is something in the call to MCDisasmInstance::Create in source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp is failing. Step through that and make sure everything there
is working.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Ted<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in 0in 4pt">
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b> lldb-dev <<a href="mailto:lldb-dev-bounces@lists.llvm.org" target="_blank">lldb-dev-bounces@lists.llvm.org</a>>
<b>On Behalf Of </b>Romaric Jodin via lldb-dev<br>
<b>Sent:</b> Wednesday, June 12, 2019 8:23 AM<br>
<b>To:</b> <a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a><br>
<b>Subject:</b> [EXT] [lldb-dev] Disassembling issue<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">Hi everyone,<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I'm trying to have lldb being able to debug my architecture. It does it well after loading my elf. But then I run it, stop it in middle, try to disassemble and at that point it
seems that I lost some information about my architecture. lldb tries to disassemble it for x86, which in not possible with my toolchain.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Here is a log of what I am doing:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<blockquote style="margin:5pt 0in 5pt 30pt">
<div>
<p class="MsoNormal">(lldb) file test<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Current executable set to 'test' (dpu).<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">(lldb) dis -s 0x80000000<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">test`__bootstrap:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">test[0x80000000] <+0>: jnz id, 0x80000020<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">test[0x80000008] <+8>: move r0, 0xff<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">test[0x80000010] <+16>: release r0, 0x0, nz, 0x80000018<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">test[0x80000018] <+24>: sub r0, r0, 0x1, pl, 0x80000010<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">(lldb) r<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Process 21312 launched: '/home/rjodin/work/dpu_tools/llvm/lldb/test/test' (dpu)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Process 21312 stopped<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">* thread #1, name = 'DPUthread0', stop reason = Thread stopped<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> frame #0: 0x0000000080000090<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">(lldb) dis -s 0x80000000<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">error: Unable to find Disassembler plug-in for the 'x86_64' architecture.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">(lldb)<u></u><u></u></p>
</div>
</blockquote>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Any ideas of what I am missing in my implementation?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
</div>
<p class="MsoNormal">--
<u></u><u></u></p>
<div>
<div>
<div>
<p class="MsoNormal"><b><span style="font-size:9.5pt;color:black">Romaric JODIN</span></b><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">UPMEM</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><i><span style="font-size:7.5pt;color:black">Software Engineer</span></i><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="color:rgb(136,136,136)"> </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="color:rgb(136,136,136)"><img border="0" width="50" height="50" style="width: 0.5208in; height: 0.5208in;" id="gmail-m_-7934574149966314482gmail-m_-7693231461788861330_x005f_x0000_i1025" src="cid:16b6ad785644cff311"></span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><br clear="all">
<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal">-- <u></u><u></u></p>
<div>
<div>
<div>
<p class="MsoNormal"><b><span style="font-size:9.5pt;color:black">Romaric JODIN</span></b><span style="color:rgb(136,136,136)"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">UPMEM</span><span style="color:rgb(136,136,136)"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><i><span style="font-size:7.5pt;color:black">Software Engineer</span></i><span style="color:rgb(136,136,136)"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:rgb(136,136,136)"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:rgb(136,136,136)"><img border="0" width="50" height="50" style="width: 0.5208in; height: 0.5208in;" id="gmail-m_-7934574149966314482_x0000_i1026" src="cid:16b6ad785644cff311"><u></u><u></u></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div style="color:rgb(136,136,136)"><span style="color:rgb(0,0,0);font-size:12.8px"><b>Romaric JODIN</b></span></div><div style="color:rgb(136,136,136)"><span style="color:rgb(0,0,0);font-size:12.8px">UPMEM</span></div><div style="color:rgb(136,136,136)"><font color="#000000" size="1"><i>Software Engineer</i></font></div><div style="color:rgb(136,136,136)"><br></div><div style="color:rgb(136,136,136)"><img src="cid:ii_jm7vnlj17_165ed4ff64757184" width="50" height="50"></div></div></div>