embedded-in-rust icon indicating copy to clipboard operation
embedded-in-rust copied to clipboard

quickstart.md lldb

Open etrombly opened this issue 7 years ago • 3 comments

In the quickstart post you mention lldb not having a load command. For a workaround for devices that support st-link you can use st-flash to load. You have to use arm-none-eabi-objcopy to convert the elf to a bin first, but it's pretty easy to automate with a makefile or script.

etrombly avatar May 25 '17 08:05 etrombly

Thanks for the info. Some questions: Can you continue with the debug session when you flash the binary externally? Do you have instructions (lldb commands) that I could try?

japaric avatar May 25 '17 21:05 japaric

Just gave it a try, looks like it's still not working due to the issue here https://stackoverflow.com/questions/36287351/how-to-setup-lldb-with-openocd-and-jtag-board

Here's a thread with some info on how to fix it. http://comments.gmane.org/gmane.comp.debugging.lldb.devel/3405 Looks like nobody's submitted anything official though.

etrombly avatar May 26 '17 03:05 etrombly

Hey there!

I got it working on my stm32f4x based discovery board. I used openocd to connect to my stlinkv2-1, and then arm-none-eabi-gdb to load the program and set up the debugger.

break main
load
stepi
monitor arm semihosting enable
detach
quit

After loading the program with gdb, I connect with rust-lldb:

target create target/thumbv7em-none-eabihf/debug/hello-world
gdb-remote localhost:3333

It even works with the vscode-lldb plugin in vscode, and the experience is great. It shows all the registers of the MC grouped in the UI, and I can even modify register values etc...

Here is my .vscode/launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "lldb",
            "request": "custom",
            "name": "Custom launch",
            "targetCreateCommands": [
                "target create ${workspaceFolder}/target/thumbv7em-none-eabihf/debug/hello-world"
            ],
            "processCreateCommands": [
                "gdb-remote localhost:3333"
            ],
            "sourceLanguages": [
                "rust"
            ]
        }
    ]
}

ruabmbua avatar Oct 17 '18 22:10 ruabmbua