Skip to content

Commit baadaa5

Browse files
authored
Merge pull request #39 from jan-auer/release-debug
Retain debug information in a separate file
2 parents a6e47bb + a02c173 commit baadaa5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

build.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,17 @@ export CARGO_TARGET_DIR=$PWD/target/lambda
3030

3131
function package() {
3232
file="$1"
33-
strip "$file"
33+
if [[ "${PROFILE}" == "release" ]]; then
34+
objcopy --only-keep-debug "$file" "$file.debug"
35+
objcopy --strip-debug --strip-unneeded "$file"
36+
objcopy --add-gnu-debuglink="$file.debug" "$file"
37+
fi
3438
rm "$file.zip" > 2&>/dev/null || true
3539
# note: would use printf "@ $(basename $file)\n@=bootstrap" | zipnote -w "$file.zip"
3640
# if not for https://bugs.launchpad.net/ubuntu/+source/zip/+bug/519611
3741
if [ "$file" != ./bootstrap ] && [ "$file" != bootstrap ]; then
3842
mv "${file}" bootstrap
43+
mv "${file}.debug" bootstrap.debug > 2&>/dev/null || true
3944
fi
4045
zip "$file.zip" bootstrap
4146
rm bootstrap
@@ -53,4 +58,4 @@ cd "${CARGO_TARGET_DIR}/${TARGET_PROFILE}"
5358
package "$BIN"
5459
fi
5560

56-
) 1>&2
61+
) 1>&2

0 commit comments

Comments
 (0)