-
Notifications
You must be signed in to change notification settings - Fork 937
Include debug symbols in the release for the lib #1271
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
Conversation
|
Unrelated failure: |
Makefile
Outdated
| CXXFLAGS=-O3 -fno-exceptions -fno-omit-frame-pointer -fvisibility=hidden -std=c++11 $(CXXFLAGS_EXTRA) | ||
| CPPFLAGS= | ||
| CXXFLAGS=-O3 -fno-exceptions -fno-omit-frame-pointer -fvisibility=hidden -std=c++11 $(CXXFLAGS_EXTRA) | ||
| LIB_PROFILER_CXXFLAGS=$(CXXFLAGS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have many variables with flags, can we do without another one?
Can't we just add an option to CXXFLAGS conditionally?
Makefile
Outdated
| endif | ||
|
|
||
| ifeq ($(OS_TAG),linux) | ||
| $(STRIP) --only-keep-debug $@ -o $@.debug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does .debug file get in the release package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should not. What's the purpose of having a separate .debug file then? The idea was to keep release package small, but provide debuginfo in a separate package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the idea was to keep the .so binary small, will provide in a separate package.
Makefile
Outdated
| endif | ||
|
|
||
| ifeq ($(OS_TAG),linux) | ||
| $(STRIP) --only-keep-debug $@ -o $@.debug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should not. What's the purpose of having a separate .debug file then? The idea was to keep release package small, but provide debuginfo in a separate package.
Makefile
Outdated
| endif | ||
|
|
||
| ifeq ($(OS_TAG),linux) | ||
| CXXFLAGS += -ggdb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already ifeq ($(OS),Darwin) branch above that sets CXXFLAGS depending on a platform, should we move it there?
Makefile
Outdated
| $(STRIP) --only-keep-debug $@ -o build/sym/$(@F).debug | ||
| $(STRIP) -g $@ | ||
| $(OBJCOPY) --add-gnu-debuglink=build/sym/$(@F).debug $@ | ||
| endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it the right place to extract debuginfo? I think, for development purposes, one binary with debug symbols is more convenient; we just do redundant steps here. Should we strip binaries at the packaging step instead?
| esac | ||
| echo "archive=$(basename $(find . -type f -iname "async-profiler-*" ))" >> $GITHUB_OUTPUT | ||
| echo "archive=$(find . -type f -name "async-profiler-*" -not -name "*-sym*" -exec basename {} \; || echo "")" >> $GITHUB_OUTPUT | ||
| echo "sym_archive=$(find . -type f -name "async-profiler-*-sym*" -exec basename {} \; | awk '{print; exit} END{if(NR==0) print "IGNORE"}')" >> $GITHUB_OUTPUT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files were found with the provided path: IGNORE.
Isn't there a less tricky way to skip macOS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Github actions step did not accept empty string as a valid value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will skip with an "is macos" check.
Makefile
Outdated
| SYM_PACKAGE_NAME=$(PACKAGE_NAME)-sym | ||
| SYM_PACKAGE_DIR=$(PACKAGE_DIR)-sym |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a common naming convention? I saw -debug or -debuginfo, but not -sym.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving to -debug.
| macos*) | ||
| brew install gcovr | ||
| make COMMIT_TAG=$HASH FAT_BINARY=true release coverage -j | ||
| echo "debug_archive=UNSUPPORTED" >> $GITHUB_OUTPUT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it be a condition in the "Upload debug info" step instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upload debug info fails if debug_archive is not set or is set to an empty string - or I don't understand the question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My question is whether we can skip upload step altogether on macOS instead of uploading a dummy archive? Doesn't if: work for steps?
Makefile
Outdated
| .PHONY: all jar release build-test test clean coverage clean-coverage build-test-java build-test-cpp build-test-libs build-test-bins test-cpp test-java check-md format-md | ||
|
|
||
| all: build/bin build/lib build/$(LIB_PROFILER) build/$(ASPROF) jar build/$(JFRCONV) build/$(ASPROF_HEADER) | ||
| all: build/bin build/lib build/debug build/$(LIB_PROFILER) build/$(ASPROF) jar build/$(JFRCONV) build/$(ASPROF_HEADER) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is build/debug still used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this creates the folder via
build/%:
mkdir -p $@
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, this is my question. make creates an empty build/debug directory, and I'm not sure why.
Makefile
Outdated
|
|
||
| $(PACKAGE_DIR): all LICENSE README.md | ||
| $(PACKAGE_DIR): all LICENSE README.md build/$(LIB_PROFILER_DEBUG) | ||
| rm -rf $@ || : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why || :? rm -rf does not fail in case of missing file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, removing.
Makefile
Outdated
| # To make building debug symbols idempotent, a rebuild of $(LIB_PROFILER) is required. | ||
| # Remove stamp file to ensures $(LIB_PROFILER) rule re-runs if needed after this rule modifies it (strip -g). | ||
| rm -f build/$(LIB_STAMP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't fully understand this complication. Updating build/$(LIB_PROFILER) in place doesn't seem a good idea, can we only update it in a package dir?
If it helps to keep things simpler, we can eliminate separate rules for $(DEBUG_PACKAGE_DIR) and $(LIB_PROFILER_DEBUG) and always build debug package under $(PACKAGE_NAME).tar.gz rule.
|
Unrelated test failure: |
Motivation and context
It is useful to have the exact symbols corresponding to a release, for debugging purposes.
How has this been tested?
Only
libasyncProfiler.so.debughas the.debug*sections andlibasyncProfiler.soretains symbols.Sample sizes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.