mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
GP-4408 Refactor of FillOutStructureCmd. Added FillOutStructureHelper and additional DecompilerUtils methods.
This commit is contained in:
parent
434c3f315d
commit
624a3c4e9e
25 changed files with 1281 additions and 1810 deletions
|
@ -46,20 +46,20 @@ public class ApplyClassFunctionSignatureUpdatesScript extends GhidraScript {
|
|||
return;
|
||||
}
|
||||
|
||||
RecoveredClassHelper classHelper = new RecoveredClassHelper(currentProgram, currentLocation,
|
||||
state.getTool(), this, false, false, false, monitor);
|
||||
|
||||
if(currentAddress == null) {
|
||||
RecoveredClassHelper classHelper = new RecoveredClassHelper(currentProgram, state.getTool(),
|
||||
this, false, false, false, monitor);
|
||||
|
||||
if (currentAddress == null) {
|
||||
println("Cursor must be in a class function.");
|
||||
return;
|
||||
}
|
||||
Function function = getFunctionContaining(currentAddress);
|
||||
if(function == null) {
|
||||
if (function == null) {
|
||||
println("Cursor must be in a class function.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(function.isThunk()) {
|
||||
|
||||
if (function.isThunk()) {
|
||||
println("User should not edit thunks as they are auto-updated from thunked function. " +
|
||||
"Please undo changes to thunk then edit thunked function and rerun script");
|
||||
return;
|
||||
|
@ -69,14 +69,13 @@ public class ApplyClassFunctionSignatureUpdatesScript extends GhidraScript {
|
|||
println("Function definitions are not affected by purecall changes.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Namespace classNamespace = classHelper.getClassNamespace(currentAddress);
|
||||
if (classNamespace == null) {
|
||||
println("Cursor must be in a class function.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// get a vftable that points to this function - doesn't matter which since it will
|
||||
// be used to get the underlying function definition which will then be used to update
|
||||
// all related function signatures
|
||||
|
@ -84,9 +83,8 @@ public class ApplyClassFunctionSignatureUpdatesScript extends GhidraScript {
|
|||
|
||||
// get all vftables that point to given function
|
||||
if (vftablesContainingFunction.isEmpty()) {
|
||||
println(
|
||||
"Function is not a virtual function so has no function definition or related " +
|
||||
"function signatures to update");
|
||||
println("Function is not a virtual function so has no function definition or related " +
|
||||
"function signatures to update");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -107,7 +105,7 @@ public class ApplyClassFunctionSignatureUpdatesScript extends GhidraScript {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (vftableWithAppliedStructure == null) {
|
||||
println(
|
||||
"The vftable(s) containing this function do not have a valid vftable structure " +
|
||||
|
@ -159,5 +157,4 @@ public class ApplyClassFunctionSignatureUpdatesScript extends GhidraScript {
|
|||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue