I am using Ghidra and when clicking for example in the decompile window on a specific raw, it change the cursor in the assembly window to the exact location in the assembly. Is there any option to do this using Ghidra scripting ?


  • Can you give an example for what you mean ? I need to decompile the code using "getDecompiledFunction" and then i can use this function "getReferencesFrom" ?
    – Logan
    Apr 28, 2020 at 19:09
  • @R4444 - forgot to tag you
    – Logan
    Apr 28, 2020 at 19:17
  • Do you mean you have a list of addresses that you want to change the location in the assembly (listing) window to? If so, you can just use the GhidraScript method setCurrentLocation May 1, 2020 at 23:33
  • @DanielDan You could write a comment under the specific answer (R4444's one, in this case), to ask follow up questions on it. May 25, 2020 at 6:55

1 Answer 1


If you want instruction access references to a particular variable, then first define the reference manager:

refmanager = program.referenceManager

Then lets say you get all the local variables of a particular function - using -

vars = function.getLocalVariables()

You can get references to a particular variable:

for var in vars:
    for ref in refmanager.getReferencesTo(var):

In this case ref will be of type Reference. The you can get particular references using this api. Also check this for other options.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.