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

Move GEF to a Python 3.10 baseline #1133

Merged
merged 10 commits into from
Sep 26, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
runner: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04]
runner: [ubuntu-24.04, ubuntu-22.04]

name: "Run Unit tests on ${{ matrix.runner }}"
runs-on: ${{ matrix.runner }}
Expand Down
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ persistent=yes

# Minimum Python version to use for version dependent checks. Will default to
# the version used to run pylint.
py-version=3.6
py-version=3.10

# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10.14
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ from the debugging runtime.

## Instant Setup

Simply make sure you have [GDB 8.0 or higher](https://www.gnu.org/s/gdb) compiled with Python3.6+
Simply make sure you have [GDB 10.0 or higher](https://www.gnu.org/s/gdb) compiled with Python3.10+
bindings, then:

```bash
Expand Down
8 changes: 3 additions & 5 deletions docs/compat.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

This matrix indicates the version of Python and/or GDB

| GEF version | GDB Python compatibility* | Python compatibility** |
| GEF version | GDB Python compatibility | Python compatibility |
|:--:|:--:|:--:|
| [2018.02](https://github.com/hugsy/gef/releases/tag/2018.02) | 7.2 | Python 2.7, Python 3.4+ |
| [2020.03](https://github.com/hugsy/gef/releases/tag/2020.03) | 7.4 | Python 2.7, Python 3.4+ |
| [2022.01](https://github.com/hugsy/gef/releases/tag/2021.01) | 7.7 | Python 3.4+ |
| [Current](https://github.com/hugsy/gef/tree/main) | 8.0+ | Python 3.6+ |

** Up to (included)
| [2022.01](https://github.com/hugsy/gef/releases/tag/2022.01) | 8.0 | Python 3.6+ |
| [2024.09](https://github.com/hugsy/gef/releases/tag/2024.09) | 10.0 | Python 3.10+ |
16 changes: 8 additions & 8 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ new architectures very easily as well!
Also, PEDA development has been quite idle for a few years now, and many new interesting features a
debugger can provide simply do not exist.

## What if my GDB is < 8.0 ?
## What if my GDB is < 10.0 ?

GDB was introduced with its Python support early 2011 with the release of GDB 7. A (very) long way
has gone since and the Python API has been massively improved, and GEF is taking advantage of them
to provide the coolest features with as little performance impact as possible.

Currently, GEF is optimized for running against GDB version 8.0+, and Python 3.6+. This allows for a
best performance and best use of the GDB Python API. However, GEF can run on older versions too,
Currently, GEF is optimized for running against GDB version 10.0+, and Python 3.10+. This allows for
the best performance and use of the GDB Python API. However, GEF can run on older versions too,
check out [the version compatibility matrix](compat.md). For really older versions of GDB, you can
use [`gef-legacy`](https://github.com/hugsy/gef-legacy) which supports a lot of older GDB, and a
Python 2/3 compatibility layer.

Therefore, it is highly recommended to run GEF with the latest version of GDB. However, all
functions should work on a GDB 8.0 and up. If not, send a [bug
report](https://github.com/hugsy/gef/issues) and provide as much details as possible.
functions should work on a GDB 10.0 and up. If not, send a [bug
report](https://github.com/hugsy/gef/issues) and provide as many details as possible.

If you are running an obsolete version, GEF will show a error and message and exit.

Expand All @@ -36,7 +36,7 @@ Some pre-compiled static binaries for both recent GDB and GDBServer can be downl

## I cannot get GEF setup

GEF will work on any GDB 8+ compiled with Python 3.6+ support. You can view that commands that
GEF will work on any GDB 10+ compiled with Python 3.10+ support. You can view that commands that
failed to load using `gef missing`, but this will not affect GEF generally.

If you experience problems setting it up on your host, first go to the [Discord
Expand All @@ -45,8 +45,8 @@ channel](https://discord.gg/HCS8Hg7) for that. You will find great people there
Note that the GitHub issue section is to be used to **report bugs** and **GEF issues** (like
unexpected crash, improper error handling, weird edge case, etc.), not a place to ask for help.

All recent distributions ship packaged GDB that should be ready-to-go, with a GDB >= 8.0 and Python
3.6+. Any version higher or equal will work just fine. So you might actually only need to run `apt
All recent distributions ship packaged GDB that should be ready-to-go, with GDB >= 10.0 and Python
3.10+. Any version higher or equal will work just fine. So you might actually only need to run `apt
install gdb` to get the full-force of GEF.

## I get a SegFault when starting GDB with GEF
Expand Down
7 changes: 3 additions & 4 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ your OS package manager to install them.

### GDB

Only [GDB 8 and higher](https://www.gnu.org/s/gdb) is required. It must be compiled with Python 3.6
Only [GDB 10.0 and higher](https://www.gnu.org/s/gdb) is required. It must be compiled with Python 3.10
or higher support. For most people, simply using your distribution package manager should be enough.

As of January 2020, GEF officially doesn't support Python 2 any longer, due to Python 2 becoming
Expand All @@ -36,8 +36,7 @@ This should display your version of Python compiled with `gdb`.

```bash
$ gdb -nx -ex 'pi print(sys.version)' -ex quit
3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0]
3.12.3 (main, Jul 31 2024, 17:43:48) [GCC 13.2.0]
```

### Python dependencies
Expand All @@ -56,7 +55,7 @@ easily extended via
### Quick install

The quickest way to get started with GEF is through the installation script available. Simply make
sure you have [GDB 8.0 or higher](https://www.gnu.org/s/gdb), compiled with Python 3.6 or higher,
sure you have [GDB 10.0 or higher](https://www.gnu.org/s/gdb), compiled with Python 3.10 or higher,
and run

```bash
Expand Down
7 changes: 6 additions & 1 deletion gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,12 @@ def _search_for_realpath(self) -> Optional[str]:
@property
def realpath(self) -> str:
# when in a `gef-remote` session, realpath returns the path to the binary on the local disk, not remote
return self.path if gef.session.remote is None else self._search_for_realpath()
if gef.session.remote is None:
return self.path
default = self._search_for_realpath()
if default:
return default
raise FileNotFoundError

def __str__(self) -> str:
return (f"Section(start={self.page_start:#x}, end={self.page_end:#x}, "
Expand Down
Loading