Skip to content

Commit

Permalink
libcdb.unstrip_libc: debug symbols are fetched only if not present (#…
Browse files Browse the repository at this point in the history
…2374)

* libcdb.unstrip_libc: debug symbols are fetched only if not present

* Usage of `ELF.debuginfo` to check if debug symbols exist

closes #2324

---------

Signed-off-by: sswastik02 <40518186+sswastik02@users.noreply.github.com>

* Add CHANGELOG

Signed-off-by: sswastik02 <40518186+sswastik02@users.noreply.github.com>

---------

Signed-off-by: sswastik02 <40518186+sswastik02@users.noreply.github.com>
  • Loading branch information
sswastik02 committed Mar 24, 2024
1 parent a2acdf9 commit 75cc3c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -72,8 +72,10 @@ The table below shows which release corresponds to each branch, and what date th
## 4.14.0 (`dev`)

- [#2356][2356] Add local libc database provider for libcdb
- [#2374][2374] libcdb.unstrip_libc: debug symbols are fetched only if not present

[2356]: https://github.com/Gallopsled/pwntools/pull/2356
[2374]: https://github.com/Gallopsled/pwntools/pull/2374

## 4.13.0 (`beta`)

Expand Down
4 changes: 4 additions & 0 deletions pwnlib/libcdb.py
Expand Up @@ -291,6 +291,10 @@ def unstrip_libc(filename):
log.warn_once('Given libc does not have a buildid. Cannot look for debuginfo to unstrip.')
return False

if libc.debuginfo:
log.debug('Given libc already contains debug information. Skipping unstrip.')
return True

log.debug('Trying debuginfod servers: %r', DEBUGINFOD_SERVERS)

for server_url in DEBUGINFOD_SERVERS:
Expand Down

0 comments on commit 75cc3c3

Please sign in to comment.