Skip to content

Ship debug symbols alongside the binaries#947

Merged
jviotti merged 5 commits into
mainfrom
debug-symbols
May 25, 2026
Merged

Ship debug symbols alongside the binaries#947
jviotti merged 5 commits into
mainfrom
debug-symbols

Conversation

@jviotti
Copy link
Copy Markdown
Member

@jviotti jviotti commented May 25, 2026

Signed-off-by: Juan Cruz Viotti jv@jviotti.com

jviotti added 3 commits May 25, 2026 14:07
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@jviotti jviotti marked this pull request as ready for review May 25, 2026 18:44
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 5 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="cmake/DebugSymbols.cmake">

<violation number="1" location="cmake/DebugSymbols.cmake:47">
P2: `CMAKE_OBJCOPY` used without existence check. Missing tool will break the debug-symbol target at build time. Add a required tool check before creating commands.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread cmake/DebugSymbols.cmake Outdated
Comment thread cmake/DebugSymbols.cmake
COMPONENT "${EXTRACT_DEBUG_SYMBOLS_COMPONENT}")
elseif(UNIX)
add_custom_command(OUTPUT "${BINARY_PATH}.debug"
COMMAND "${CMAKE_OBJCOPY}" --only-keep-debug
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: CMAKE_OBJCOPY used without existence check. Missing tool will break the debug-symbol target at build time. Add a required tool check before creating commands.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At cmake/DebugSymbols.cmake, line 47:

<comment>`CMAKE_OBJCOPY` used without existence check. Missing tool will break the debug-symbol target at build time. Add a required tool check before creating commands.</comment>

<file context>
@@ -0,0 +1,61 @@
+      COMPONENT "${EXTRACT_DEBUG_SYMBOLS_COMPONENT}")
+  elseif(UNIX)
+    add_custom_command(OUTPUT "${BINARY_PATH}.debug"
+      COMMAND "${CMAKE_OBJCOPY}" --only-keep-debug
+              "${BINARY_PATH}" "${BINARY_PATH}.debug"
+      COMMAND "${CMAKE_OBJCOPY}" --strip-debug "${BINARY_PATH}"
</file context>

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 25, 2026

🤖 Augment PR Summary

Summary: This PR adds build+install support for shipping debug symbols alongside Sourcemeta One binaries, while keeping the installed executables stripped.

Changes:

  • Introduces cmake/DebugSymbols.cmake to enable debug info generation and extract symbols post-link.
  • Enables the new debug-symbol flow by default for non-Debug builds (via ONE_DEBUG_SYMBOLS in the top-level CMakeLists.txt).
  • On Apple, runs dsymutil and installs the resulting .dSYM bundle next to the binary.
  • On Unix, uses objcopy to create a .debug sidecar, strips debug sections from the binary, and adds a .gnu_debuglink.
  • Hooks extraction for sourcemeta_one_index and sourcemeta_one_server so their symbol artifacts are built and installed.
  • Adds CLI tests that validate symbolication/source mapping works via atos (macOS) or nm --line-numbers (Unix).

Technical Notes: The extraction is driven by custom targets (*_debug_symbols) built with ALL, and installs debug artifacts under ${CMAKE_INSTALL_BINDIR} in the sourcemeta_one component.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 4 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread CMakeLists.txt
Comment thread cmake/DebugSymbols.cmake
Comment thread cmake/DebugSymbols.cmake Outdated
set(BINARY_OUTPUT_NAME "${TARGET_NAME}")
endif()
get_target_property(BINARY_OUTPUT_DIR "${TARGET_NAME}" BINARY_DIR)
set(BINARY_PATH "${BINARY_OUTPUT_DIR}/${BINARY_OUTPUT_NAME}")
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 25, 2026

Choose a reason for hiding this comment

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

cmake/DebugSymbols.cmake:22: Building BINARY_PATH from BINARY_DIR + OUTPUT_NAME ignores runtime output directories, per-config subdirs, and platform suffixes (e.g. .exe). That can make the dsymutil/objcopy custom commands point at a non-existent binary when outputs are redirected (notably on WIN32 where outputs are placed under ${CMAKE_BINARY_DIR}/bin) or when using multi-config generators.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Comment thread test/cli/index/common/debug-symbols.sh
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Benchmark Index (enterprise)

Details
Benchmark suite Current: de5daf3 Previous: 90f0040 Ratio
Add one schema (0 existing) 289 ms 289 ms 1
Add one schema (100 existing) 29 ms 28 ms 1.04
Add one schema (1000 existing) 81 ms 81 ms 1
Add one schema (10000 existing) 646 ms 676 ms 0.96
Update one schema (1 existing) 20 ms 21 ms 0.95
Update one schema (101 existing) 28 ms 28 ms 1
Update one schema (1001 existing) 82 ms 83 ms 0.99
Update one schema (10001 existing) 660 ms 696 ms 0.95
Cached rebuild (1 existing) 6 ms 6 ms 1
Cached rebuild (101 existing) 9 ms 9 ms 1
Cached rebuild (1001 existing) 28 ms 29 ms 0.97
Cached rebuild (10001 existing) 242 ms 254 ms 0.95
Index 100 schemas 128 ms 119 ms 1.08
Index 1000 schemas 1258 ms 1152 ms 1.09
Index 10000 schemas 14248 ms 14015 ms 1.02

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Benchmark Index (community)

Details
Benchmark suite Current: de5daf3 Previous: 90f0040 Ratio
Add one schema (0 existing) 295 ms 285 ms 1.04
Add one schema (100 existing) 26 ms 26 ms 1
Add one schema (1000 existing) 83 ms 84 ms 0.99
Add one schema (10000 existing) 700 ms 819 ms 0.85
Update one schema (1 existing) 19 ms 18 ms 1.06
Update one schema (101 existing) 28 ms 27 ms 1.04
Update one schema (1001 existing) 86 ms 85 ms 1.01
Update one schema (10001 existing) 692 ms 709 ms 0.98
Cached rebuild (1 existing) 5 ms 6 ms 0.83
Cached rebuild (101 existing) 8 ms 8 ms 1
Cached rebuild (1001 existing) 29 ms 30 ms 0.97
Cached rebuild (10001 existing) 252 ms 311 ms 0.81
Index 100 schemas 121 ms 111 ms 1.09
Index 1000 schemas 942 ms 875 ms 1.08
Index 10000 schemas 15944 ms 13189 ms 1.21

This comment was automatically generated by workflow using github-action-benchmark.

jviotti added 2 commits May 25, 2026 14:57
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@jviotti jviotti merged commit 8d9f2b9 into main May 25, 2026
4 checks passed
@jviotti jviotti deleted the debug-symbols branch May 25, 2026 19:34
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