mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
commit
fc27e8c4ca
3 changed files with 32 additions and 7 deletions
|
@ -173,7 +173,7 @@ public class MSDataTypeUtils {
|
||||||
// Can't get data type archive so just do nothing.
|
// Can't get data type archive so just do nothing.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (matchingDt != null) ? matchingDt : comparisonDt;
|
return (matchingDt != null) ? matchingDt.clone(programDTM) : comparisonDt;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static DataType findMatchingDataType(DataType comparisonDt,
|
private static DataType findMatchingDataType(DataType comparisonDt,
|
||||||
|
|
|
@ -315,7 +315,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
try (Transaction tx = openTransaction("")) {
|
try (Transaction tx = openTransaction("")) {
|
||||||
init(openMode, monitor);
|
init(openMode, monitor);
|
||||||
|
|
||||||
if (openMode != DBConstants.CREATE && hasDataOrganizationChange()) {
|
if (openMode != DBConstants.CREATE && hasDataOrganizationChange(true)) {
|
||||||
// check for data organization change with possible upgrade
|
// check for data organization change with possible upgrade
|
||||||
handleDataOrganizationChange(openMode, monitor);
|
handleDataOrganizationChange(openMode, monitor);
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
/**
|
/**
|
||||||
* Constructor for a database-backed <code>DataTypeManagerDB</code> extension.
|
* Constructor for a database-backed <code>DataTypeManagerDB</code> extension.
|
||||||
* NOTE: This does not check for and handle data organization changes which must be
|
* NOTE: This does not check for and handle data organization changes which must be
|
||||||
* handled later (use {@link #hasDataOrganizationChange()} and
|
* handled later (use {@link #hasDataOrganizationChange(boolean)} and
|
||||||
* {@link #compilerSpecChanged(TaskMonitor)} to check for and initiate response to changes).
|
* {@link #compilerSpecChanged(TaskMonitor)} to check for and initiate response to changes).
|
||||||
*
|
*
|
||||||
* @param handle database handle
|
* @param handle database handle
|
||||||
|
@ -842,7 +842,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
throw new ReadOnlyException();
|
throw new ReadOnlyException();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasDataOrgChange = hasDataOrganizationChange();
|
boolean hasDataOrgChange = hasDataOrganizationChange(false);
|
||||||
|
|
||||||
saveDataOrganization();
|
saveDataOrganization();
|
||||||
|
|
||||||
|
@ -854,8 +854,21 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
// on function definitions
|
// on function definitions
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final boolean hasDataOrganizationChange() throws IOException {
|
/**
|
||||||
|
* Check if the active {@link #getDataOrganization()} differs from the stored data organization.
|
||||||
|
* False will be returned when {@code ifPreviouslyStored} is true and data organization has never
|
||||||
|
* beeen saved.
|
||||||
|
* @param ifPreviouslyStored if true and data organization has never been saved false will be returned
|
||||||
|
* @return true if a data organization change has occured
|
||||||
|
* @throws IOException if an IO error occurs
|
||||||
|
*/
|
||||||
|
protected final boolean hasDataOrganizationChange(boolean ifPreviouslyStored)
|
||||||
|
throws IOException {
|
||||||
// compare DB-stored data organization with the one in affect
|
// compare DB-stored data organization with the one in affect
|
||||||
|
DataOrganization storedDataOrg = readDataOrganization();
|
||||||
|
if (ifPreviouslyStored && storedDataOrg == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return !Objects.equals(readDataOrganization(), getDataOrganization());
|
return !Objects.equals(readDataOrganization(), getDataOrganization());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3944,7 +3957,19 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
@Override
|
@Override
|
||||||
public final DataOrganization getDataOrganization() {
|
public final DataOrganization getDataOrganization() {
|
||||||
if (dataOrganization == null) {
|
if (dataOrganization == null) {
|
||||||
dataOrganization = DataOrganizationImpl.getDefaultOrganization();
|
try {
|
||||||
|
// Initialization of dataOrganization may never have been established
|
||||||
|
// if either an architecture has never been specified or a language
|
||||||
|
// error occured during initializtion. In such cases the stored
|
||||||
|
// data organization should be used if available.
|
||||||
|
dataOrganization = readDataOrganization();
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
dbError(e);
|
||||||
|
}
|
||||||
|
if (dataOrganization == null) {
|
||||||
|
dataOrganization = DataOrganizationImpl.getDefaultOrganization();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return dataOrganization;
|
return dataOrganization;
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ public class StandAloneDataTypeManager extends DataTypeManagerDB implements Clos
|
||||||
Lock lock, TaskMonitor monitor)
|
Lock lock, TaskMonitor monitor)
|
||||||
throws CancelledException, VersionException, IOException {
|
throws CancelledException, VersionException, IOException {
|
||||||
super(handle, null, openMode, null, errHandler, lock, monitor);
|
super(handle, null, openMode, null, errHandler, lock, monitor);
|
||||||
if (openMode != DBConstants.CREATE && hasDataOrganizationChange()) {
|
if (openMode != DBConstants.CREATE && hasDataOrganizationChange(true)) {
|
||||||
handleDataOrganizationChange(openMode, monitor);
|
handleDataOrganizationChange(openMode, monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue