GP-6008 Changed SourceType examination to base upon priorty instead of specific value equality when appropriate

This commit is contained in:
ghidra1 2025-09-24 09:16:04 -04:00
parent edea7dfd65
commit a3bd708160
20 changed files with 131 additions and 144 deletions

View file

@ -150,12 +150,12 @@ public class DecompilerParameterIdCmd extends BackgroundCommand<Program> {
// since decompile could fail and leave the source types changed.
Parameter retParam = func.getReturn();
if (retParam != null) {
if (!retParam.getSource().isHigherPriorityThan(sourceTypeClearLevel)) {
if (retParam.getSource().isLowerOrEqualPriorityThan(sourceTypeClearLevel)) {
func.setReturn(retParam.getDataType(), retParam.getVariableStorage(),
SourceType.DEFAULT);
}
}
if (!func.getSignatureSource().isHigherPriorityThan(sourceTypeClearLevel)) {
if (func.getSignatureSource().isLowerOrEqualPriorityThan(sourceTypeClearLevel)) {
func.setSignatureSource(SourceType.DEFAULT);
}
}

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -36,7 +36,7 @@ import ghidra.util.exception.InvalidInputException;
public class OverridePrototypeAction extends AbstractDecompilerAction {
public OverridePrototypeAction() {
super("Override Signature");
super("Override Signature");
setHelpLocation(new HelpLocation(HelpTopics.DECOMPILER, "ActionOverrideSignature"));
setPopupMenuData(new MenuData(new String[] { "Override Signature" }, "Decompile"));
}
@ -174,11 +174,9 @@ public class OverridePrototypeAction extends AbstractDecompilerAction {
// for the initial signature. HighFunction does not make it easy to grab
// existing override prototype
if (calledfunc != null) {
SourceType signatureSource = calledfunc.getSignatureSource();
if (signatureSource == SourceType.DEFAULT || signatureSource == SourceType.ANALYSIS) {
calledfunc = null; // ignore
}
if (calledfunc != null &&
calledfunc.getSignatureSource().isLowerOrEqualPriorityThan(SourceType.ANALYSIS)) {
calledfunc = null; // ignore
}
StringBuffer buf = new StringBuffer();

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -63,6 +63,8 @@ public class DecompilerParameterIDValidator extends PostAnalysisValidator {
if (inst != null) {
final SourceType signatureSource = func.getSignatureSource();
// TODO: There is a misconception that ANALYSIS source type can be used to
// determine if Param ID Analyzer has been used. This should be re-examined.
if (signatureSource == SourceType.ANALYSIS) {
++numFuncsWithParameterID;
}