1
0
Fork 0
mirror of https://github.com/isledecomp/isle.git synced 2025-04-21 02:50:52 -04:00

Fix Ghidra import call type ()

Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
jonschz 2024-08-31 17:00:35 +02:00 committed by GitHub
parent b898d98515
commit 0256fc4acf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions
tools/ghidra_scripts/lego_util

View file

@ -162,30 +162,30 @@ class FullPdbFunctionImporter(PdbFunctionImporter):
return_type_match = True
# match arguments: decide if thiscall or not, and whether the `this` type matches
thiscall_matches = (
calling_convention_match = (
self.signature.call_type == ghidra_function.getCallingConventionName()
)
ghidra_params_without_this = list(ghidra_function.getParameters())
if thiscall_matches and self.signature.call_type == "__thiscall":
if calling_convention_match and self.signature.call_type == "__thiscall":
this_argument = ghidra_params_without_this.pop(0)
thiscall_matches = self._this_type_match(this_argument)
calling_convention_match = self._this_type_match(this_argument)
if self.is_stub:
# We do not import the argument list for stubs, so it should be excluded in matches
args_match = True
elif thiscall_matches:
elif calling_convention_match:
args_match = self._parameter_lists_match(ghidra_params_without_this)
else:
args_match = False
logger.debug(
"Matches: namespace=%s name=%s return_type=%s thiscall=%s args=%s",
"Matches: namespace=%s name=%s return_type=%s calling_convention=%s args=%s",
namespace_match,
name_match,
return_type_match,
thiscall_matches,
calling_convention_match,
"ignored" if self.is_stub else args_match,
)
@ -193,7 +193,7 @@ class FullPdbFunctionImporter(PdbFunctionImporter):
name_match
and namespace_match
and return_type_match
and thiscall_matches
and calling_convention_match
and args_match
)

View file

@ -61,7 +61,7 @@ class PdbFunctionExtractor:
_call_type_map = {
"ThisCall": "__thiscall",
"C Near": "__thiscall",
"C Near": "default",
"STD Near": "__stdcall",
}