Skip to content

Commit fc20358

Browse files
committed
Docs: Note about AnalysisContext vs Function
1 parent cde1c38 commit fc20358

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/dev/bnil-modifying.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,13 @@ Let's call the new function `new_func` and the existing function `old_func`.
239239
}
240240
```
241241

242+
???+ Note "Note"
243+
You may notice that the sample code above mentions always using `AnalysisContext.llil` (C++: `AnalysisContext::GetLowLevelIL()`) to access the relevant Low Level IL function,
244+
and you may be wondering why the sample doesn't instead use `AnalysisContext.function.llil` (C++: `AnalysisContext::GetFunction()->GetLowLevelILFunction()`).
245+
This is because you must **always access IL Functions directly through `AnalysisContext`** when writing Workflow Activities, as that is where the current, up-to-date analysis information is stored.
246+
During analysis, the `LowLevelILFunction` object stored in the `AnalysisContext` object contains the in-progress analysis information from the current run of the Workflow,
247+
whereas the `LowLevelILFunction` object stored on the Function object is from the previous run of the Workflow and contains stale analysis data.
248+
242249
Then, going block-by-block, copy the instructions from `old_func` to `new_func`.
243250
When you reach a part where you want to insert new instructions (or replace instructions), do that instead of simply copying the old instructions.
244251

0 commit comments

Comments
 (0)