Skip to content

Debug Tooling - #78

Open
SeanCheatham wants to merge 2 commits into
ripple:mainfrom
SeanCheatham:debuggability/core-dumps-and-symbolization-tooling
Open

Debug Tooling#78
SeanCheatham wants to merge 2 commits into
ripple:mainfrom
SeanCheatham:debuggability/core-dumps-and-symbolization-tooling

Conversation

@SeanCheatham

@SeanCheatham SeanCheatham commented Jul 17, 2026

Copy link
Copy Markdown

The existing Dockerfile already included gdb which is useful when using Antithesis' MVD. This PR adds binutils and introduces pre-built gdb indexes to the image. This (should) optimize gdb in MVD to avoid timeout issues.

@SeanCheatham
SeanCheatham marked this pull request as ready for review July 20, 2026 20:51
@SeanCheatham
SeanCheatham force-pushed the debuggability/core-dumps-and-symbolization-tooling branch from b3ce052 to f1b29e1 Compare July 22, 2026 00:21
@SeanCheatham
SeanCheatham force-pushed the debuggability/core-dumps-and-symbolization-tooling branch from f1b29e1 to c010938 Compare July 22, 2026 00:48

@vvysokikh1 vvysokikh1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some small improvements needed, close to completion

Comment thread Dockerfile.xrpld
# links resolve to these same files.
RUN set -ex; \
gdb-add-index /opt/xrpld/bin/xrpld; \
gdb-add-index /opt/fuzzer/bin/rippled-fuzzer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gdb-add-index exits 0 when it produces no index, so set -e won't catch a failure.

maybe worth adding additional checks here?

RUN set -ex; \
>     gdb-add-index /opt/xrpld/bin/xrpld; \
>     gdb-add-index /opt/fuzzer/bin/rippled-fuzzer; \
>     readelf -S /opt/xrpld/bin/xrpld | grep -q '\.gdb_index'; \
>     readelf -S /opt/fuzzer/bin/rippled-fuzzer | grep -q '\.gdb_index'; \
>     /opt/xrpld/bin/xrpld --version

(If you switch to --dwarf-5, the grep target becomes .debug_names.)

Comment thread Dockerfile.xrpld
# VM, can overrun the debug-session command window; the index lets gdb jump straight
# to the units it needs. One-time build cost (the scan happens here); the /symbols/*
# links resolve to these same files.
RUN set -ex; \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This RUN rewrites files that arrived via COPY --from=build, so overlayfs stores a full second copy of both binaries in the new layer while the originals stay in the lower layer. That's a couple of gigabytes at this point.

Doing the indexing in an intermediate stage keeps one copy in the final image.

Comment thread Dockerfile.xrpld

# Embed a .gdb_index in the binaries (gdb-add-index ships with gdb; it uses objcopy
# from binutils). Without it, gdb rebuilds its symbol table by scanning ~600 MB of
# DWARF at startup -- significant CPU and memory that, on a resource-constrained MVD

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description says this "(should)" fix the timeouts — since the whole change is a performance one, worth landing a measured number in the comment rather than "minutes → seconds":

time gdb -batch -nx -ex 'file /opt/xrpld/bin/xrpld' -ex 'thread apply all bt' -ex quit

Also: clang 22 defaults to DWARF 5, and gdb-add-index --dwarf-5 emits the native .debug_names accelerator instead of .gdb_index. On DWARF-5 input that's often the faster of the two, so it seems worth A/B-ing before settling on the default.

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.

2 participants