Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 41 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ check supported packages. remember to run `update_list` at first.

download.

__Note__: use `download` for packages in the `list`; use `download_old` for packages in the `old_list`.
__Note__: use `download` for packages in the `list`; use `download_old` for packages in the `old_list`. If you need to debug a higher version of glibc with symbols,root privileges be required.

```
➜ glibc-all-in-one ./download 2.23-0ubuntu10_i386
➜ glibc-all-in-one ./download 2.23-0ubuntu10_i386 --no-system
Getting 2.23-0ubuntu10_i386
-> Location: https://mirror.tuna.tsinghua.edu.cn/ubuntu/pool/main/g/glibc/libc6_2.23-0ubuntu10_i386.deb
-> Downloading libc binary package
Expand All @@ -68,6 +68,28 @@ Getting 2.23-0ubuntu10_i386
ld-2.23.so libc-2.23.so ......
```

```
➜ glibc-all-in-one sudo ./download 2.35-0ubuntu3.1_amd64 --system
Getting 2.35-0ubuntu3.1_amd64
-> Location: https://mirror.tuna.tsinghua.edu.cn/ubuntu/pool/main/g/glibc/libc6_2.35-0ubuntu3.1_amd64.deb
-> Downloading libc binary package
-> Extracting libc binary package
x - debian-binary
x - control.tar.zst
x - data.tar.zst
/home/xxx/glibc-all-in-one-master
-> Package saved to libs/2.35-0ubuntu3.1_amd64
-> Location: https://mirror.tuna.tsinghua.edu.cn/ubuntu/pool/main/g/glibc/libc6-dbg_2.35-0ubuntu3.1_amd64.deb
-> Downloading libc debug package
-> Extracting libc debug package
x - debian-binary
x - control.tar.zst
x - data.tar.zst
/home/xxx/glibc-all-in-one-master
-> Package saved to libs/2.35-0ubuntu3.1_amd64/.debug and copy the symbol files in .build-id to /usr/lib/debug/

```

```
➜ glibc-all-in-one ./download_old 2.24-3ubuntu2.2_amd64
......
Expand All @@ -94,4 +116,21 @@ __note__: change the `GLIBC_DIR` in the `build`, if you don't want to build them

```sh
./build 2.29 i686
```

## Symbolic debugging of higher versions of glibc

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
```
16 changes: 11 additions & 5 deletions download
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ if [ ! -d "debs" ]; then
mkdir debs
fi

SOURCE="https://mirror.tuna.tsinghua.edu.cn/ubuntu/pool/main/g/glibc"
SOURCE="https://ubuntu.repo.cure.edu.uy/mirror/pool/main/g/glibc/"
#SOURCE="https://mirror.tuna.tsinghua.edu.cn/ubuntu/pool/main/g/glibc"
# Use the source below if you feel slow, or change it on your own.
# SOURCE="http://archive.ubuntu.com/ubuntu/pool/main/g/glibc/"

Expand All @@ -21,7 +22,8 @@ die() {
}

usage() {
echo >&2 "Usage: $0 id"
echo >&2 "Usage: sudo $0 id --system or $0 id --no-system"
echo >&2 "Describe: If you need to debug a higher version of glibc with symbols, you must bring the \"--system\" parameter and need root privileges."
exit 2
}

Expand Down Expand Up @@ -54,10 +56,14 @@ download_single() {

mkdir libs/$id/.debug
./extract debs/$dbg_name libs/$id/.debug
echo " -> Package saved to libs/$id/.debug"
if [[ $2 == "--system" ]]; then
echo " -> Package saved to libs/$id/.debug and copy the symbol files in .build-id to /usr/lib/debug/"
else
echo " -> Package saved to libs/$id/.debug"
fi
}

if [[ $# != 1 ]]; then
if [[ $# != 2 ]]; then
usage
fi
download_single "$1"
download_single "$1" "$2"
1 change: 1 addition & 0 deletions extract
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ extract() {
|| 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
}

Expand Down