diff options
author | Gordon Messmer <gordon.messmer@gmail.com> | 2024-06-20 19:28:12 -0700 |
---|---|---|
committer | Gordon Messmer <gordon.messmer@gmail.com> | 2024-06-20 19:28:12 -0700 |
commit | cba7bcef56b371b4707b2a8cc2fa304df0a8fda2 (patch) | |
tree | 83ff1c050741ce572a56f0f9f768350ba0fee6e0 | |
parent | 01abb2b87d3db9c204eff1356319fa3ff51a89b5 (diff) | |
download | gdb-gef-copr-main.tar.gz gdb-gef-copr-main.tar.xz gdb-gef-copr-main.zip |
Automatic commit of package [gdb-gef] minor release [2024.06-5].HEADgdb-gef-2024.06-5main
Created by command:
/usr/bin/tito tag
-rw-r--r-- | .tito/packages/gdb-gef | 2 | ||||
-rw-r--r-- | gdb-gef.spec | 5 | ||||
-rw-r--r-- | gef-got-audit.patch | 149 |
3 files changed, 55 insertions, 101 deletions
diff --git a/.tito/packages/gdb-gef b/.tito/packages/gdb-gef index 29a519b..871bf00 100644 --- a/.tito/packages/gdb-gef +++ b/.tito/packages/gdb-gef @@ -1 +1 @@ -2024.06-4 ./ +2024.06-5 ./ diff --git a/gdb-gef.spec b/gdb-gef.spec index b0933ab..79bebe2 100644 --- a/gdb-gef.spec +++ b/gdb-gef.spec @@ -5,7 +5,7 @@ Version: 2024.06 %forgemeta -Release: 4%{?dist} +Release: 5%{?dist} Summary: GEF (GDB Enhanced Features) License: MIT @@ -83,6 +83,9 @@ python3 -m pytest -v -m "not benchmark" -m "not online" tests/ %changelog +* Thu Jun 20 2024 Gordon Messmer <gordon.messmer@gmail.com> 2024.06-5 +- Update gef-got-audit.patch for new release + * Thu Jun 20 2024 Gordon Messmer <gordon.messmer@gmail.com> 2024.06-4 - Update source tarball. (gordon.messmer@gmail.com) diff --git a/gef-got-audit.patch b/gef-got-audit.patch index cc412df..38385e2 100644 --- a/gef-got-audit.patch +++ b/gef-got-audit.patch @@ -40,51 +40,59 @@ index 0000000..e14a834 +``` + + -diff --git a/docs/install.md b/docs/install.md -index b2b5f6f..3a29fc3 100644 ---- a/docs/install.md -+++ b/docs/install.md -@@ -7,6 +7,7 @@ Therefore it requires the following binaries to be present: - - * `file` - * `readelf` -+* `nm` - * `ps` - * `python3` - +diff --git a/tests/commands/got_audit.py b/tests/commands/got_audit.py +new file mode 100644 +index 0000000..ae2470b +--- /dev/null ++++ b/tests/commands/got_audit.py +@@ -0,0 +1,42 @@ ++""" ++`got-audit` command test module ++""" ++ ++import pytest ++ ++from tests.base import RemoteGefUnitTestGeneric ++ ++from tests.utils import ( ++ ARCH, ++ ERROR_INACTIVE_SESSION_MESSAGE, ++ debug_target, ++) ++ ++ ++@pytest.mark.skipif(ARCH in ("ppc64le",), reason=f"Skipped for {ARCH}") ++class GotAuditCommand(RemoteGefUnitTestGeneric): ++ """`got-audit` command test module""" ++ ++ def setUp(self) -> None: ++ self._target = debug_target("format-string-helper") ++ return super().setUp() ++ ++ ++ def test_cmd_got_audit(self): ++ gdb = self._gdb ++ ++ self.assertEqual(ERROR_INACTIVE_SESSION_MESSAGE,gdb.execute("got-audit", to_string=True)) ++ ++ # Advance the program until after GOT symbols have been resolved ++ gdb.execute("start") ++ gdb.execute("break greetz") ++ gdb.execute("run beep") ++ gdb.execute("step 4") ++ res = gdb.execute("got-audit", to_string=True) ++ self.assertIn("printf", res) ++ self.assertIn("strcpy", res) ++ self.assertIn("/libc.so.6", res) ++ ++ res = gdb.execute("got-audit printf", to_string=True) ++ self.assertIn("printf", res) ++ self.assertNotIn("strcpy", res) diff --git a/gef.py b/gef.py -index f9c6f7e..f808e5d 100644 +index 804dbae..2093b9c 100644 --- a/gef.py +++ b/gef.py -@@ -9196,6 +9196,11 @@ class GotCommand(GenericCommand): - "Line color of the got command output for unresolved function") - return - -+ def build_line(self, name: str, color: str, address_val: int, got_address: int): -+ line = f"[{hex(address_val)}] " -+ line += Color.colorify(f"{name} {RIGHT_ARROW} {hex(got_address)}", color) -+ return line -+ - @only_if_gdb_running - def do_invoke(self, argv: List[str]) -> None: - readelf = gef.session.constants["readelf"] -@@ -9222,7 +9227,7 @@ class GotCommand(GenericCommand): - relro_status = "No RelRO" - - # retrieve jump slots using readelf -- lines = gef_execute_external([readelf, "--relocs", elf_file], as_list=True) -+ lines = gef_execute_external([readelf, "--wide", "--relocs", elf_file], as_list=True) - jmpslots = [line for line in lines if "JUMP" in line] - - gef_print(f"\nGOT protection: {relro_status} | GOT functions: {len(jmpslots)}\n ") -@@ -9250,12 +9255,68 @@ class GotCommand(GenericCommand): - else: - color = self["function_resolved"] - -- line = f"[{hex(address_val)}] " -- line += Color.colorify(f"{name} {RIGHT_ARROW} {hex(got_address)}", color) -+ line = self.build_line(name, color, address_val, got_address) - gef_print(line) +@@ -9382,6 +9382,63 @@ class GotCommand(GenericCommand): return @@ -148,60 +156,3 @@ index f9c6f7e..f808e5d 100644 @register class HighlightCommand(GenericCommand): """Highlight user-defined text matches in GEF output universally.""" -@@ -10979,7 +11040,7 @@ class GefSessionManager(GefManager): - self.aliases: List[GefAlias] = [] - self.modules: List[FileFormat] = [] - self.constants = {} # a dict for runtime constants (like 3rd party file paths) -- for constant in ("python3", "readelf", "file", "ps"): -+ for constant in ("python3", "readelf", "nm", "file", "ps"): - self.constants[constant] = which(constant) - return - -diff --git a/tests/commands/got_audit.py b/tests/commands/got_audit.py -new file mode 100644 -index 0000000..ae2470b ---- /dev/null -+++ b/tests/commands/got_audit.py -@@ -0,0 +1,42 @@ -+""" -+`got-audit` command test module -+""" -+ -+import pytest -+ -+from tests.base import RemoteGefUnitTestGeneric -+ -+from tests.utils import ( -+ ARCH, -+ ERROR_INACTIVE_SESSION_MESSAGE, -+ debug_target, -+) -+ -+ -+@pytest.mark.skipif(ARCH in ("ppc64le",), reason=f"Skipped for {ARCH}") -+class GotAuditCommand(RemoteGefUnitTestGeneric): -+ """`got-audit` command test module""" -+ -+ def setUp(self) -> None: -+ self._target = debug_target("format-string-helper") -+ return super().setUp() -+ -+ -+ def test_cmd_got_audit(self): -+ gdb = self._gdb -+ -+ self.assertEqual(ERROR_INACTIVE_SESSION_MESSAGE,gdb.execute("got-audit", to_string=True)) -+ -+ # Advance the program until after GOT symbols have been resolved -+ gdb.execute("start") -+ gdb.execute("break greetz") -+ gdb.execute("run beep") -+ gdb.execute("step 4") -+ res = gdb.execute("got-audit", to_string=True) -+ self.assertIn("printf", res) -+ self.assertIn("strcpy", res) -+ self.assertIn("/libc.so.6", res) -+ -+ res = gdb.execute("got-audit printf", to_string=True) -+ self.assertIn("printf", res) -+ self.assertNotIn("strcpy", res) |