mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
Merge remote-tracking branch 'origin/GP-4886_ghidra1_UnassignedStorageForDefaultDatatype'
This commit is contained in:
commit
83d38b8368
6 changed files with 82 additions and 28 deletions
|
@ -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.
|
||||
|
@ -2470,16 +2470,6 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
return thunkedFunction.getSignatureSource();
|
||||
}
|
||||
|
||||
// Force DEFAULT source if any param has unassigned storage
|
||||
if (!getReturn().isValid()) {
|
||||
return SourceType.DEFAULT;
|
||||
}
|
||||
for (Parameter param : getParameters()) {
|
||||
if (!param.isValid()) {
|
||||
return SourceType.DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
return getStoredSignatureSource();
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -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.
|
||||
|
@ -23,8 +23,7 @@ import java.util.ArrayList;
|
|||
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.address.AddressSpace;
|
||||
import ghidra.program.model.data.DataType;
|
||||
import ghidra.program.model.data.DataTypeManager;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.lang.protorules.*;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.model.listing.VariableStorage;
|
||||
|
@ -133,6 +132,12 @@ public class ParamListStandard implements ParamList {
|
|||
if (dt.isZeroLength()) {
|
||||
return AssignAction.NO_ASSIGNMENT;
|
||||
}
|
||||
if (dt == DataType.DEFAULT) {
|
||||
return AssignAction.NO_ASSIGNMENT;
|
||||
}
|
||||
if (dt instanceof TypeDef td && td.getBaseDataType() == DataType.DEFAULT) {
|
||||
return AssignAction.NO_ASSIGNMENT;
|
||||
}
|
||||
for (ModelRule modelRule : modelRules) {
|
||||
int responseCode = modelRule.assignAddress(dt, proto, pos, dtManager, status, res);
|
||||
if (responseCode != AssignAction.FAIL) {
|
||||
|
|
|
@ -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.
|
||||
|
@ -210,11 +210,12 @@ public class LocalSymbolMap {
|
|||
pcaddr = pcaddr.subtractWrap(1);
|
||||
|
||||
List<HighSymbol> paramList = new ArrayList<>();
|
||||
boolean internalInvalid = false;
|
||||
for (int i = 0; i < p.length; ++i) {
|
||||
Parameter var = p[i];
|
||||
if (!var.isValid()) {
|
||||
// TODO: exclude parameters which don't have valid storage ??
|
||||
continue;
|
||||
internalInvalid = true;
|
||||
break;
|
||||
}
|
||||
DataType dt = var.getDataType();
|
||||
String name = var.getName();
|
||||
|
@ -243,6 +244,12 @@ public class LocalSymbolMap {
|
|||
paramSymbol.setNameLock(namelock);
|
||||
paramSymbol.setTypeLock(lock);
|
||||
}
|
||||
if (internalInvalid) {
|
||||
// Can only send down a partial prototype. Let decompiler try to recover the whole.
|
||||
for (HighSymbol paramSymbol : paramList) {
|
||||
paramSymbol.setTypeLock(false);
|
||||
}
|
||||
}
|
||||
|
||||
paramSymbols = new HighSymbol[paramList.size()];
|
||||
paramList.toArray(paramSymbols);
|
||||
|
|
|
@ -1147,10 +1147,7 @@ public class PcodeDataTypeManager {
|
|||
private void generateCoreTypes() {
|
||||
voidDt = new VoidDataType(progDataTypes);
|
||||
coreBuiltin = new HashMap<Long, TypeMap>();
|
||||
TypeMap type = new TypeMap(DataType.DEFAULT, "undefined", "unknown", false, false,
|
||||
DEFAULT_DECOMPILER_ID);
|
||||
coreBuiltin.put(type.id, type);
|
||||
type = new TypeMap(displayLanguage, VoidDataType.dataType, "void", false, false,
|
||||
TypeMap type = new TypeMap(displayLanguage, VoidDataType.dataType, "void", false, false,
|
||||
builtInDataTypes);
|
||||
coreBuiltin.put(type.id, type);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue