From 2f8133edfa68244ab7df12af32a69112e123dd75 Mon Sep 17 00:00:00 2001 From: lebr0nli <61896187+lebr0nli@users.noreply.github.com> Date: Mon, 23 Jan 2023 23:28:38 +0800 Subject: [PATCH] Refactor the code for showing opcodes Remove `else` caluse (https://github.com/pwndbg/pwndbg/pull/1537/files#r1083835300) --- pwndbg/gdblib/nearpc.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pwndbg/gdblib/nearpc.py b/pwndbg/gdblib/nearpc.py index 740bb14c4..63d015202 100644 --- a/pwndbg/gdblib/nearpc.py +++ b/pwndbg/gdblib/nearpc.py @@ -165,6 +165,7 @@ def nearpc(pc=None, lines=None, emulate=False, repeat=False) -> List[str]: symbol = C.highlight(symbol) first_pc = False + opcodes = "" if show_opcodes_size > 0: opcodes = instr.bytes.hex() opcodes = opcodes[: show_opcodes_size * 2] @@ -175,9 +176,7 @@ def nearpc(pc=None, lines=None, emulate=False, repeat=False) -> List[str]: opcodes = opcodes.ljust(align, " ") if pwndbg.gdblib.config.highlight_pc and instr.address == pwndbg.gdblib.regs.pc: opcodes = C.highlight(opcodes) - line = " ".join((prefix, address_str, opcodes, symbol, asm)) - else: - line = " ".join((prefix, address_str, symbol, asm)) + line = " ".join((prefix, address_str, opcodes, symbol, asm)) # If there was a branch before this instruction which was not # contiguous, put in some ellipses.