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

Convert libc_args_definitions to gef.ui.libc_args_table #821

Merged
merged 1 commit into from Feb 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions gef.py
Expand Up @@ -3518,19 +3518,19 @@ def load_libc_args() -> bool:
_libc_args_file = path / f"{_arch_mode}.json"

# current arch and mode already loaded
if _arch_mode in gef.ui.highlight_table:
if _arch_mode in gef.ui.libc_args_table:
return True

gef.ui.highlight_table[_arch_mode] = {}
gef.ui.libc_args_table[_arch_mode] = {}
try:
with _libc_args_file.open() as _libc_args:
gef.ui.highlight_table[_arch_mode] = json.load(_libc_args)
gef.ui.libc_args_table[_arch_mode] = json.load(_libc_args)
return True
except FileNotFoundError:
del gef.ui.highlight_table[_arch_mode]
del gef.ui.libc_args_table[_arch_mode]
warn(f"Config context.libc_args is set but definition cannot be loaded: file {_libc_args_file} not found")
except json.decoder.JSONDecodeError as e:
del gef.ui.highlight_table[_arch_mode]
del gef.ui.libc_args_table[_arch_mode]
warn(f"Config context.libc_args is set but definition cannot be loaded from file {_libc_args_file}: {e}")
return False

Expand Down Expand Up @@ -8547,7 +8547,7 @@ def __get_current_block_start_address() -> Optional[int]:
if function_name.endswith("@plt"):
_function_name = function_name.split("@")[0]
try:
nb_argument = len(gef.ui.highlight_table[_arch_mode][_function_name])
nb_argument = len(gef.ui.libc_args_table[_arch_mode][_function_name])
except KeyError:
pass

Expand Down Expand Up @@ -11524,6 +11524,7 @@ def __init__(self) -> None:
self.context_hidden = False
self.stream_buffer : Optional[StringIO] = None
self.highlight_table: Dict[str, str] = {}
self.libc_args_table: Dict[str, Dict[str, Dict[str, str]]] = {}
self.watches: Dict[int, Tuple[int, str]] = {}
self.context_messages: List[str] = []
return
Expand Down