Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why can't debug when libc >=2.34 #15

Open
lkb126 opened this issue Aug 21, 2022 · 2 comments
Open

why can't debug when libc >=2.34 #15

lkb126 opened this issue Aug 21, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@lkb126
Copy link

lkb126 commented Aug 21, 2022

why can't debug when libc >=2.34

@matrix1001 matrix1001 added the bug Something isn't working label Aug 24, 2022
@CsomePro
Copy link
Contributor

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...

@CsomePro
Copy link
Contributor

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"])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants