summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJordan Wiens <jordan@psifertex.com>2023-11-30 17:02:29 -0500
committerJordan Wiens <jordan@psifertex.com>2023-11-30 17:02:29 -0500
commitd40ab66a50fa8f33451458be15582c7a8d93fd5f (patch)
tree973cbc06def10dbe2f7a11c3ce90137f5e83c50d /docs
parent49cb6a4245a832685a897a37beb2035e46f3fef5 (diff)
add docs on analysis updating in repl vs scripts
Diffstat (limited to 'docs')
-rw-r--r--docs/dev/concepts.md12
-rw-r--r--docs/guide/index.md3
2 files changed, 15 insertions, 0 deletions
diff --git a/docs/dev/concepts.md b/docs/dev/concepts.md
index f962ba0d..43bef354 100644
--- a/docs/dev/concepts.md
+++ b/docs/dev/concepts.md
@@ -8,6 +8,18 @@ APIs that query these mappings are plural. So for example, while `current_hlil.l
![Mapping between ILs ><](../img/ilmapping.png "Mapping between ILs")
+## REPL versus Scripts
+
+When you're interacting with the Binary Ninja [scripting console](../guide/index.md#script-python-console), it's important to realize that every time you run a command, the UI is automatically going to update analysis. You can see this by even running a simply command like:
+
+```
+print("test")
+```
+
+and then checking the `Log` pane where you will see an `Analysis update took #.###` message. This is a convenience the UI does for you just like if you were to change a type or create a function, you almost always want the analysis to be updated. However, in scripts you run yourself as plugins or via the "Run Script" command, you may not get the same results mid-execution until after the entire script is finished running.
+
+![Scriping Console ><](../img/console.png "Python Scripting Console")
+
## Operating on IL versus Native
Generally speaking, scripts should operate on ILs. The available information far surpasses the native addresses and querying properties and using APIs almost always beats directly manipulating bytes. However, when it comes time to change the binary, there are some operations that can only be done at a simple virtual address. So for example, the [comment](https://api.binary.ninja/binaryninja.binaryview-module.html#binaryninja.binaryview.BinaryView.set_comment_at) or [tag](https://api.binary.ninja/binaryninja.binaryview-module.html#binaryninja.binaryview.BinaryView.add_tag) APIs (among others) work off of native addressing irrespective of IL level.
diff --git a/docs/guide/index.md b/docs/guide/index.md
index 0832288c..3292ca95 100644
--- a/docs/guide/index.md
+++ b/docs/guide/index.md
@@ -672,6 +672,9 @@ From here, you can add any custom functions or objects you want to be available
#### "Run Script..."
+???+ Danger "Warning"
+ When you run commands in the scripting console, the UI will automatically update analysis. This is because quite often when you make a change in the console you expect it to be immediately reflected in the UI. The same is not true when running a script where you must trigger `bv.update_analysis_and_wait()` or `current_function.reanalze()` to experience the same behavior.
+
The "Run Script..." option in the File Menu allows loading a python script from your filesystem and executing it
within the console. It can also be run via the Command Palette or bound to a key.