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 hangs on MacOS #96

Open
busjaeger opened this issue Apr 14, 2022 · 2 comments
Open

lldb-mi hangs on MacOS #96

busjaeger opened this issue Apr 14, 2022 · 2 comments

Comments

@busjaeger
Copy link

When I run lldb-mi on MacOS it hangs. Here is the console output:

(gdb)
-file-exec-and-symbols "test"
^done
(gdb)
=library-loaded,id="[...]/test",target-name="[...]/test",host-name="[...]/test",symbols-loaded="0",loaded_addr="-",size="23838720"
r test
~"Process 34501 launched: '[...]/test' (x86_64)\n"
^done
(gdb)
=thread-created,id="1",group-id="i1"
=thread-selected,id="1"
(gdb)
=library-unloaded,id="[...]/test",target-name="[...]/test",host-name="[...]/test"
(gdb)
=library-loaded,id="/usr/lib/dyld",target-name="/usr/lib/dyld",host-name="/usr/lib/dyld",symbols-loaded="0",loaded_addr="0x0000000101eb4000",size="442368"
=library-loaded,id="[...]/test",target-name="[...]/test",host-name="[...]/test",symbols-loaded="0",loaded_addr="0x0000000100000000",size="23838720"
*running,thread-id="all"
(gdb)

Here is a sample of the process obtained via Activity Monitor: https://gist.github.com/busjaeger/c5653cd197fb0c82d9ca79bf95f521f0

If I enter r again, and answer n to killing the running process, the process executes and completes successfully.

r
There is a running process, kill it and restart?: [Y/n] n
^done
(gdb)
(gdb)
=library-loaded,id="[...]/compression/zstd/lib/libzstd.1.3.4.dylib",target-name="[...]/compression/zstd/lib/libzstd.1.3.4.dylib",host-name="[...]/compression/zstd/lib/libzstd.1.3.4.dylib",symbols-loaded="1",symbols-path="[...]/compression/zstd/lib/libzstd.1.3.4.dylib.dSYM/Contents/Resources/DWARF/libzstd.1.3.4.dylib",loaded_addr="0x0000000102154000",size="720896"
=library-loaded,id="/usr/lib/libz.1.dylib",target-name="/usr/lib/libz.1.dylib",host-name="/usr/lib/libz.1.dylib",symbols-loaded="0",loaded_addr="0x00007ff8261d9000",size="77824"
=library-loaded,id="/usr/lib/libSystem.B.dylib",target-name="/usr/lib/libSystem.B.dylib",host-name="/usr/lib/libSystem.B.dylib",symbols-loaded="0",loaded_addr="0x00007ff8262b9000",size="8192"
=library-loaded,id="/usr/lib/system/libcache.dylib",target-name="/usr/lib/system/libcache.dylib",host-name="/usr/lib/system/libcache.dylib",symbols-loaded="0",loaded_addr="0x00007ff8262b4000",size="20480"
=library-loaded,id="/usr/lib/system/libcommonCrypto.dylib",target-name="/usr/lib/system/libcommonCrypto.dylib",host-name="/usr/lib/system/libcommonCrypto.dylib",symbols-loaded="0",loaded_addr="0x00007ff826270000",size="49152"
=library-loaded,id="/usr/lib/system/libcompiler_rt.dylib",target-name="/usr/lib/system/libcompiler_rt.dylib",host-name="/usr/lib/system/libcompiler_rt.dylib",symbols-loaded="0",loaded_addr="0x00007ff826299000",size="32768"
=library-loaded,id="/usr/lib/system/libcopyfile.dylib",target-name="/usr/lib/system/libcopyfile.dylib",host-name="/usr/lib/system/libcopyfile.dylib",symbols-loaded="0",loaded_addr="0x00007ff82628f000",size="40960"
=library-loaded,id="/usr/lib/system/libcorecrypto.dylib",target-name="/usr/lib/system/libcorecrypto.dylib",host-name="/usr/lib/system/libcorecrypto.dylib",symbols-loaded="0",loaded_addr="0x00007ff81b264000",size="598016"
=library-loaded,id="/usr/lib/system/libdispatch.dylib",target-name="/usr/lib/system/libdispatch.dylib",host-name="/usr/lib/system/libdispatch.dylib",symbols-loaded="0",loaded_addr="0x00007ff81b322000",size="290816"
=library-loaded,id="/usr/lib/system/libdyld.dylib",target-name="/usr/lib/system/libdyld.dylib",host-name="/usr/lib/system/libdyld.dylib",symbols-loaded="0",loaded_addr="0x00007ff81b4e6000",size="49152"
=library-loaded,id="/usr/lib/system/libkeymgr.dylib",target-name="/usr/lib/system/libkeymgr.dylib",host-name="/usr/lib/system/libkeymgr.dylib",symbols-loaded="0",loaded_addr="0x00007ff8262ab000",size="4096"
=library-loaded,id="/usr/lib/system/libmacho.dylib",target-name="/usr/lib/system/libmacho.dylib",host-name="/usr/lib/system/libmacho.dylib",symbols-loaded="0",loaded_addr="0x00007ff82624e000",size="24576"
=library-loaded,id="/usr/lib/system/libquarantine.dylib",target-name="/usr/lib/system/libquarantine.dylib",host-name="/usr/lib/system/libquarantine.dylib",symbols-loaded="0",loaded_addr="0x00007ff8258cd000",size="12288"
=library-loaded,id="/usr/lib/system/libremovefile.dylib",target-name="/usr/lib/system/libremovefile.dylib",host-name="/usr/lib/system/libremovefile.dylib",symbols-loaded="0",loaded_addr="0x00007ff8262a9000",size="8192"
=library-loaded,id="/usr/lib/system/libsystem_asl.dylib",target-name="/usr/lib/system/libsystem_asl.dylib",host-name="/usr/lib/system/libsystem_asl.dylib",symbols-loaded="0",loaded_addr="0x00007ff820460000",size="94208"
=library-loaded,id="/usr/lib/system/libsystem_blocks.dylib",target-name="/usr/lib/system/libsystem_blocks.dylib",host-name="/usr/lib/system/libsystem_blocks.dylib",symbols-loaded="0",loaded_addr="0x00007ff81b20d000",size="8192"
=library-loaded,id="/usr/lib/system/libsystem_c.dylib",target-name="/usr/lib/system/libsystem_c.dylib",host-name="/usr/lib/system/libsystem_c.dylib",symbols-loaded="0",loaded_addr="0x00007ff81b3aa000",size="561152"
=library-loaded,id="/usr/lib/system/libsystem_collections.dylib",target-name="/usr/lib/system/libsystem_collections.dylib",host-name="/usr/lib/system/libsystem_collections.dylib",symbols-loaded="0",loaded_addr="0x00007ff8262a1000",size="20480"
=library-loaded,id="/usr/lib/system/libsystem_configuration.dylib",target-name="/usr/lib/system/libsystem_configuration.dylib",host-name="/usr/lib/system/libsystem_configuration.dylib",symbols-loaded="0",loaded_addr="0x00007ff824b7a000",size="16384"
=library-loaded,id="/usr/lib/system/libsystem_containermanager.dylib",target-name="/usr/lib/system/libsystem_containermanager.dylib",host-name="/usr/lib/system/libsystem_containermanager.dylib",symbols-loaded="0",loaded_addr="0x00007ff823e26000",size="118784"
=library-loaded,id="/usr/lib/system/libsystem_coreservices.dylib",target-name="/usr/lib/system/libsystem_coreservices.dylib",host-name="/usr/lib/system/libsystem_coreservices.dylib",symbols-loaded="0",loaded_addr="0x00007ff825f87000",size="20480"
=library-loaded,id="/usr/lib/system/libsystem_darwin.dylib",target-name="/usr/lib/system/libsystem_darwin.dylib",host-name="/usr/lib/system/libsystem_darwin.dylib",symbols-loaded="0",loaded_addr="0x00007ff81db09000",size="40960"
=library-loaded,id="/usr/lib/system/libsystem_dnssd.dylib",target-name="/usr/lib/system/libsystem_dnssd.dylib",host-name="/usr/lib/system/libsystem_dnssd.dylib",symbols-loaded="0",loaded_addr="0x00007ff8262ac000",size="32768"
=library-loaded,id="/usr/lib/system/libsystem_featureflags.dylib",target-name="/usr/lib/system/libsystem_featureflags.dylib",host-name="/usr/lib/system/libsystem_featureflags.dylib",symbols-loaded="0",loaded_addr="0x00007ff81b3a7000",size="12288"
=library-loaded,id="/usr/lib/system/libsystem_info.dylib",target-name="/usr/lib/system/libsystem_info.dylib",host-name="/usr/lib/system/libsystem_info.dylib",symbols-loaded="0",loaded_addr="0x00007ff81b4fc000",size="176128"
=library-loaded,id="/usr/lib/system/libsystem_m.dylib",target-name="/usr/lib/system/libsystem_m.dylib",host-name="/usr/lib/system/libsystem_m.dylib",symbols-loaded="0",loaded_addr="0x00007ff8261ec000",size="397312"
=library-loaded,id="/usr/lib/system/libsystem_malloc.dylib",target-name="/usr/lib/system/libsystem_malloc.dylib",host-name="/usr/lib/system/libsystem_malloc.dylib",symbols-loaded="0",loaded_addr="0x00007ff81b2f6000",size="180224"
=library-loaded,id="/usr/lib/system/libsystem_networkextension.dylib",target-name="/usr/lib/system/libsystem_networkextension.dylib",host-name="/usr/lib/system/libsystem_networkextension.dylib",symbols-loaded="0",loaded_addr="0x00007ff8203fb000",size="94208"
=library-loaded,id="/usr/lib/system/libsystem_notify.dylib",target-name="/usr/lib/system/libsystem_notify.dylib",host-name="/usr/lib/system/libsystem_notify.dylib",symbols-loaded="0",loaded_addr="0x00007ff81df2f000",size="61440"
=library-loaded,id="/usr/lib/system/libsystem_product_info_filter.dylib",target-name="/usr/lib/system/libsystem_product_info_filter.dylib",host-name="/usr/lib/system/libsystem_product_info_filter.dylib",symbols-loaded="1",symbols-path="",loaded_addr="0x00007ff82c517000",size="4096"
=library-loaded,id="/usr/lib/system/libsystem_sandbox.dylib",target-name="/usr/lib/system/libsystem_sandbox.dylib",host-name="/usr/lib/system/libsystem_sandbox.dylib",symbols-loaded="0",loaded_addr="0x00007ff824b7e000",size="24576"
=library-loaded,id="/usr/lib/system/libsystem_secinit.dylib",target-name="/usr/lib/system/libsystem_secinit.dylib",host-name="/usr/lib/system/libsystem_secinit.dylib",symbols-loaded="0",loaded_addr="0x00007ff8262a6000",size="12288"
=library-loaded,id="/usr/lib/system/libsystem_kernel.dylib",target-name="/usr/lib/system/libsystem_kernel.dylib",host-name="/usr/lib/system/libsystem_kernel.dylib",symbols-loaded="0",loaded_addr="0x00007ff81b4a2000",size="229376"
=library-loaded,id="/usr/lib/system/libsystem_platform.dylib",target-name="/usr/lib/system/libsystem_platform.dylib",host-name="/usr/lib/system/libsystem_platform.dylib",symbols-loaded="0",loaded_addr="0x00007ff81b4f2000",size="40960"
=library-loaded,id="/usr/lib/system/libsystem_pthread.dylib",target-name="/usr/lib/system/libsystem_pthread.dylib",host-name="/usr/lib/system/libsystem_pthread.dylib",symbols-loaded="0",loaded_addr="0x00007ff81b4da000",size="49152"
=library-loaded,id="/usr/lib/system/libsystem_symptoms.dylib",target-name="/usr/lib/system/libsystem_symptoms.dylib",host-name="/usr/lib/system/libsystem_symptoms.dylib",symbols-loaded="0",loaded_addr="0x00007ff821ca8000",size="32768"
=library-loaded,id="/usr/lib/system/libsystem_trace.dylib",target-name="/usr/lib/system/libsystem_trace.dylib",host-name="/usr/lib/system/libsystem_trace.dylib",symbols-loaded="0",loaded_addr="0x00007ff81b24b000",size="102400"
=library-loaded,id="/usr/lib/system/libunwind.dylib",target-name="/usr/lib/system/libunwind.dylib",host-name="/usr/lib/system/libunwind.dylib",symbols-loaded="0",loaded_addr="0x00007ff82627c000",size="45056"
=library-loaded,id="/usr/lib/system/libxpc.dylib",target-name="/usr/lib/system/libxpc.dylib",host-name="/usr/lib/system/libxpc.dylib",symbols-loaded="0",loaded_addr="0x00007ff81b20f000",size="245760"
=library-loaded,id="/usr/lib/libc++abi.dylib",target-name="/usr/lib/libc++abi.dylib",host-name="/usr/lib/libc++abi.dylib",symbols-loaded="0",loaded_addr="0x00007ff81b48c000",size="90112"
=library-loaded,id="/usr/lib/libobjc.A.dylib",target-name="/usr/lib/libobjc.A.dylib",host-name="/usr/lib/libobjc.A.dylib",symbols-loaded="0",loaded_addr="0x00007ff81b369000",size="253952"
=library-loaded,id="/usr/lib/liboah.dylib",target-name="/usr/lib/liboah.dylib",host-name="/usr/lib/liboah.dylib",symbols-loaded="0",loaded_addr="0x00007ff826287000",size="32768"
=library-loaded,id="/usr/lib/libc++.1.dylib",target-name="/usr/lib/libc++.1.dylib",host-name="/usr/lib/libc++.1.dylib",symbols-loaded="0",loaded_addr="0x00007ff81b433000",size="364544"
[...]
(gdb)
=thread-exited,id="1",group-id="i1"
=thread-group-exited,id="i1",exit-code="0"
*stopped,reason="exited-normally"
(gdb)

The debugger in Eclipse and VSCode also hang for this executable (I believe due to the same problem). I don't have this problem with simple 'Hello World' executables. I suspect the reason is that this executable loads some dynamic libraries. The stack trace seems to suggest the process is blocked initializing python.

Please let me know if you need more info. Thanks in advance for any pointers!

@busjaeger
Copy link
Author

FYI, I built lldb-mi from source against llvm installed with brew:

brew install llvm
brewllvm=$(ls -d /usr/local/Cellar/llvm/*)
cd ~/Projects
git clone https://github.com/lldb-tools/lldb-mi
cd lldb-mi
cmake -DCMAKE_PREFIX_PATH=$brewllvm .
cmake --build .

Not sure if this is related, but when I follow the steps in Verifying Python Support, I get:

✗ export PYTHONPATH=`/usr/local/Cellar/llvm/13.0.1_1/bin/lldb -P`
✗ python3 -c 'import lldb'
[1]    64445 segmentation fault  python3 -c 'import lldb'

I don't get that seg fault with:

✗ export PYTHONPATH=`/Library/Developer/CommandLineTools/usr/bin/lldb -P`
✗ python3 -c 'import lldb'

Is there some way to build lldb-mi against lldb that comes with XCode?

@busjaeger
Copy link
Author

Looks like this is somehow related to the debug information for libzstd. When I remove the directory libzstd.1.3.4.dylib.dSYM, the debugger no longer hangs.

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