Struct Overlapping Single Variables on Stack
If I understand the following correctly, I do not believe we currently support this use-case. But, I can understand how/why it would be useful. So, we should consider adding support for this.
EDIT: Vector 35 employees, please see the private issue that has been linked into this one below that discusses some implementation details.
Discussed in https://github.com/Vector35/binaryninja-api/discussions/5260
Originally posted by utkonos April 10, 2024
When a particular address on the stack is used for different variables, they're all created automatically and nicely (this is just an examples of overlap at an address; these particular variables are totally not related to the problem below):
However, if I want to set the type to a struct that overlaps the locations used previously on the stack, after setting that type, the other varables are gone. Is there a way to get this to work?
Here is how the Stack view looks before. That struct is incorrectly a pointer at the moment just as a placeholder.
The two variables enc_str.size and fill_value are both input parameters for init_string here:
That function cleans up the stack via ret 8.
Later in the function, space is created for the struct on the stack via sub esp, 0x18. For some reason, if I set the type at that location to the struct, it blows away those two previous stack variables.
I want to keep those two variables in the second screenshot above and set a struct at the same addresses in the stack. This way it reflects both usages at the different points in the function.
Is what I want to do possible? I can always just write comments to work around this, but the downstream uses of that struct don't show up nicely with the members in the disassembly view.