lldb-tools / lldb-mi

LLDB's machine interface driver
https://lldb.llvm.org
Other
162 stars 53 forks source link

lldb-mi does not implement gdb cwd interface causing vscode to debug from the wrong location #83

Closed newdigate closed 2 years ago

newdigate commented 3 years ago

I am running lldb via vscode's cppdbg. Although I am specifying the current working directory in my vscode settings, to debug from, when I use lldb, my application is debugged running from the path where the executable resides, instead of the directory I've specified.

I have raised this issue with vscode-cpptools. It is believed that this is potentially an issue/improvement with llvm mi, as per https://github.com/microsoft/vscode-cpptools/issues/8052

when debugging using lldb and I run '-exec "show cwd"' in vscode's debug console, I get "error: 'show' is not a valid command. ", which indicates that lldb does not implement this feature.

Could you point me in the right direction so I could possibly implement this gdb MI interface to change cwd when debugging?

Many thanks.

tkrasnukha commented 2 years ago

"show cwd" is not a correct LLDB command, the correct one is "platform shell pwd". You can set an alias for it to have the same caller code for GDB and LLDB:

However, users are free to customize lldb’s command set however they like, and since lldb reads the file ~/.lldbinit at startup, you can store all your aliases there and they will be generally available to you. Your aliases are also documented in the help command so you can remind yourself of what you’ve set up.