epheien / termdbg

Terminal debugger for vim
MIT License
25 stars 5 forks source link

Unable to find files in other directories with lldb #2

Closed minego closed 4 years ago

minego commented 4 years ago

If I step into a function while debugging in lldb the frame line is printed, which is matched by the locate_pattern in the plugin and the correct source is displayed, unless that source file is not in vim's current working directory.

This makes it very difficult to use this to debug large projects. There is a "source info" command in lldb that will print the entire path, but it does not get printed automatically as you debug.

Lines found in module `gpg
[0x0000000102975816-0x0000000102975819): /Users/micah.gorrell/src/gpg/gnupg/g10/build-packet.c:171:11

Perhaps there is some way that I haven't discovered yet to get lldb to print full paths, in stack frames or to get it to print the source info output when a stack frame changes. I'll keep experimenting and if I find a solution I will add comments here, and possibly submit a pull request.

minego commented 4 years ago

I found a solution. Calling this (using a helper function in my .vimrc) when I start the debugger makes it behave properly.

TSendCommand settings set frame-format frame #${frame.index}: ${ansi.fg.yellow}${frame.pc}${ansi.normal}{ ${module.file.basename}{\${function.name-with-args}{${frame.no-debug}${function.pc-offset}}}}{ at ${ansi.fg.cyan}${line.file.fullpath}${ansi.normal}:${ansi.fg.yellow}${line.number}${ansi.normal}{:${ansi.fg.yellow}${line.column}${ansi.normal}}}{${function.is-optimized} [opt]}{${frame.is-artificial} [artificial]}\n `

I also set the following to make lldb more usable with this plugin

TSendCommand settings set stop-line-count-before 0
TSendCommand settings set stop-line-count-after 0   

It seems like the plugin should change these settings automatically.

epheien commented 4 years ago

I will check it later.