Build some test binaries alongside the debugger; add shared-library debugging test#1105
Merged
Conversation
e2838d2 to
fea220a
Compare
…ry test and docs Add infra to build debugger unit-test binaries alongside the debugger instead of building them separately. Implements #818. - CMakeLists.txt: BUILD_DEBUGGER_TEST_BINARIES option, on by default, so both local and CI debugger builds produce the test binaries via add_subdirectory(test). - test/CMakeLists.txt: fresh, focused build that stages binaries into test/binaries/<OS>-<arch> alongside the committed test binaries. A universal macOS build still emits thin binaries, one per architecture (per-arch targets). Signing is left to the existing debuggercore POST_BUILD step (core/CMakeLists.txt), which codesigns test/binaries/<OS>-<arch> into the -signed directory the tests load from; the top-level build makes debuggercore depend on the staged binaries so they exist before signing. The staged binaries are not committed (see .gitignore); the previous test/src sources and CMakeLists were unused (builds moved to the debugger-test-binaries repo) and are removed. For #540, add a shared library and a loader executable plus a test that analyzes the library while setting the executable path to the loader, and expand the "Debugging a shared library, DLL, or dylib" docs to cover .so/.dylib in addition to Windows DLLs. This regresses #1104, where the debugger created the LLDB target from the input file (the library) and dyld fell back to launching /bin/sh. The test stops at the system entry point to confirm the loader (not /bin/sh) was launched, then runs to a clean exit; it skips when the binaries were not built. Verified it fails against the pre-fix debugger and passes after e45cd3f. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fea220a to
2691043
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #818 and adds a regression test for #1104 (the scenario tracked in #540).
Infra — build test binaries alongside the debugger (opt-in)
CMakeLists.txt: newBUILD_DEBUGGER_TEST_BINARIESoption (default OFF) thatadd_subdirectory(test). Adding a new test binary no longer needs a separate build.test/src/*(36 files) and the oldtest/CMakeLists.txt— these were unused since binary builds moved to thedebugger-test-binariesCI repo.test/CMakeLists.txt: defaultsARCHto the host and builds only what the host toolchain can produce.test/README.mdrewritten to document the new model..gitignore: allow committing the testshared_lib.{so,dylib}(otherwise caught by the blanket*.so/*.dylibignore).New binaries + test (#540)
test/src/shared_lib.c— shared library exportingshared_lib_add.test/src/load_shared_lib.c— executable that links and calls into it (@loader_path/$ORIGINso the library resolves beside it).shared_lib.dylib/load_shared_libforDarwin-arm64andDarwin-x86_64.test_debug_shared_library: analyzes the library, setsexecutable_pathto the loader, stops at the system entry point, and asserts the launched program is the loader (not the library, not/bin/sh), then runs to a cleanexit_code == 0(which also proves the dependent library loaded and was called).Verification
e45cd3f)The test goes green with the fix and red without it.
Follow-up
Only macOS arm64/x86_64 binaries were built locally. The Linux/Windows
shared_lib.{so,dll}+load_shared_libshould be produced by thedebugger-test-binariesCI for the test to run there.🤖 Generated with Claude Code