-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Description
Solve the problem of no debugging symbols in high versions of glibc
Add cp -r $tmp/usr/lib/debug/.build-id/* /usr/lib/debug/.build-id/ 2>/dev/null
to the line above the rm -rf $tmp
command of the extract file.
--- extract 2022-10-31 15:36:48.748430597 +0800
+++ extract-patch 2022-10-31 15:42:27.990103399 +0800
@@ -33,8 +33,9 @@
|| cp -rP $tmp/usr/lib/debug/lib/*/* $out 2>/dev/null \
|| cp -rP $tmp/usr/lib/debug/lib32/* $out 2>/dev/null \
|| cp -rP $tmp/usr/lib/debug/.build-id $out 2>/dev/null \
- || die "Failed to save. Check it manually $tmp"
+ || die "Failed to save. Check it manually $tmp"
+ cp -r $tmp/usr/lib/debug/.build-id/* /usr/lib/debug/.build-id/ 2>/dev/null
rm -rf $tmp
}
The extract script after patch is as follows
#!/bin/bash
cd "$(dirname "$0")"
die() {
echo >&2 $1
exit 1
}
usage() {
echo -e >&2 "Usage: $0 deb output"
exit 2
}
extract() {
local deb=`readlink -f $1`
local out=$2
if [ ! -d "$out" ]; then
mkdir $out
fi
local tmp=`mktemp -d`
cd $tmp
ar xv $deb || die "ar failed"
if [ -f "data.tar.zst" ];then
tar -I zstd -xf data.tar.* || die "tar failed"
else
tar xf data.tar.* || die "tar failed"
fi
cd -
cp -rP $tmp/lib/*/* $out 2>/dev/null \
|| cp -rP $tmp/lib32/* $out 2>/dev/null \
|| cp -rP $tmp/usr/lib/debug/lib/*/* $out 2>/dev/null \
|| cp -rP $tmp/usr/lib/debug/lib32/* $out 2>/dev/null \
|| cp -rP $tmp/usr/lib/debug/.build-id $out 2>/dev/null \
|| die "Failed to save. Check it manually $tmp"
cp -r $tmp/usr/lib/debug/.build-id/* /usr/lib/debug/.build-id/ 2>/dev/null
rm -rf $tmp
}
if [[ $# -ne 2 ]]; then
usage
fi
extract "$1" "$2"
Note: Because files will be copied to the .build-id
directory of the system, root privileges are required every time you run ./download
.
Upgrade GDB version (may be required)
If your environment is ubuntu16 or 18, then the default GDB version is lower (GDB < 8.3) and does not support parsing the symbol files in .build-id. In this case, you need to upgrade the GDB version.
Version 9.2 is recommended, use the following methods to complete the upgrade
apt install texinfo
cp `which gdb` `which gdb`-old
cp `which gdbserver` `which gdbserver`-old
wegt http://ftp.gnu.org/gnu/gdb/gdb-9.2.tar.gz
tar -xzvf gdb-9.2.tar.gz
cd gdb-9.2 && mkdir build && cd build
../configure --with-python=`which python3` --enable-targets=all
make && make install
Metadata
Metadata
Assignees
Labels
No labels