<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">So when launching a GDB server there are two flows:<div class=""><br class=""></div><div class="">1 - When you connect you already have a process</div><div class="">2 - You will connect, then launch or attach to a process</div><div class=""><br class=""></div><div class="">LLDB tries to see if there is a process by sending the "qfThreadInfo" packet. As you see below, it responds with on character "l" which means "end of the thread list". Since no thread IDs were returned, this makes LLDB believe that there is no process on the other end. So later when you try to say "process launch", it tries to send the "A" packet which tries to launch your program by sending the name of the process file to launch.</div><div class=""><br class=""></div><div class="">There was recently an OpenOCD patch to work around this with:</div><div class=""><br class=""></div><div class=""><a href="https://reviews.llvm.org/D37934" class="">https://reviews.llvm.org/D37934</a></div><div class=""><br class=""></div><div class="">This fixed this issue and also made it read both sets of registers via the XML target packets.</div><div class=""><br class=""></div><div class="">That should make things work, but it would be better if we modified the OpenOCD GDB server to respond with a thread ID when asked about its thread with the "qfThreadInfo" packet. Since it is a bare board connection, it should respond with "1" (one) to the "qfThreadInfo" packet followed by "l" to the next ThreadInfo packet (read GDB protocol docs on this.</div><div class=""><br class=""></div><div class="">Let me know if the patch mentioned above (which is already checked in) fixed your issues.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 17, 2017, at 3:50 AM, cui bixiong via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" class="">lldb-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family: simsun, serif; font-size: small;"><div class="gmail_default" style="font-family:arial,sans-serif"><font face="verdana, sans-serif" class="">Hi:</font></div><div class="gmail_default" style="font-family:arial,sans-serif"><font face="verdana, sans-serif" class=""><br class=""></font></div><div class="gmail_default" style="font-family:arial,sans-serif"><font face="verdana, sans-serif" class=""> Currently I porting lldb for Hifive1 (riscv bare board) w/ openocd 0.10.0, but it always show "error: Process must be launched."</font></div><div class="gmail_default" style="font-family:arial,sans-serif"><font face="verdana, sans-serif" class=""><br class=""></font></div><div class="gmail_default" style="font-family:arial,sans-serif"><font face="verdana, sans-serif" class=""> I use GNU gdb to remote connect and debugging w/ the same openocd + elf, it work OK.</font></div><div class="gmail_default" style="font-family:arial,sans-serif"><font face="verdana, sans-serif" class=""> </font></div><div class="gmail_default" style="font-family:arial,sans-serif"><font face="verdana, sans-serif" class=""> I want to know how to launch Process in bare board?</font></div><div class="gmail_default" style="font-family:arial,sans-serif"><font face="verdana, sans-serif" class=""><br class=""></font></div><div class="gmail_default" style="font-family:arial,sans-serif"><font face="verdana, sans-serif" class=""> thanks a lot!</font></div><div class="gmail_default" style="font-family:arial,sans-serif"><font face="verdana, sans-serif" class=""><br class=""></font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">$ lldb</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">(lldb) log enable gdb-remote packets</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">(lldb) target create Build3/riscv-hello.elf</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">Current executable set to 'Build3/riscv-hello.elf' (riscv).</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">(lldb) gdb-remote <a href="http://172.27.113.29:3333/" target="_blank" class="">172.27.113.29:3333</a></font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 1> send ack packet: +</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">history[1] tid=0x44c8 < 1> send packet: +</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 1> read packet: +</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 19> send SendPacketNoLock 2 packet: $QStartNoAckMode#b0</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 1> read packet: +</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 6> read packet: $OK#9a</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 1> send ack packet: +</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 41> send SendPacketNoLock 2 packet: $qSupported:xmlRegisters=i386,<wbr class="">arm,mips#12</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 80> read packet: $PacketSize=3fff;qXfer:memory-<wbr class="">map:read+;qXfer:features:read-<wbr class="">;QStartNoAckMode+#08</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 26> send SendPacketNoLock 2 packet: $QThreadSuffixSupported#e4</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 4> read packet: $#00</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 27> send SendPacketNoLock 2 packet: $QListThreadsInStopReply#21</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 4> read packet: $#00</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 13> send SendPacketNoLock 2 packet: $qHostInfo#9b</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 4> read packet: $#00</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 10> send SendPacketNoLock 2 packet: $vCont?#49</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 4> read packet: $#00</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 27> send SendPacketNoLock 2 packet: $qVAttachOrWaitSupported#38</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 4> read packet: $#00</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 16> send SendPacketNoLock 2 packet: $qProcessInfo#dc</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 4> read packet: $#00</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 6> send SendPacketNoLock 2 packet: $qC#b4</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 7> read packet: $QC0#c4</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 16> send SendPacketNoLock 2 packet: $qfThreadInfo#bb</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 5> read packet: $l#6c</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">(lldb) thread list</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">error: Process must be launched.</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">(lldb) b main</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">Breakpoint 1: where = riscv-hello.elf`main at hello.c:3, address = 0x20400230</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">(lldb) thread continue</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">error: invalid thread</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">(lldb) process launch</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 38> send SendPacketNoLock 2 packet: $QSetSTDIN:<wbr class="">2f6465762f7074732f343238#b6</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 4> read packet: $#00</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 39> send SendPacketNoLock 2 packet: $QSetSTDOUT:<wbr class="">2f6465762f7074732f343238#17</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 4> read packet: $#00</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 39> send SendPacketNoLock 2 packet: $QSetSTDERR:<wbr class="">2f6465762f7074732f343238#08</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 4> read packet: $#00</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 21> send SendPacketNoLock 2 packet: $QSetDisableASLR:1#ce</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 4> read packet: $#00</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 23> send SendPacketNoLock 2 packet: $QSetDetachOnError:1#f8</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 4> read packet: $#00</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 21> send SendPacketNoLock 2 packet: $QLaunchArch:riscv#8b</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 4> read packet: $#00</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 33> send SendPacketNoLock 2 packet: $QEnvironment:BINARY_TYPE_HPC=<wbr class="">#fd</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 4> read packet: $#00</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 115> send SendPacketNoLock 2 packet: $A104,0,<wbr class="">2f70726f6a2f6d746b31333836372f<wbr class="">727369632d762f74657374696e672f<wbr class="">4275696c64332f72697363762d6865<wbr class="">6c6c6f2e656c66#6c</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">< 4> read packet: $#00</font></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px"><font face="verdana, sans-serif" class="">error: process launch failed: 'A' packet returned an error: -1</font></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px" class=""><br class=""></div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:14px"><br class=""></div><div class="gmail_default" style="font-family:arial,sans-serif"><font face="verdana, sans-serif" class=""><br class=""></font></div><div class="gmail_default" style="font-family:arial,sans-serif"><font face="verdana, sans-serif" class="">Best Regards</font></div><div class="gmail_default" style="font-family:arial,sans-serif"><font face="verdana, sans-serif" class="">--cuibixiong</font></div></div></div>
_______________________________________________<br class="">lldb-dev mailing list<br class=""><a href="mailto:lldb-dev@lists.llvm.org" class="">lldb-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev<br class=""></div></blockquote></div><br class=""></div></body></html>