armembeddedlldbcortex-mopenocd

How to setup LLDB with "openocd and JTAG board"


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.


Solution

  • 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