mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-01 10:10:13 +08:00
GP-4886 Corrected speculative param storage determination
This commit is contained in:
+202
-198
File diff suppressed because it is too large
Load Diff
+40
-4
@@ -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.
|
||||
@@ -239,6 +239,10 @@ public class PrototypeModel {
|
||||
* i.e. {@link AutoParameterType#RETURN_STORAGE_PTR}, this routine will not pass back
|
||||
* the storage location of the pointer, but will typically pass
|
||||
* back the location of the normal return register which holds a copy of the pointer.
|
||||
* <br>
|
||||
* Note: storage will not be assigned to the {@link DataType#DEFAULT default undefined} datatype
|
||||
* or zero-length datatype.
|
||||
*
|
||||
* @param dataType first parameter dataType or null for an undefined type.
|
||||
* @param program is the Program
|
||||
* @return return location or {@link VariableStorage#UNASSIGNED_STORAGE} if
|
||||
@@ -259,6 +263,16 @@ public class PrototypeModel {
|
||||
* Get the preferred parameter location for a new parameter which will appended
|
||||
* to the end of an existing set of params. If existing parameters use custom
|
||||
* storage, this method should not be used.
|
||||
* <br>
|
||||
* Note: storage will not be assigned to the {@link DataType#DEFAULT default undefined} datatype,
|
||||
* zero-length datatype, or any subsequent parameter following such a parameter.
|
||||
* <br>
|
||||
* Warning: The use of this method is discourage since it can produce inaccurate
|
||||
* results. It is recommended that a complete function signature be used in
|
||||
* conjunction with the {@link #getStorageLocations(Program, DataType[], boolean)}
|
||||
* method. Parameter storage allocation may be affected by the return datatype
|
||||
* used on a function (e.g., hidden return storage parameter).
|
||||
*
|
||||
* @param params existing set parameters to which the next parameter will
|
||||
* be appended. (may be null)
|
||||
* @param dataType dataType associated with next parameter location or null
|
||||
@@ -266,7 +280,9 @@ public class PrototypeModel {
|
||||
* @param program is the Program
|
||||
* @return next parameter location or {@link VariableStorage#UNASSIGNED_STORAGE} if
|
||||
* unable to determine suitable location
|
||||
* @deprecated use of {@link #getStorageLocations(Program, DataType[], boolean)} is preferred.
|
||||
*/
|
||||
@Deprecated
|
||||
public VariableStorage getNextArgLocation(Parameter[] params, DataType dataType,
|
||||
Program program) {
|
||||
return getArgLocation(params != null ? params.length : 0, params, dataType, program);
|
||||
@@ -276,15 +292,31 @@ public class PrototypeModel {
|
||||
* Get the preferred parameter location for a specified index,
|
||||
* which will be added/inserted within the set of existing function params.
|
||||
* If existing parameters use custom storage, this method should not be used.
|
||||
* <br>
|
||||
* Note: storage will not be assigned to the {@link DataType#DEFAULT default undefined} datatype,
|
||||
* zero-length datatype, or any subsequent parameter following such a parameter.
|
||||
* <br>
|
||||
* Warning: The use of this method is discourage since it can produce inaccurate
|
||||
* results. It is recommended that a complete function signature be used in
|
||||
* conjunction with the {@link #getStorageLocations(Program, DataType[], boolean)}
|
||||
* method. Parameter storage allocation may be affected by the return datatype
|
||||
* used on a function (e.g., hidden return storage parameter).
|
||||
*
|
||||
* @param argIndex is the index
|
||||
* @param params existing set parameters to which the parameter specified by
|
||||
* argIndex will be added/inserted be appended (may be null).
|
||||
* argIndex will be added/inserted be appended. The preceeding parameters
|
||||
* are required for an accurate storage determination to be made. Any preceeding
|
||||
* parameters not specified will be assumed as a 1-byte integer type which could
|
||||
* cause an erroneous storage result to be returned. A null params list will cause
|
||||
* all preceeding params to be assumed in a similar fashion.
|
||||
* @param dataType dataType associated with next parameter location or null
|
||||
* for a default undefined type.
|
||||
* @param program is the Program
|
||||
* @return parameter location or {@link VariableStorage#UNASSIGNED_STORAGE} if
|
||||
* unable to determine suitable location
|
||||
* @deprecated use of {@link #getStorageLocations(Program, DataType[], boolean)} is preferred.
|
||||
*/
|
||||
@Deprecated
|
||||
public VariableStorage getArgLocation(int argIndex, Parameter[] params, DataType dataType,
|
||||
Program program) {
|
||||
|
||||
@@ -302,7 +334,7 @@ public class PrototypeModel {
|
||||
arr[i + 1] = params[i].getDataType(); // Copy in current types if we have them
|
||||
}
|
||||
else {
|
||||
arr[i + 1] = DataType.DEFAULT; // Otherwise assume default (integer) type
|
||||
arr[i + 1] = Undefined1DataType.dataType; // Otherwise assume 1-byte (integer) type
|
||||
}
|
||||
}
|
||||
arr[argIndex + 1] = dataType;
|
||||
@@ -353,6 +385,10 @@ public class PrototypeModel {
|
||||
* input parameters, if needed. In this case, the dataTypes array should not include explicit entries for
|
||||
* these parameters. If addAutoParams is false, the dataTypes array is assumed to already contain explicit
|
||||
* entries for any of these parameters.
|
||||
* <br>
|
||||
* Note: storage will not be assigned to the {@link DataType#DEFAULT default undefined} datatype
|
||||
* or zero-length datatypes or any subsequent parameter following such a parameter.
|
||||
*
|
||||
* @param program is the Program
|
||||
* @param dataTypes return/parameter datatypes (first element is always the return datatype,
|
||||
* i.e., minimum array length is 1)
|
||||
|
||||
Reference in New Issue
Block a user