diff --git a/gef.py b/gef.py index 4cba2f391..f4344bab3 100644 --- a/gef.py +++ b/gef.py @@ -3841,7 +3841,7 @@ def parse_address(address: str) -> int: """Parse an address and return it as an Integer.""" if is_hex(address): return int(address, 16) - return to_unsigned_long(gdb.parse_and_eval(address)) + return int(gdb.parse_and_eval(address)) def is_in_x86_kernel(address: int) -> bool: diff --git a/tests/commands/entry_break.py b/tests/commands/entry_break.py index 96a94965c..49035851a 100644 --- a/tests/commands/entry_break.py +++ b/tests/commands/entry_break.py @@ -13,9 +13,12 @@ def test_cmd_entry_break(self): gdb = self._gdb # run once (ok) - res = gdb.execute("entry-break", to_string=True).strip() - assert res.startswith("[+] Breaking at") + lines = (gdb.execute("entry-break", to_string=True) or "").strip().splitlines() + + # expect the entry point string pattern + assert len(lines) >= 2 + assert any(line.startswith("[+] Breaking at entry-point") for line in lines) # re-run while session running (nok) - res = gdb.execute("entry-break", to_string=True).strip() + res = (gdb.execute("entry-break", to_string=True) or "").strip() assert "gdb is already running" in res diff --git a/tests/commands/highlight.py b/tests/commands/highlight.py index 615d02750..b1449c43c 100644 --- a/tests/commands/highlight.py +++ b/tests/commands/highlight.py @@ -13,9 +13,10 @@ class HighlightCommand(RemoteGefUnitTestGeneric): def test_cmd_highlight(self): gdb = self._gdb + gdb.execute("start") + gdb.execute("gef config context.layout stack") gdb.execute("gef config gef.disable_color 0") - gdb.execute("start") for cmd in [ "highlight add 41414141 yellow", @@ -23,12 +24,11 @@ def test_cmd_highlight(self): "highlight add 43434343 green", "highlight add 44444444 pink", 'patch string $sp "AAAABBBBCCCCDDDD"', - "hexdump qword $sp -s 2", ]: gdb.execute(cmd) - res = gdb.execute("context", to_string=True) - self.assertIn(f"{Color.YELLOW.value}41414141{Color.NORMAL.value}", res) - self.assertIn(f"{Color.BLUE.value}42424242{Color.NORMAL.value}", res) - self.assertIn(f"{Color.GREEN.value}43434343{Color.NORMAL.value}", res) - self.assertIn(f"{Color.PINK.value}44444444{Color.NORMAL.value}", res) + res: str = (gdb.execute("hexdump qword $sp -s 2", to_string=True) or "").strip() + assert f"{Color.YELLOW.value}41414141{Color.NORMAL.value}" in res + assert f"{Color.BLUE.value}42424242{Color.NORMAL.value}" in res + assert f"{Color.GREEN.value}43434343{Color.NORMAL.value}" in res + assert f"{Color.PINK.value}44444444{Color.NORMAL.value}" in res