-
-
Notifications
You must be signed in to change notification settings - Fork 11
build: Add build option to separate debug symbols #399
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
Merged
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
2782802
Introduce `separate_debug_symbols` option, separate symbols on macOS &
limbonaut 6a3580a
Simplify separation code, update help
limbonaut 4811f4f
Add error handling
limbonaut a770906
Whitespace
limbonaut d18846e
Add support for splitting symbols on Linux
limbonaut e12fc36
Decode error code with WEXITSTATUS
limbonaut 4e4e202
Use zlib
limbonaut 5bf28f0
Whitespace
limbonaut 18aaa09
Remove splitting symbols step as it is handled by the build system
limbonaut 32d2309
Split symbols for crashpad_handler
limbonaut 3240475
Move debug symbol separation logic to utils module
limbonaut 9ebe48d
Clean up debug symbol handling and build options
limbonaut 569b4f7
Style fix
limbonaut d93bd8c
Add SCons tool for debug symbol separation
limbonaut 899dc10
Delete utils.py
limbonaut af02a7b
Clean up
limbonaut 44111e5
Missing imports
limbonaut 205d21b
Fix syntax error
limbonaut 1311518
Remove unused import
limbonaut af21a46
Add meaningful message
limbonaut 594def6
Decouple separate symbols tool from paths
limbonaut c716ff2
Only separate if debug_symbols option is ON
limbonaut 0d45b60
Clean up code
limbonaut 8b55bcf
Update CHANGELOG.md
limbonaut 05e9fd0
Merge branch 'main' into build/separate-symbols-option
limbonaut a65e538
Clean up
limbonaut b6a7c86
Revert "Clean up"
limbonaut ad26f7c
Missing include
limbonaut 8367cd4
Style fix
limbonaut 130f38c
Merge branch 'main' into build/separate-symbols-option
limbonaut 708a671
Remove unused variable
limbonaut 18daabf
Remove unused variable
limbonaut eb88a4e
Remove another unused var
limbonaut 261e95b
Remove unused import
limbonaut 02e3f1b
Remove more unused imports
limbonaut File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
""" | ||
Tool to separate debug symbols. | ||
""" | ||
|
||
from SCons.Script import Clean, Exit, Action | ||
import os | ||
|
||
|
||
def separate_debug_symbols(target, source, env): | ||
platform = env["platform"] | ||
|
||
target_path = str(target[0]) | ||
source_path = str(source[0]) | ||
|
||
def run(cmd): | ||
err = os.system(cmd) | ||
return os.WEXITSTATUS(err) | ||
|
||
if platform in ["macos", "ios"]: | ||
err = run(f'dsymutil "{source_path}" -o "{target_path}"') | ||
if err != 0: | ||
print(f"ERROR: Failed to split debug symbols (exit code {err})") | ||
Exit(1) | ||
|
||
err = run(f'strip -u -r "{source_path}"') | ||
if err != 0: | ||
print(f"ERROR: Failed to strip debug symbols (exit code {err})") | ||
Exit(1) | ||
elif platform == "linux": | ||
err = run(f'objcopy --only-keep-debug --compress-debug-sections=zlib "{source_path}" "{target_path}"') | ||
if err != 0: | ||
print(f"ERROR: Failed to split debug symbols (exit code {err})") | ||
Exit(1) | ||
|
||
err = run(f'strip --strip-debug --strip-unneeded "{source_path}"') | ||
if err != 0: | ||
print(f"ERROR: Failed to strip debug symbols (exit code {err})") | ||
Exit(1) | ||
|
||
err = run(f'objcopy --add-gnu-debuglink="{target_path}" "{source_path}"') | ||
if err != 0: | ||
print(f"ERROR: Failed to add debug link (exit code {err})") | ||
Exit(1) | ||
else: | ||
print("ERROR: Can't separate debug symbols on this platform") | ||
Exit(1) | ||
|
||
|
||
def command(env, target, source): | ||
result = env.Command( | ||
target, | ||
source, | ||
Action(separate_debug_symbols, cmdstr="Separating debug symbols: $SOURCE -> $TARGET") | ||
) | ||
Clean(target, target) | ||
return result | ||
|
||
|
||
def generate(env): | ||
env.AddMethod(command, "SeparateDebugSymbols") | ||
|
||
|
||
def exists(env): | ||
return True |
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.
Uh oh!
There was an error while loading. Please reload this page.