Skip to content

Build some test binaries alongside the debugger; add shared-library debugging test#1105

Open
xusheng6 wants to merge 1 commit into
devfrom
test_shared_library_binaries
Open

Build some test binaries alongside the debugger; add shared-library debugging test#1105
xusheng6 wants to merge 1 commit into
devfrom
test_shared_library_binaries

Conversation

@xusheng6

Copy link
Copy Markdown
Member

Implements #818 and adds a regression test for #1104 (the scenario tracked in #540).

Infra — build test binaries alongside the debugger (opt-in)

  • Top-level CMakeLists.txt: new BUILD_DEBUGGER_TEST_BINARIES option (default OFF) that add_subdirectory(test). Adding a new test binary no longer needs a separate build.
  • Removed the stale test/src/* (36 files) and the old test/CMakeLists.txt — these were unused since binary builds moved to the debugger-test-binaries CI repo.
  • Fresh, focused test/CMakeLists.txt: defaults ARCH to the host and builds only what the host toolchain can produce.
  • test/README.md rewritten to document the new model.
  • .gitignore: allow committing the test shared_lib.{so,dylib} (otherwise caught by the blanket *.so/*.dylib ignore).

New binaries + test (#540)

  • test/src/shared_lib.c — shared library exporting shared_lib_add.
  • test/src/load_shared_lib.c — executable that links and calls into it (@loader_path/$ORIGIN so the library resolves beside it).
  • Committed unsigned shared_lib.dylib / load_shared_lib for Darwin-arm64 and Darwin-x86_64.
  • test_debug_shared_library: analyzes the library, sets executable_path to 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 clean exit_code == 0 (which also proves the dependent library loaded and was called).

Verification

Debugger Result
Locally-built fixed (e45cd3f) OK (arm64 + x86_64/Rosetta)
Bundled pre-fix FAILED — reproduces #1104

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_lib should be produced by the debugger-test-binaries CI for the test to run there.

🤖 Generated with Claude Code

…ebugging test

Add opt-in infra to build debugger unit-test binaries alongside the debugger
(-DBUILD_DEBUGGER_TEST_BINARIES=ON), so adding a new test no longer requires a
separate build. The full, signed, multi-platform set is still produced by the
debugger-test-binaries CI. Implements #818.

The previous test/src sources and test/CMakeLists.txt were unused (binary builds
moved to the debugger-test-binaries repo), so remove them and add a fresh, focused
CMakeLists that defaults to the host architecture.

Add a shared library and a loader executable plus a test that analyzes the library
while setting the executable path to the loader. This is the scenario from
#540 and 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 fails against the pre-fix debugger and passes after e45cd3f.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

1 participant