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

Fix Ghidra Function Header Parameter Name and Typing for Stack Variables #36

Open
Flipout50 opened this issue Feb 28, 2024 · 0 comments
Labels
bug Something isn't working ghidra

Comments

@Flipout50
Copy link
Collaborator

https://github.com/binsync/libbs/blob/7928b24511eb82dd52f06fb1f9fc52e98bc2735a/libbs/decompilers/ghidra/interface.py#L355C32-L355C40

The code under this TODO currenty updates the parameter name and type if that parameter is being passed through a register. If you try to change the parameter for a stack var argument, like the second parameter of entry() in the fauxware test binary, the change will not go through. Below is some example libbs code that demonstrates the problem:

func_addr = deci.art_lifter.lift_addr(0x400580)
entry = deci.functions[func_addr]
func_args = entry.header.args
func_args[0].name = "new_name_1"
func_args[0].type = "int"
func_args[0].size = 4  
func_args[1].name = "new_name_2"
func_args[1].type = "double"
func_args[1].size = 8
deci.functions[func_addr] = entry
print(deci.functions[func_addr].header.args)
print(func_args)

When running the above with the DecompilerInterface connected to Ghidra with the fauxware binary loaded, you should see that the first parameter, the one passed by register, updates fine but the second one, a stack var, remains unchanged.

@Flipout50 Flipout50 changed the title Fix Ghidra Function Header Parameter Name and Typeing for Stack Variables Fix Ghidra Function Header Parameter Name and Typing for Stack Variables Apr 3, 2024
@Flipout50 Flipout50 added bug Something isn't working ghidra labels Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ghidra
Projects
None yet
Development

No branches or pull requests

1 participant