GP-5661 - Fix SourceType issue in Apply Data Archives

This commit is contained in:
ghizard 2025-05-13 12:45:19 -04:00
parent a1b6084c88
commit b15b51e48e

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -47,7 +47,7 @@ public class ApplyFunctionDataTypesCmd extends BackgroundCommand<Program> {
/** /**
* Constructs a new command to apply all function signature data types * Constructs a new command to apply all function signature data types
* in the given data type manager. * in the given data type manager.
* *
* @param managers list of data type managers containing the function signature data types * @param managers list of data type managers containing the function signature data types
* @param set set of addresses containing labels to match against function names. * @param set set of addresses containing labels to match against function names.
* The addresses must not already be included in the body of any existing function. * The addresses must not already be included in the body of any existing function.
@ -71,7 +71,7 @@ public class ApplyFunctionDataTypesCmd extends BackgroundCommand<Program> {
/** /**
* Constructs a new command to apply all function signature data types * Constructs a new command to apply all function signature data types
* in the given data type category (includes all subcategories). * in the given data type category (includes all subcategories).
* *
* @param sourceCategory datatype category containing the function signature data types * @param sourceCategory datatype category containing the function signature data types
* @param set set of addresses containing labels to match against function names. * @param set set of addresses containing labels to match against function names.
* The addresses must not already be included in the body of any existing function. * The addresses must not already be included in the body of any existing function.
@ -158,7 +158,7 @@ public class ApplyFunctionDataTypesCmd extends BackgroundCommand<Program> {
/** /**
* Strip off the last name of the string * Strip off the last name of the string
* *
* @param name the original string * @param name the original string
* @return the last name in the string * @return the last name in the string
*/ */
@ -259,7 +259,8 @@ public class ApplyFunctionDataTypesCmd extends BackgroundCommand<Program> {
} }
SourceType mostTrusted = getMostTrustedParameterSource(func); SourceType mostTrusted = getMostTrustedParameterSource(func);
if (alwaysReplace || !source.isLowerPriorityThan(mostTrusted)) { // Do not replace function if one with same SourceType exists
if (alwaysReplace || source.isHigherPriorityThan(mostTrusted)) {
applyFunction(sym, fdef); applyFunction(sym, fdef);
} }
return; return;
@ -308,7 +309,7 @@ public class ApplyFunctionDataTypesCmd extends BackgroundCommand<Program> {
/** /**
* Check that the symbol looks like it is at the start of a function. * Check that the symbol looks like it is at the start of a function.
* There can be internal symbols that may match a function name. * There can be internal symbols that may match a function name.
* *
* @param monitor if need to cancel * @param monitor if need to cancel
* @param address location of the potential symbol * @param address location of the potential symbol
* @return true if the symbol is at the start of a function flow * @return true if the symbol is at the start of a function flow
@ -342,7 +343,7 @@ public class ApplyFunctionDataTypesCmd extends BackgroundCommand<Program> {
/** /**
* Get the instruction directly before this address, makeing sure it is the * Get the instruction directly before this address, makeing sure it is the
* head instruction in a delayslot * head instruction in a delayslot
* *
* @param address to get instruction before * @param address to get instruction before
* @return instruction if found, null otherwise * @return instruction if found, null otherwise
*/ */
@ -395,7 +396,7 @@ public class ApplyFunctionDataTypesCmd extends BackgroundCommand<Program> {
/** /**
* Lookup any program symbol with the same name as the function signature. * Lookup any program symbol with the same name as the function signature.
* Also allow for a single '_' in front of the symbol name. * Also allow for a single '_' in front of the symbol name.
* *
* @param symbolMap map of symbol names to all matching symbols * @param symbolMap map of symbol names to all matching symbols
* @param prefix optional prefix on symbol to lookup * @param prefix optional prefix on symbol to lookup
* @param functionName function name * @param functionName function name