MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / write_breakpoint

Function write_breakpoint

python/examples/breakpoint.py:25–41  ·  view source on GitHub ↗

Sample function to show registering a plugin menu item for a range of bytes. Also possible: register register_for_address register_for_function

(view, start, length)

Source from the content-addressed store, hash-verified

23
24
25def write_breakpoint(view, start, length):
26 """Sample function to show registering a plugin menu item for a range of bytes. Also possible:
27 register
28 register_for_address
29 register_for_function
30 """
31 bkpt_str = {"x86": "int3", "x86_64": "int3", "armv7": "bkpt", "aarch64": "brk #0", "mips32": "break"}
32
33 if view.arch.name not in bkpt_str:
34 log_error("Architecture %s not supported" % view.arch.name)
35 return
36
37 bkpt, err = view.arch.assemble(bkpt_str[view.arch.name])
38 if bkpt is None:
39 log_error(err)
40 return
41 view.write(start, bkpt * length // len(bkpt))
42
43
44PluginCommand.register_for_range("Convert to breakpoint", "Fill region with breakpoint instructions.", write_breakpoint)

Callers

nothing calls this directly

Calls 3

log_errorFunction · 0.90
assembleMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected