Add Config Option for Branch Jump Markers (#3242)

- disasm-branch-on for branches that WILL be taken (default: '✔')
- disasm-branch-off for branches that will NOT be taken (default: '✘')
pull/3248/head
gregbartell 4 months ago committed by GitHub
parent e43542852a
commit 254da3975c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -348,6 +348,28 @@ Color for disasm (branch/call instruction).
----------
## **disasm-branch-off**
Marker for branches that will NOT be taken.
**Default:** '✘'
----------
## **disasm-branch-on**
Marker for branches that WILL be taken.
**Default:** '✔'
----------
## **enhance-comment-color**

@ -13,6 +13,7 @@ from pwndbg.color import ColorConfig
from pwndbg.color import ColorParamSpec
from pwndbg.color import ljust_colored
from pwndbg.color import strip
from pwndbg.color import theme
from pwndbg.color.message import off
from pwndbg.color.message import on
@ -23,6 +24,13 @@ c = ColorConfig(
],
)
config_branch_on = theme.add_param(
"disasm-branch-on", "", "marker for branches that WILL be taken"
)
config_branch_off = theme.add_param(
"disasm-branch-off", "", "marker for branches that will NOT be taken"
)
# Returns colorized instructions assembly and operands, and checkmark if branch is taken
# Example: `✔ je _IO_file_xsputn+341`. Inline symbol replacements made. No annotation or branch targets shown.
@ -41,9 +49,9 @@ def one_instruction(ins: PwndbgInstruction) -> str:
# If we know the conditional is taken, mark it as taken.
if ins.condition == InstructionCondition.TRUE or ins.is_conditional_jump_taken:
asm = on(" ") + asm
asm = on(f"{config_branch_on} ") + asm
elif ins.condition == InstructionCondition.FALSE:
asm = off(" ") + asm
asm = off(f"{config_branch_off} ") + asm
else:
asm = f" {asm}"

Loading…
Cancel
Save