diff options
| author | Glenn Smith <glenn@vector35.com> | 2025-08-12 13:06:30 -0700 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2025-08-12 13:07:08 -0700 |
| commit | fc20358f808446f89e6feae7ea1a254b4d364a1c (patch) | |
| tree | 782fb87ac6fa2ff9bba771d9ca2bb32f24e49fae /docs/dev | |
| parent | cde1c38689188efbfd47cd9509beb348284d486b (diff) | |
Docs: Note about AnalysisContext vs Function
Diffstat (limited to 'docs/dev')
| -rw-r--r-- | docs/dev/bnil-modifying.md | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/docs/dev/bnil-modifying.md b/docs/dev/bnil-modifying.md index 629f862f..0973a7c9 100644 --- a/docs/dev/bnil-modifying.md +++ b/docs/dev/bnil-modifying.md @@ -239,6 +239,13 @@ Let's call the new function `new_func` and the existing function `old_func`. } ``` +???+ Note "Note" + You may notice that the sample code above mentions always using `AnalysisContext.llil` (C++: `AnalysisContext::GetLowLevelIL()`) to access the relevant Low Level IL function, + and you may be wondering why the sample doesn't instead use `AnalysisContext.function.llil` (C++: `AnalysisContext::GetFunction()->GetLowLevelILFunction()`). + 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. + During analysis, the `LowLevelILFunction` object stored in the `AnalysisContext` object contains the in-progress analysis information from the current run of the Workflow, + whereas the `LowLevelILFunction` object stored on the Function object is from the previous run of the Workflow and contains stale analysis data. + Then, going block-by-block, copy the instructions from `old_func` to `new_func`. When you reach a part where you want to insert new instructions (or replace instructions), do that instead of simply copying the old instructions. |
