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

Fix cymbol command on Ubuntu 18.04 #1399

Closed
disconnect3d opened this issue Nov 30, 2022 · 1 comment
Closed

Fix cymbol command on Ubuntu 18.04 #1399

disconnect3d opened this issue Nov 30, 2022 · 1 comment

Comments

@disconnect3d
Copy link
Member

disconnect3d commented Nov 30, 2022

There's a cymbol test that fails on the Ubuntu 18.04 CI, this issue is there to track it

@gsingh93 gsingh93 added this to the November Release milestone Dec 3, 2022
@disconnect3d
Copy link
Member Author

The cymbol functionality does not work on old GDB versions because the add-symbol-file command has different interface in old GDBs: it requires an address argument, while in newer GDBs its optional.

This can be seen below.

Older GDB versions:

pwndbg> help add-symbol-file
Load symbols from FILE, assuming FILE has been dynamically loaded.
Usage: add-symbol-file FILE ADDR [-readnow | -readnever | -s SECT-NAME SECT-ADDR]...
ADDR is the starting address of the file's text.
Each '-s' argument provides a section name and address, and
should be specified if the data and bss segments are not contiguous
with the text.  SECT-NAME is a section name to be loaded at SECT-ADDR.
The '-readnow' option will cause GDB to read the entire symbol file
immediately.  This makes the command slower, but may make future operations
faster.
The '-readnever' option will prevent GDB from reading the symbol file's
symbolic debug information.
pwndbg> version
Gdb:      8.1.1
Python:   3.6.9 (default, Jun 29 2022, 11:45:57)  [GCC 8.4.0]
Pwndbg:   1.1.1 build: c5d8800
Capstone: 4.0.1024
Unicorn:  2.0.7

Newer GDB versions:

pwndbg> help add-symbol-file
Load symbols from FILE, assuming FILE has been dynamically loaded.
Usage: add-symbol-file FILE [-readnow | -readnever] [-o OFF] [ADDR] [-s SECT-NAME SECT-ADDR]...
ADDR is the starting address of the file's text.
Each '-s' argument provides a section name and address, and
should be specified if the data and bss segments are not contiguous
with the text.  SECT-NAME is a section name to be loaded at SECT-ADDR.
OFF is an optional offset which is added to the default load addresses
of all sections for which no other address was specified.
The '-readnow' option will cause GDB to read the entire symbol file
immediately.  This makes the command slower, but may make future operations
faster.
The '-readnever' option will prevent GDB from reading the symbol file's
symbolic debug information.
pwndbg> version
Gdb:      12.1
Python:   3.10.6 (main, Nov  2 2022, 18:53:38) [GCC 11.3.0]
Pwndbg:   1.1.1 build: c5d8800
Capstone: 4.0.1024
Unicorn:  2.0.0
pwndbg>

@disconnect3d disconnect3d changed the title Fix CI: cymbol test Fix cymbol on Ubuntu 18.04 Dec 3, 2022
@disconnect3d disconnect3d changed the title Fix cymbol on Ubuntu 18.04 Fix cymbol command on Ubuntu 18.04 Dec 3, 2022
disconnect3d added a commit that referenced this issue Dec 3, 2022
The cymbol command did not work on old GDB versions like 8.2 because
they require the ADDR argument to be passed into the `add-symbol-file`
command unlike newer GDB versions in which the argument is optional.

This can be seen below.

```
pwndbg> help add-symbol-file
Load symbols from FILE, assuming FILE has been dynamically loaded.
Usage: add-symbol-file FILE ADDR [-readnow | -readnever | -s SECT-NAME SECT-ADDR]...
ADDR is the starting address of the file's text.
Each '-s' argument provides a section name and address, and
should be specified if the data and bss segments are not contiguous
with the text.  SECT-NAME is a section name to be loaded at SECT-ADDR.
The '-readnow' option will cause GDB to read the entire symbol file
immediately.  This makes the command slower, but may make future operations
faster.
The '-readnever' option will prevent GDB from reading the symbol file's
symbolic debug information.
pwndbg> version
Gdb:      8.1.1
Python:   3.6.9 (default, Jun 29 2022, 11:45:57)  [GCC 8.4.0]
Pwndbg:   1.1.1 build: c5d8800
Capstone: 4.0.1024
Unicorn:  2.0.7
```

vs

```
pwndbg> help add-symbol-file
Load symbols from FILE, assuming FILE has been dynamically loaded.
Usage: add-symbol-file FILE [-readnow | -readnever] [-o OFF] [ADDR] [-s SECT-NAME SECT-ADDR]...
ADDR is the starting address of the file's text.
Each '-s' argument provides a section name and address, and
should be specified if the data and bss segments are not contiguous
with the text.  SECT-NAME is a section name to be loaded at SECT-ADDR.
OFF is an optional offset which is added to the default load addresses
of all sections for which no other address was specified.
The '-readnow' option will cause GDB to read the entire symbol file
immediately.  This makes the command slower, but may make future operations
faster.
The '-readnever' option will prevent GDB from reading the symbol file's
symbolic debug information.
pwndbg> version
Gdb:      12.1
Python:   3.10.6 (main, Nov  2 2022, 18:53:38) [GCC 11.3.0]
Pwndbg:   1.1.1 build: c5d8800
Capstone: 4.0.1024
Unicorn:  2.0.0
pwndbg>
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants