0

Given an instance of something that implements ghidra.program.model.listing.Function, and the register as a string (e.g. x0) how can I get the name of the argument (e.g. param1)?

1 Answer 1

-1

The first way I found is (as Kotlin code)

function.parameters.first { it.variableStorage.register.toString() == "x0" }.name

i.e. go through the parameters and find the first (and hopefully only one), that has a storage location with the string representation x0.

This feels somewhat hacky, but should at least work. The whole expression type checks, so it should cover basically all cases, and I am not sure if there can ever be a case where somehow multiple parameters are stored in the same register that have the same string representation.

Your Answer

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

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