Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lldb-mi exits launching my application with SIGKILL #88

Open
zakalawe opened this issue Jan 17, 2022 · 2 comments
Open

lldb-mi exits launching my application with SIGKILL #88

zakalawe opened this issue Jan 17, 2022 · 2 comments

Comments

@zakalawe
Copy link

I'm trying to debug my application using VS-Code, with their bundled lldb-mi (will build from current source here in a moment)

If I create a small test application, lldb-mi works fine, but if I try to debug my real application, which is large, lldb-mi dies right after it logs loading symbols for the app. When I use regular lldb (supplied by XCode), everything works as expected.

LLDB Machine Interface Driver (MI) All rights reserved
Version: 1.0.0.9
Version: GNU gdb (GDB) 7.4 
lldb-1300.0.42.3
Swift version 5.5.2-dev

Output from lldb-mi when it dies (after manually doing a 'run')

(gdb)
=library-loaded,id="/usr/lib/dyld",target-name="/usr/lib/dyld",host-name="/usr/lib/dyld",symbols-loaded="0",loaded_addr="0x00000001041cc000",size="638976"
=library-loaded,id="/Users/jmt/FGFS/fg-work2/build/src/Main/RelWithDebInfo/fgfs.app/Contents/MacOS/fgfs",target-name="/Users/jmt/FGFS/fg-work2/build/src/Main/RelWithDebInfo/fgfs.app/Contents/MacOS/fgfs",host-name="/Users/jmt/FGFS/fg-work2/build/src/Main/RelWithDebInfo/fgfs.app/Contents/MacOS/fgfs",symbols-loaded="0",loaded_addr="0x0000000100000000",size="46628864"
*running,thread-id="all"
(gdb)
Killed: 9

I suspect this is a configuration problem but I have no clue how to debug it further: can you suggest anything I can set / log / try to isolate where the real problem might be? Aside from trying lldb-mi from this Git which I will do in a moment.

@zakalawe
Copy link
Author

Should add, this is all on macOS: all toolchain stuff is from XCode 13.2: (except for lldb-mi which is from VS-Code cpptools)

 $ clang --version
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

@zakalawe
Copy link
Author

Good news, with current HEAD (2388bd7), the problem is different: no SIGKILL occurs.

Instead, lldb-mi seems to get stuck early in dyld startup. If it hit 'break' (pause button) in VS Code, the debug console then shows all the expected output (as if pressing pause caused this to flush in a stuck pipe, from lldb-mi). When I press continue, debugging and my application then proceed correctly: debugging works, etc, etc.

Of course, I do not have stopOnEntry set to true in my launch.json, so this is a bit weird. At the point it gets stuck, the call stack (after I press break) is:

dyld!_dyld_debugger_notification (Unknown Source:0)
dyld!gdb_image_notifier(dyld_image_mode, unsigned int, dyld_image_info const*) (Unknown Source:0)
dyld!notifyGDB(dyld_image_states, unsigned int, dyld_image_info const*) (Unknown Source:0)
dyld!dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (Unknown Source:0)
dyld!ImageLoader::link(ImageLoader::LinkContext const&, bool, bool, bool, ImageLoader::RPathChain const&, char const*) (Unknown Source:0)
dyld!dyld::link(ImageLoader*, bool, bool, ImageLoader::RPathChain const&, unsigned int) (Unknown Source:0)
dyld!dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) (Unknown Source:0)
dyld!dyldbootstrap::start(dyld3::MachOLoaded const*, int, char const**, dyld3::MachOLoaded const*, unsigned long*) (Unknown Source:0)
dyld!_dyld_start (Unknown Source:0)

So I guess there is something blocking in _dyld_debugger_notification which gets kicked when I send a debug command to lldb-mi? As before, I'm mostly looking for help debugging / logging this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant