Skip to content

Commit 694d4d4

Browse files
committed
feat: split linux debug info for relwithdebinfo
1 parent ee35874 commit 694d4d4

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ jobs:
227227
run: |
228228
cmake --install build --prefix install --config ${{ needs.meta.outputs.build-config }}
229229
230+
if [[ ${{ needs.meta.outputs.build-config }} == RelWithDebInfo ]]; then
231+
tools/split-linux-debug.sh install
232+
fi
233+
230234
cp -r docs install
231235
cp README*.md install
232236

tools/split-linux-debug.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
INSTALL_PREFIX=$1
4+
5+
if ! [[ -d "$INSTALL_PREFIX" ]]; then
6+
echo "Usage: $0 [install prefix]"
7+
exit 1
8+
fi
9+
10+
INSTALL_PREFIX=`realpath "$INSTALL_PREFIX"`
11+
12+
cd `dirname "$0"/..`
13+
PATH="`pwd`/source/MaaUtils/MaaDeps/x-tools/llvm/bin:$PATH"
14+
15+
mkdir -p "$INSTALL_PREFIX/symbols"
16+
find $INSTALL_PREFIX/bin -type f | while read BINARY; do
17+
echo "Process $BINARY"
18+
FILE=`basename "$BINARY"`
19+
DEBUG_FILE="$INSTALL_PREFIX/symbols/$FILE.debug"
20+
21+
cd `dirname "$BINARY"`
22+
23+
llvm-objcopy --only-keep-debug "$BINARY" "$BINARY.debug"
24+
llvm-objcopy --add-gnu-debuglink=$FILE.debug --strip-unneeded "$BINARY"
25+
mv "$BINARY.debug" "$DEBUG_FILE"
26+
27+
cd - > /dev/null
28+
done

0 commit comments

Comments
 (0)