summaryrefslogtreecommitdiff
path: root/python/examples/breakpoint.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/examples/breakpoint.py')
-rw-r--r--python/examples/breakpoint.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/python/examples/breakpoint.py b/python/examples/breakpoint.py
new file mode 100644
index 00000000..44df19e2
--- /dev/null
+++ b/python/examples/breakpoint.py
@@ -0,0 +1,16 @@
+from binaryninja import *
+
+def write_breakpoint(view, start, length):
+ """Sample function to show registering a plugin menu item for a range of bytes. Also possible:
+ register
+ register_for_address
+ register_for_function
+ """
+ if view.arch.name.startswith("x86"):
+ view.write(start, "\xcc" * length)
+ elif view.arch.name == "armv7":
+ view.write(start, "\x7a\x00\x20\xe1" * (length/4))
+ else:
+ log_error("No support for breakpoint on %s" % view.arch.name)
+
+PluginCommand.register_for_range("Convert to breakpoint", "Fill region with breakpoint instructions.", write_breakpoint)