Skip to content

Commit c17a0d2

Browse files
authored
Restore support for Python3.6 on LTS 18.04 (#1061)
Removed one debug print, and replaced `typing.OrderedDict` with `typing.Dict` (brings little and breaks compat)
1 parent e123b87 commit c17a0d2

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

gef.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
from io import StringIO, TextIOWrapper
8585
from types import ModuleType
8686
from typing import (Any, ByteString, Callable, Dict, Generator, Iterable,
87-
Iterator, List, NoReturn, Optional, OrderedDict, Sequence, Set, Tuple, Type, TypeVar,
87+
Iterator, List, NoReturn, Optional, Sequence, Set, Tuple, Type, TypeVar,
8888
Union, cast)
8989
from urllib.request import urlopen
9090

@@ -6466,7 +6466,6 @@ def do_invoke(self, _: List[str], **kwargs: Any) -> None:
64666466
return
64676467
try:
64686468
arena_addr = parse_address(args.arena_address)
6469-
print(f"{arena_addr=:#x}")
64706469
arena = GlibcArena(f"*{arena_addr:#x}")
64716470
self.dump_chunks_arena(arena, ctx)
64726471
except gdb.error:
@@ -9678,8 +9677,8 @@ def __init__(self) -> None:
96789677
gef.config["gef.main_arena_offset"] = GefSetting("", str, "Offset from libc base address to main_arena symbol (int or hex). Set to empty string to disable.")
96799678
gef.config["gef.propagate_debug_exception"] = GefSetting(False, bool, "If true, when debug mode is enabled, Python exceptions will be propagated all the way.")
96809679

9681-
self.commands : OrderedDict[str, GenericCommand] = collections.OrderedDict()
9682-
self.functions : OrderedDict[str, GenericFunction] = collections.OrderedDict()
9680+
self.commands : Dict[str, GenericCommand] = collections.OrderedDict()
9681+
self.functions : Dict[str, GenericFunction] = collections.OrderedDict()
96839682
self.missing: Dict[str, Exception] = {}
96849683
return
96859684

@@ -10121,13 +10120,13 @@ def __init__(self) -> None:
1012110120

1012210121
def invoke(self, args: Any, from_tty: bool) -> None:
1012310122
self.dont_repeat()
10124-
missing_commands = gef.gdb.missing
10123+
missing_commands: Dict[str, Exception] = gef.gdb.missing
1012510124
if not missing_commands:
1012610125
ok("No missing command")
1012710126
return
1012810127

10129-
for missing_command, reason in missing_commands.items():
10130-
warn(f"Command `{missing_command}` is missing, reason {RIGHT_ARROW} {reason}")
10128+
for cmd, reason in missing_commands.items():
10129+
warn(f"Missing `{cmd}`, reason: {str(reason)}")
1013110130
return
1013210131

1013310132

0 commit comments

Comments
 (0)