Skip to content

Commit 591ff37

Browse files
committed
UEFIHelper: Correct source type for function updates
The decompiler documentation (under Welcome to Help > Ghidra Functionality > Decompiler > Program Annotations Affecting the Decompiler) states that the defined parameters are only used by the decompiler if it is forced (i.e., using a source type other than default): Discovering Parameters The input parameter and return value annotations of the function prototype, like any variable annotations, can be forcing on the Decompiler (see the complete discussion in Forcing Data-types). But keep in mind: The input parameters and return value are all forced on the Decompiler as a unit based on the Signature Source. They are all forced if the type is set to anything other than DEFAULT; otherwise none of them are forced. If the function prototype's annotations are not forcing, the Decompiler will attempt to discover the parameters and return value using the calling convention. The prototype model underlying the calling convention dictates which storage locations can be considered as parameters and their formal ordering. UEFIHelper currently uses SourceType.DEFAULT which causes the signature updates to be ignored by decompiler. Switch to SourceType.ANALYSIS to fix this. Fixes: #40
1 parent f54438b commit 591ff37

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

ghidra_scripts/UEFIHelper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ private void updateFunctionSignature(Function function,
104104
currentProgram);
105105

106106
// Update the function with the generated parameter list and return type.
107-
function.setName(definition.getName(), SourceType.DEFAULT);
107+
function.setName(definition.getName(), SourceType.ANALYSIS);
108108
function.updateFunction(null, returnType, parameters,
109-
FunctionUpdateType.DYNAMIC_STORAGE_FORMAL_PARAMS, false, SourceType.DEFAULT);
109+
FunctionUpdateType.DYNAMIC_STORAGE_FORMAL_PARAMS, false, SourceType.ANALYSIS);
110110
}
111111

112112
/**
@@ -298,7 +298,7 @@ private void propagateFunctionParameters(DecompInterface decompiler, DecompileOp
298298
if (parameters.size() == originalParameters.length) {
299299
function.updateFunction(null, null, parameters,
300300
FunctionUpdateType.DYNAMIC_STORAGE_FORMAL_PARAMS, false,
301-
SourceType.DEFAULT);
301+
SourceType.ANALYSIS);
302302
println("Updated " + function.getName() + " function signature");
303303
} else {
304304
Msg.error(this, "Failed to parse " + function.getName() + " parameters");

0 commit comments

Comments
 (0)