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

Remove the assert on get_register #754

Merged
merged 3 commits into from
Nov 28, 2021
Merged
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
22 changes: 12 additions & 10 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -3041,18 +3041,21 @@ def get_register(regname):

@lru_cache()
def __get_register_for_selected_frame(regname, hash_key):
# 1st chance
try:
return parse_address(regname)
except gdb.error:
assert regname[0] == "$"
regname = regname[1:]
try:
value = gdb.selected_frame().read_register(regname)
return int(value)
except ValueError:
return None
except gdb.error:
return None
pass

# 2nd chance
try:
regname == regname.lstrip("$")
value = gdb.selected_frame().read_register(regname)
return int(value)
except (ValueError, gdb.error):
pass
return None


def get_path_from_info_proc():
for x in gdb.execute("info proc", to_string=True).splitlines():
Expand Down Expand Up @@ -8109,7 +8112,6 @@ def do_invoke(self, argv, *args, **kwargs):
Shdr.SHT_PREINIT_ARRAY: "PREINIT_ARRAY",
Shdr.SHT_GROUP: "GROUP",
Shdr.SHT_SYMTAB_SHNDX: "SYMTAB_SHNDX",
Shdr.SHT_NUM: "NUM",
Shdr.SHT_LOOS: "LOOS",
Shdr.SHT_GNU_ATTRIBUTES:"GNU_ATTRIBUTES",
Shdr.SHT_GNU_HASH: "GNU_HASH",
Expand Down