Minor refactor of aglib/regs.py:get_register (#2583)

TL;DR: Don't check `frame` if it is not `None` already.
pull/2589/head
Disconnect3d 1 year ago committed by GitHub
parent 4fa42857ec
commit 1aa585af5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -41,11 +41,11 @@ def get_register(
) -> pwndbg.dbg_mod.Value | None:
if frame is None:
frame = pwndbg.dbg.selected_frame()
if frame is None:
# `read_reg` will return None when it catches this exception. This
# mirrors how a `gdb.error` causes `read_reg` to return `None` in
# gdblib when no frame is selected.
raise pwndbg.dbg_mod.Error("No currently selected frame to read registers from")
if frame is None:
# `read_reg` will return None when it catches this exception. This
# mirrors how a `gdb.error` causes `read_reg` to return `None` in
# gdblib when no frame is selected.
raise pwndbg.dbg_mod.Error("No currently selected frame to read registers from")
regs = regs_in_frame(frame)

Loading…
Cancel
Save