-
Notifications
You must be signed in to change notification settings - Fork 5
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
Give overloaded functions a unique name #76
Conversation
While the change sounds nice, I am a little confused what the impact of this change is. Where does the user observe the new names? Or are they just added for potential future use? I haven't seen an obvious impact on Also, do you have a good idea on how to test this change? |
This will be very useful once it ends up in the ASM diff (once const is added too). I've been matching functions with calls to functions like operator[] of Vector where the constness matters and right now it's hard to distinguish in the diff |
I added some tests for the Right now, this just changes the sanitized assembly output. It's most useful in This feature is probably more useful at the beginning of a decomp. It's more likely to expose a problem with annotations than a genuine diff where you called the wrong function. For example: in If I add this as a new field to The repeated names are const versus non-const return types. |
The reason to not add this to the text output from |
I'll briefly look into using JSON on the |
Thanks to @jonschz and isledecomp/isle#1352 we can now enable this for text and html output. Should we try to get the const return types added here or in a follow up? |
I'm fine with adding it in a follow-up. Will try to do the review today |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great overall!
)""", | ||
(EntityType.FUNCTION,), | ||
): | ||
# TODO: Thunk's link to the original function is lost once the record is created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we set a unique name for an overloaded function, we should also update any thunks that point to it. The problem is that we don't set an attribute on the thunk entity that refers back to the original function, so there isn't any way to do this without re-reading all the thunks from the binary.
It is also the case that multiple thunks can point at the same function, so it would be wrong (and not very helpful) to have Thunk of 'Example::Function'(1)
and Thunk of 'Example::Function'(2)
, if both point to the same thing.
We need to record the link between the thunk and actual function when we create the thunk entity. One complication with doing this is that we have no single global unique ID. Instead we have two: orig_addr and recomp_addr, so we need to have two "reference" attributes, one for each binary. I have some stashed code that will address this but it's part of a larger change that allows for two entities to be merged when we match their addresses.
Update: Now enabled for console and HTML output from
asmcmp
.For functions with the same name but different parameters (overloaded functions) we set a unique name that contains the argument list and use this in asm sanitize. For example:
list<MxDriver,allocator<MxDriver> >::iterator::operator++(int)
MxRect32::MxRect32(void)
MxPalette::MxPalette(struct tagRGBQUAD const *)
This is done by running the symbol from the PDB through the demangler function. If we don't have a symbol for some reason, we just number the function.
This uses a new entity attribute "computed_name" as to not interfere with "name". The ghidra scripts need the base name without arguments to set the function labels.
Limitations: