glibc-all-in-one
glibc-all-in-one copied to clipboard
why can't debug when libc >=2.34
why can't debug when libc >=2.34
By reading the page 317 section 18.3 in https://sourceware.org/gdb/current/onlinedocs/gdb.pdf. I found the solution. Copy the .debug/.build-id to /usr/lib/debug.
/usr/lib/debug
└── .build-id
├── 00
│ ├── 1fcbe635c2ecd4954d084d0c7b3873408ccccf.debug
│ └── 7f46ce41f9c4ff5dec02c331d08873288daf1b.debug
├── 01
│ ├── 0b3350bd19ff06c69b830e48897b285dfc9e85.debug
│ ├── 451f533a914be9b82dfca722ae74820b8f9d83.debug
│ ├── 4bdf7ca147b53f82c6a168d8704dd3dbe3d4a4.debug
│ ├── 67c5dd58825132007700d919681e0d15fc59d5.debug
│ ├── 6990db641cbba71a63f5acac4db4a6ca92c366.debug
│ ├── bff15b2fea6bec800bdd01463de92d746113d4.debug
│ └── fe2014ba94349f32bc6f9703389b20c2cfd014.debug
...
then we will found the log in gdb starting.
Reading symbols from ./ld-linux-x86-64.so.2...
Reading symbols from /usr/lib/debug/.build-id/89/e85ad66d0c8652a21ea2df543b194126df81dc.debug...
Attaching to program: /xxxxxx/ld-linux-x86-64.so.2, process 7694
Reading symbols from ./libc.so.6...
Reading symbols from /usr/lib/debug/.build-id/f0/b834daa3d05a80967e9ec2f990a1ea71c958fa.debug...
Reading symbols from ./ld-linux-x86-64.so.2...
Reading symbols from /usr/lib/debug/.build-id/89/e85ad66d0c8652a21ea2df543b194126df81dc.debug...
To use local env (we don't want to make /usr/lib/debug dirty) we can use the following command for debugging.
gdb -iex "set debug-file-directory /path/to/build-id-parent-dir" FILE
we can use the following scripts in pwntools script.
gdb.attach(io, gdb_args=["-iex", "set debug-file-directory /path/to/build-id-parent-dir"])