diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2023-02-28 16:29:51 -0500 |
|---|---|---|
| committer | Jordan Wiens <jordan@psifertex.com> | 2023-02-28 16:29:51 -0500 |
| commit | 719b91d18a3869b2a8ed44f904fc50f952dfa18f (patch) | |
| tree | 63f528a75ff67b3348110c83d9229e2956512f2f /docs | |
| parent | b57e34087f3c2e9bc76b841720a728bb54fbbf4d (diff) | |
another example on applying a type to memory where none exists
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/guide/type.md | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/guide/type.md b/docs/guide/type.md index 1ad59dfa..090e7196 100644 --- a/docs/guide/type.md +++ b/docs/guide/type.md @@ -604,6 +604,19 @@ current_function.parameter_vars[0].type = Type.pointer(bv.arch, Type.char()) >>> bv.get_data_var_at(here).type = Type.char() ``` +#### Applying a type where non exists yet + +In some instances you may need to first create a `DataVariable` before you can set the type at a given location: + +```python +>>> bv.get_data_var_at(here) +# Nothing there yet! +>>> bv.define_user_data_var(here, "char*") +<var 0x22d50787c: char*> +``` + +Note that most of the APIs that take a Type object also take a C-style type string as a convenience helper as demonstrated as a difference between the last two examples. + ### Headers Importing a header goes through the same code path as parsing source directly. You will just have to read the file and specify the appropriate command-line arguments as an array. See [above](#import-header-file) for directions for choosing arguments. |
