integration ¤
Functions:
-
decomp2dbg_path–Returns the absolute path to the directory where decomp2dbg is installed.
-
check_decomp2dbg_version–Checks the version of the decomp2dbg python module.
-
check_outdated_ghidra_plugin–Check if the user likely has an outdated version of the ghidra plugin.
-
ghidra_decomp2dbg_version–Save the required decomp2dbg version to a known file.
-
print_d2d_version– -
install_generic_plugin–Arguments:
-
install_ida_plugin– -
install_binja_plugin– -
install_angr_plugin– -
install_ghidra_plugin– -
install– -
disconnect– -
connect– -
soft_connection_check–If we are not connected, try to connect (and sync).
-
jump– -
sync–Arguments:
-
list_one_frame– -
list_all_frames– -
list_– -
setbase– -
decompiler_integration– -
auto_jump– -
automatic_operations– -
decomp–
Attributes:
-
d2d_required_version_str(str) – -
d2d_cache_dir(Path) – -
ida_plugin_path– -
binja_plugin_path– -
angr_plugin_path– -
decompiler_host– -
decompiler_port– -
subparsers– -
parser_connect– -
parser_disconnect– -
parser_sync– -
parser_jump– -
parser_install– -
install_subparsers– -
parser_install_ida– -
parser_install_binja– -
parser_install_ghidra– -
parser_install_angr– -
parser_decomp– -
parser_list– -
parser_set_base– -
should_autosync_syms– -
should_autosync_vars– -
should_autojump– -
parser–
d2d_required_version_str module-attribute ¤
ida_plugin_path module-attribute ¤
ida_plugin_path = add_param(
"decompiler-ida-plugin-path",
str(home() / ".idapro/plugins"),
"where to install the ida integration plugin",
param_class=PARAM_STRING,
)
binja_plugin_path module-attribute ¤
binja_plugin_path = add_param(
"decompiler-binja-plugin-path",
str(home() / ".binaryninja/plugins"),
"where to install the binary ninja integration plugin",
param_class=PARAM_STRING,
)
angr_plugin_path module-attribute ¤
angr_plugin_path = add_param(
"decompiler-angr-plugin-path",
str(home() / ".local/share/angr-management/plugins"),
"where to install the angr integration plugin",
param_class=PARAM_STRING,
)
decompiler_host module-attribute ¤
decompiler_host = add_param(
"decompiler-host",
"localhost",
"the host where the decompiler is exposed",
param_class=PARAM_STRING,
)
decompiler_port module-attribute ¤
decompiler_port = add_param(
"decompiler-port",
3662,
"the port on which the decompiler is exposed",
param_class=PARAM_UINTEGER,
)
parser_connect module-attribute ¤
parser_connect = add_parser(
"connect",
aliases=["c"],
help="Connect to the decompiler",
description="\nConnect to the decompiler.\n\nThe host and port to connect to are governed by the `decompiler-host`\nand `decompiler-port` config variables. Try `help set decompiler-host`.\n",
)
parser_disconnect module-attribute ¤
parser_disconnect = add_parser(
"disconnect",
aliases=["d"],
help="Disconnect from the decompiler",
description="Disconnect from the decompiler.",
)
parser_sync module-attribute ¤
parser_sync = add_parser(
"sync",
aliases=["s"],
help="Sync data from the decompiler",
description="\nSync data from the decompiler.\n\nCheck out `help set decompiler-auto-sync`.\n",
)
parser_jump module-attribute ¤
parser_jump = add_parser(
"jump",
aliases=["j"],
help="Make the decompiler's cursor jump to the PC",
description="\nMake the decompiler's cursor jump to the PC.\n\nCheck out `help set decompiler-auto-jump`.\n",
)
parser_install module-attribute ¤
parser_install = add_parser(
"install",
help="Install the decompiler plugins",
description="\nInstall/update the decompiler plugins.\n\nYou need a decompiler plugin installed to allow the decompiler to communicate\nback to Pwndbg. The decompiler plugins are from decomp2dbg (<3).\n\nIf you already have decomp2dbg installed, this command will overwrite\nthat installation in order to pin the proper version that Pwndbg needs. You will\nstill be able to use decomp2dbg outside of Pwndbg.\n\nYou should take care not to invoke `source /path/to/decomp2dbg/d2d.py` in your ~/.gdbinit\nbecause we implement the debugger-side logic independently, and it might conflict.\n",
)
install_subparsers module-attribute ¤
parser_install_ida module-attribute ¤
parser_install_ida = add_parser(
"ida",
help="Install the IDA decompiler plugin",
description="Install the IDA decompiler plugin.",
)
parser_install_binja module-attribute ¤
parser_install_binja = add_parser(
"binja",
help="Install the Binary Ninja decompiler plugin",
description="Install the Binary Ninja decompiler plugin.",
)
parser_install_ghidra module-attribute ¤
parser_install_ghidra = add_parser(
"ghidra",
help="Install the Ghidra decompiler plugin",
description="Install the Ghidra decompiler plugin.",
)
parser_install_angr module-attribute ¤
parser_install_angr = add_parser(
"angr",
help="Install the angr-management decompiler plugin",
description="Install the angr-managment decompiler plugin.",
)
parser_decomp module-attribute ¤
parser_decomp = add_parser(
"decomp",
help="Just use the `decomp` command",
description="Just use the `decomp` command.",
)
parser_list module-attribute ¤
parser_list = add_parser(
"list",
aliases=["l"],
help="List the variables for the current stack frame",
description='\nList the variables for the current stack frame.\n\nWill not be accurate in a function\'s prologue (before the stack pointer has been adjusted).\nThe "frame" for the purposes of this command is (usually) the location of the saved return address.\n',
)
parser_set_base module-attribute ¤
parser_set_base = add_parser(
"setbase",
help="Manually set the base memory address of the decompiled binary",
description="\nManually set the base memory address of the decompiled binary.\n\nNormally, Pwndbg will use the file path that the decompiler reports for the binary and\ncheck it against all files mapped into memory to find the correct base address.\n\nIf for some reason the file names differ or your binary does not show up in the memory\nmappings, you can manually set the base address using this command. This is commonly\nneeded when debugging a kernel module.\n\nIf you wish to re-enable automatic base address detection, set this value to -1 (or\nrestart Pwndbg).\n",
)
should_autosync_syms module-attribute ¤
should_autosync_syms = add_param(
"decompiler-autosync-syms",
False,
"whether to sync symbols with the decompiler on every stop",
param_class=PARAM_BOOLEAN,
help_docstring="\nDepending on the decompiler, the number of symbols (functions + global variables)\nthe binary you are decompiling has, and various other factors, this may or may not\nbe a good idea. Try it out and see.\n\nCheck out the other decompiler-auto* configuration variables as well.\n",
)
should_autosync_vars module-attribute ¤
should_autosync_vars = add_param(
"decompiler-autosync-vars",
True,
"whether to sync function variables with the decompiler on every stop",
param_class=PARAM_BOOLEAN,
help_docstring="\nThis is generally lightweight, so it is enabled by default. Try disabling\nit if you have performance issues.\n\nCheck out the other decompiler-auto* configuration variables as well.\n",
)
should_autojump module-attribute ¤
should_autojump = add_param(
"decompiler-autojump",
False,
"whether to jump the decompiler cursor on every stop",
param_class=PARAM_BOOLEAN,
help_docstring="\nDepending on the decompiler, this may or may not be a good idea.\nTry it out and see.\n\nCheck out the other decompiler-auto* configuration variables as well.\n",
)
parser module-attribute ¤
parser = ArgumentParser(
description="Use the current integration to decompile code near an address."
)
decomp2dbg_path ¤
Returns the absolute path to the directory where decomp2dbg is installed.
If Pwndbg is installed from source this will be /path/to/pwndbg/.venv/lib/python3.13/site-packages/decomp2dbg.
check_decomp2dbg_version ¤
Checks the version of the decomp2dbg python module.
Returns True if the version is supported, prints an error message and returns False otherwise.
check_outdated_ghidra_plugin ¤
Check if the user likely has an outdated version of the ghidra plugin.
Tell them to update if yes and return False. If everything is up to date return True.
This should only be checked if (decompiler_host == "localhost").
ghidra_decomp2dbg_version ¤
Save the required decomp2dbg version to a known file.
install_generic_plugin ¤
install_generic_plugin(
paths: list[tuple[Path, Path]],
decomp_name: str,
packaged_plugin_path: Path,
config_var: Parameter,
)
Parameters:
-
paths(list[tuple[Path, Path]]) –A list of (source path, destination path) tuples. Each element of the list will be symlinked (destination) -> (source).
-
decomp_name(str) –Pretty name of the decompiler.
-
packaged_plugin_path(Path) –The path of the folder for the decompiler plugin in the decomp2dbg python package.
-
config_var(Parameter) –The variable which holds the destination plugin path.
soft_connection_check ¤
If we are not connected, try to connect (and sync).
If we were connected, or succeed in connecting, return True, otherwise False.
sync ¤
Parameters:
-
fail_quietly(bool) –If we don't pass the preliminary checks required to perform the sync, don't print anything.
decompiler_integration ¤
decompiler_integration(
command: str,
jump_addr: int | None = None,
install_sub: str = "",
list_all: bool = False,
binary_addr: int = -1,
)