You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
int main(int argc, char *argv[])
{
static char buf[10] = "";
/* OK */
buf[9] = 'A';
return 0;
}
I am using ghidra python api to get the variables used. Something like:
function.getStackFrame().getStackVariables()
But, buffer buf doesn't show up (it shows up in the ghidra gui, in the code disassembly section). Is there any way to get these using python api? My guess is that, as it is defined static it doesn't show up.
Edit:
I found that these variables are defined in the namespaces. So, in the case, buf is defined in namespaces->main->buf. I was able to get the namespace for the function - currentProgram.getSymbolTable().getNamespace(entrypoint), but was not able to find the variables.
This discussion was converted from issue #861 on March 21, 2023 14:24.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a simple code:
I am using ghidra python api to get the variables used. Something like:
function.getStackFrame().getStackVariables()
But, buffer
buf
doesn't show up (it shows up in the ghidra gui, in the code disassembly section). Is there any way to get these using python api? My guess is that, as it is definedstatic
it doesn't show up.Edit:
I found that these variables are defined in the namespaces. So, in the case, buf is defined in
namespaces->main->buf
. I was able to get the namespace for the function -currentProgram.getSymbolTable().getNamespace(entrypoint)
, but was not able to find the variables.Beta Was this translation helpful? Give feedback.
All reactions