3

I'm trying to use lldb with openocd/jtag board but I'm in trouble. I already use openocd with gdb to develop on L0 STMicroelectronics board and it works perfectly. Now I want the same with lldb.

I do that on LLDB host side

$ lldb bin/token.elf 
(lldb) target create "bin/token.elf"
Current executable set to 'bin/token.elf' (arm).
(lldb) platform select remote-gdb-server
  Platform: remote-gdb-server
  Connected: no
(lldb) platform connect connect://localhost:5557
  Platform: remote-gdb-server
  Hostname: (null)
  Connected: yes
(lldb) target list 
Current targets:
* target #0: /home/cme/Projects/Tacos/ledger/trunk/se/build/st31_bolos/bin/token.elf ( arch=arm-unknown-unknown, platform=host )

On the openocd/GDB server side I correctly see the "Info : accepting 'gdb' connection on tcp/5557"

But now I don't found how to continue:

(lldb) process launch 
error: process launch failed: Child exec failed.

I also tried "process continue", but lldb complains there is no process

With gdb, the process is considered as already running and I use reset/continue commands, never the 'run' command.

Does anybody know how to use lldb with openocd/jtag gdb-server?

Thanks for your help

C/M.

cslashm
  • 253
  • 3
  • 5

2 Answers2

4

from what we were researching, it is not possible to debug remote (bare-metal!) targets with lldb without writing extra code.

for basic functionality, lldb needs to recognize at least one thread context. the same is true for gdb. But there in gdb there is some sort of stub implemented faking an existing thread on the remote system. [1]

from an conversation on the lldb mailing list [2] the answer compiles to: we have to write some (python) code to get a remote bare metal working with lldb.

[1] https://github.com/bminor/binutils-gdb/blob/28170b88cc8b40fdea2b065dafe6e1872a47ee4e/gdb/remote.c#L1808

[2] http://comments.gmane.org/gmane.comp.debugging.lldb.devel/3405

0

So far this works for me on my stm32g0b1 nucleo board and pyOCD but I also tested with OpenOCD

$ lldb --local-lldbinit Build/temp.elf
(lldb) target create "Build/temp.elf"
Current executable set to '/home/diego/Workspace/genesis/Buil /temp.elf' (arm).
(lldb) gdb-remote 127.0.0.1:3333
Process 1 stopped
(lldb) target modules load --load .text 0x08000000
section '.text' loaded at 0x8000000
(lldb) process plugin packet monitor reset halt
packet: qRcmd,72657365742068616c74
response: 526573657474696e672074617267657420776974682068616c740a5375636365737366756c6c792068616c74656420646576696365206f6e2072657365740a
Diego
  • 1
  • 1