|
|
|
|
@ -23,16 +23,6 @@ from pwndbg.color import ColorConfig
|
|
|
|
|
from pwndbg.color import ColorParamSpec
|
|
|
|
|
from pwndbg.color import message
|
|
|
|
|
|
|
|
|
|
# We prefix all of our configuration options with a special `aglib-` prefix if
|
|
|
|
|
# we detect that gdblib is present. Pwndbg doesn't allow multiple settings under
|
|
|
|
|
# the same name, so we have to add a unique prefix until we move all of Pwndbg
|
|
|
|
|
# to this module, rather than the gdblib one.
|
|
|
|
|
#
|
|
|
|
|
# TODO: Port the rest of Pwndbg to this module and get rid of `pwndbg.gdblib.nearpc`.
|
|
|
|
|
cfg_prefix = ""
|
|
|
|
|
if pwndbg.dbg.is_gdblib_available():
|
|
|
|
|
cfg_prefix = "aglib-"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def ljust_padding(lst):
|
|
|
|
|
longest_len = max(map(len, lst)) if lst else 0
|
|
|
|
|
@ -40,7 +30,7 @@ def ljust_padding(lst):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c = ColorConfig(
|
|
|
|
|
f"{cfg_prefix}nearpc",
|
|
|
|
|
"nearpc",
|
|
|
|
|
[
|
|
|
|
|
ColorParamSpec("symbol", "normal", "color for nearpc command (symbol)"),
|
|
|
|
|
ColorParamSpec("address", "normal", "color for nearpc command (address)"),
|
|
|
|
|
@ -58,37 +48,35 @@ c = ColorConfig(
|
|
|
|
|
import pwndbg.arguments
|
|
|
|
|
|
|
|
|
|
nearpc_branch_marker = pwndbg.color.theme.add_param(
|
|
|
|
|
f"{cfg_prefix}nearpc-branch-marker", " ↓", "branch marker line for nearpc command"
|
|
|
|
|
"nearpc-branch-marker", " ↓", "branch marker line for nearpc command"
|
|
|
|
|
)
|
|
|
|
|
nearpc_branch_marker_contiguous = pwndbg.color.theme.add_param(
|
|
|
|
|
f"{cfg_prefix}nearpc-branch-marker-contiguous",
|
|
|
|
|
"nearpc-branch-marker-contiguous",
|
|
|
|
|
" ",
|
|
|
|
|
"contiguous branch marker line for nearpc command",
|
|
|
|
|
)
|
|
|
|
|
pwndbg.color.theme.add_param(
|
|
|
|
|
f"{cfg_prefix}highlight-pc", True, "whether to highlight the current instruction"
|
|
|
|
|
)
|
|
|
|
|
pwndbg.color.theme.add_param(f"{cfg_prefix}nearpc-prefix", "►", "prefix marker for nearpc command")
|
|
|
|
|
pwndbg.config.add_param(f"{cfg_prefix}left-pad-disasm", True, "whether to left-pad disassembly")
|
|
|
|
|
pwndbg.color.theme.add_param("highlight-pc", True, "whether to highlight the current instruction")
|
|
|
|
|
pwndbg.color.theme.add_param("nearpc-prefix", "►", "prefix marker for nearpc command")
|
|
|
|
|
pwndbg.config.add_param("left-pad-disasm", True, "whether to left-pad disassembly")
|
|
|
|
|
nearpc_lines = pwndbg.config.add_param(
|
|
|
|
|
f"{cfg_prefix}nearpc-lines", 10, "number of additional lines to print for the nearpc command"
|
|
|
|
|
"nearpc-lines", 10, "number of additional lines to print for the nearpc command"
|
|
|
|
|
)
|
|
|
|
|
show_args = pwndbg.config.add_param(
|
|
|
|
|
f"{cfg_prefix}nearpc-show-args", True, "whether to show call arguments below instruction"
|
|
|
|
|
"nearpc-show-args", True, "whether to show call arguments below instruction"
|
|
|
|
|
)
|
|
|
|
|
show_comments = pwndbg.config.add_param(
|
|
|
|
|
f"{cfg_prefix}nearpc-integration-comments",
|
|
|
|
|
"nearpc-integration-comments",
|
|
|
|
|
True,
|
|
|
|
|
"whether to show comments from integration provider",
|
|
|
|
|
)
|
|
|
|
|
show_opcode_bytes = pwndbg.config.add_param(
|
|
|
|
|
f"{cfg_prefix}nearpc-num-opcode-bytes",
|
|
|
|
|
"nearpc-num-opcode-bytes",
|
|
|
|
|
0,
|
|
|
|
|
"number of opcode bytes to print for each instruction",
|
|
|
|
|
param_class=pwndbg.lib.config.PARAM_ZUINTEGER,
|
|
|
|
|
)
|
|
|
|
|
opcode_separator_bytes = pwndbg.config.add_param(
|
|
|
|
|
f"{cfg_prefix}nearpc-opcode-separator-bytes",
|
|
|
|
|
"nearpc-opcode-separator-bytes",
|
|
|
|
|
1,
|
|
|
|
|
"number of spaces between opcode bytes",
|
|
|
|
|
param_class=pwndbg.lib.config.PARAM_ZUINTEGER,
|
|
|
|
|
|