Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API for CallOther Name #9

Open
toolCHAINZ opened this issue Aug 29, 2024 · 2 comments
Open

Add API for CallOther Name #9

toolCHAINZ opened this issue Aug 29, 2024 · 2 comments
Labels
enhancement New feature or request jingle_sleigh Involves the sleigh FFI

Comments

@toolCHAINZ
Copy link
Owner

sleigh has some internal mechanism for querying the name associated with a callother id. Need to find this API and expose it to rust.

@toolCHAINZ toolCHAINZ added enhancement New feature or request jingle_sleigh Involves the sleigh FFI labels Aug 29, 2024
@chf0x
Copy link

chf0x commented Aug 29, 2024

Found it here, but I am not sure is it part of sleigh?

https://github.com/NationalSecurityAgency/ghidra/blob/master/Ghidra/Features/Decompiler/src/decompile/cpp/userop.hh#L339

and it is populated here:

https://github.com/NationalSecurityAgency/ghidra/blob/master/Ghidra/Features/Decompiler/src/decompile/cpp/sleighbase.cc#L101

can be accessed from:

https://github.com/NationalSecurityAgency/ghidra/blob/master/Ghidra/Features/Decompiler/src/decompile/cpp/architecture.hh#L209

Locally, I implemented name extraction by retrieving the actual analyzed instruction mnemonic and using it as the callother name. Do you think we still need an API for the callother name when it can be extracted this way?

//I'd like to confirm that the first parameter of the input is indeed the callother ID.

@toolCHAINZ
Copy link
Owner Author

Poked around at what you found (thanks!) and it looks like the sleigh context has this helper function:

https://github.com/NationalSecurityAgency/ghidra/blob/master/Ghidra%2FFeatures%2FDecompiler%2Fsrc%2Fdecompile%2Fcpp%2Ftranslate.hh#L391-L399

So we could add that in to the FFI and expose that mapping to rust. It looks like the op ids are assumed to be sequential, without gaps, and are assigned programmatically by sleigh when it parses the user ops from the spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request jingle_sleigh Involves the sleigh FFI
Projects
None yet
Development

No branches or pull requests

2 participants