mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
abstract what variables require dynamic storage to function
This commit is contained in:
parent
7b407f1965
commit
b88ea8c927
3 changed files with 19 additions and 2 deletions
|
@ -456,7 +456,7 @@ public class HighFunctionDBUtil {
|
|||
Variable var;
|
||||
VariableStorage storage;
|
||||
HighVariable tmpHigh = variable.getHighVariable();
|
||||
if (tmpHigh != null && tmpHigh.getRepresentative().isUnique()) {
|
||||
if (tmpHigh != null && tmpHigh.requiresDynamicStorage()) {
|
||||
storage =
|
||||
DynamicEntry.buildDynamicStorage(tmpHigh.getRepresentative(), highFunction);
|
||||
var = null;
|
||||
|
|
|
@ -176,6 +176,22 @@ public abstract class HighVariable {
|
|||
setHighOnInstances();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true in when the HighVariable should be recorded (in the database) using dynamic storage
|
||||
* rather than using the actual address space and offset of the representative varnode. Dynamic storage
|
||||
* is typically needed if the actual storage is ephemeral (in the unique space).
|
||||
* @return true if this needs dynamic storage
|
||||
*/
|
||||
public boolean requiresDynamicStorage() {
|
||||
if (represent.isUnique()) {
|
||||
return true; // Temporary Varnodes always need dynamic storage
|
||||
}
|
||||
if (represent.getAddress().isStackAddress() && !represent.isAddrTied()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore this HighVariable from a <high> XML tag
|
||||
* @param parser is the XML stream
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
package ghidra.program.model.pcode;
|
||||
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.data.AbstractFloatDataType;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.model.listing.VariableStorage;
|
||||
import ghidra.program.model.mem.MemoryBlock;
|
||||
|
@ -85,7 +86,7 @@ public class MappedEntry extends SymbolEntry {
|
|||
public void saveXml(StringBuilder buf) {
|
||||
int logicalsize = 0; // Assume datatype size and storage size are the same
|
||||
int typeLength = symbol.type.getLength();
|
||||
if (typeLength != storage.size() && typeLength > 0) {
|
||||
if (typeLength != storage.size() && symbol.type instanceof AbstractFloatDataType) {
|
||||
logicalsize = typeLength; // Force a logicalsize
|
||||
}
|
||||
String addrRes = Varnode.buildXMLAddress(storage.getVarnodes(), logicalsize);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue