mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
GP-3796 allow non-sourced datatypes to become associated to archive
during commit operation.
This commit is contained in:
parent
de43ed0656
commit
f7ac7388ba
6 changed files with 92 additions and 99 deletions
|
@ -69,7 +69,7 @@
|
||||||
<TR valign="top">
|
<TR valign="top">
|
||||||
<TD><B>User Defined</B></TD>
|
<TD><B>User Defined</B></TD>
|
||||||
|
|
||||||
<TD style="">There are four user defined data types: Structures, Unions, Enums, and
|
<TD>There are four user defined data types: Structures, Unions, Enums, and
|
||||||
Typedefs. They can be created, modified, and renamed as needed.</TD>
|
Typedefs. They can be created, modified, and renamed as needed.</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
|
@ -328,7 +328,7 @@
|
||||||
Archives</B><BR>
|
Archives</B><BR>
|
||||||
</TD>
|
</TD>
|
||||||
|
|
||||||
<TD style="">Files containing data type definitions, which have ".gdt" as their
|
<TD>Files containing data type definitions, which have ".gdt" as their
|
||||||
file suffix.</TD>
|
file suffix.</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@
|
||||||
<TD style="width: 160px;"><B>Project Data Type Archives</B><BR>
|
<TD style="width: 160px;"><B>Project Data Type Archives</B><BR>
|
||||||
</TD>
|
</TD>
|
||||||
|
|
||||||
<TD style="">Special files located within the Ghidra project directory structure,
|
<TD>Special files located within the Ghidra project directory structure,
|
||||||
which also contain data type definitions. These are available in the <A href=
|
which also contain data type definitions. These are available in the <A href=
|
||||||
"../FrontEndPlugin/Ghidra_Front_end.htm">Ghidra Project Window</A> and can be saved
|
"../FrontEndPlugin/Ghidra_Front_end.htm">Ghidra Project Window</A> and can be saved
|
||||||
as versions in a shared project repository.</TD>
|
as versions in a shared project repository.</TD>
|
||||||
|
@ -592,9 +592,14 @@
|
||||||
none, a message dialog will appear indicating that no changes were detected.</P>
|
none, a message dialog will appear indicating that no changes were detected.</P>
|
||||||
|
|
||||||
<P><IMG alt="" src="help/shared/note.png">
|
<P><IMG alt="" src="help/shared/note.png">
|
||||||
The source archive must be editable in order to commit File archives must be <A href=
|
The source archive must be editable in order to commit. File archives must be <A href=
|
||||||
"data_type_manager_description.htm#open_for_editing">open for editing</A> and project
|
"data_type_manager_description.htm#open_for_editing">open for editing</A> and project
|
||||||
archives that are under version control must be checked-out.</P>
|
archives that are under version control must be checked-out.</P>
|
||||||
|
|
||||||
|
<P><IMG alt="" src="help/shared/note.png">Any data type dependencies for a comitted
|
||||||
|
data type, which do not already have a source archive, will become associated to the same
|
||||||
|
source archive.</P>
|
||||||
|
|
||||||
</BLOCKQUOTE>
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
<H3>Reverting Changes in an Archive Back To a Source Archive</H3>
|
<H3>Reverting Changes in an Archive Back To a Source Archive</H3>
|
||||||
|
|
|
@ -12,10 +12,6 @@
|
||||||
</HEAD>
|
</HEAD>
|
||||||
|
|
||||||
<BODY>
|
<BODY>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<H1>Data Type Manager Window</H1>
|
<H1>Data Type Manager Window</H1>
|
||||||
|
|
||||||
<BLOCKQUOTE>
|
<BLOCKQUOTE>
|
||||||
|
@ -55,28 +51,28 @@
|
||||||
<TD style="width: 16px;"><IMG alt="" src="images/closedBookBrown.png" style=
|
<TD style="width: 16px;"><IMG alt="" src="images/closedBookBrown.png" style=
|
||||||
"width: 16px; height: 16px;"></TD>
|
"width: 16px; height: 16px;"></TD>
|
||||||
|
|
||||||
<TD style="">- Built-in archive data types</TD>
|
<TD>- Built-in archive data types</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
<TR valign="top">
|
<TR valign="top">
|
||||||
<TD style="width: 16px;"><IMG alt="" src="images/closedBookRed.png" style=
|
<TD style="width: 16px;"><IMG alt="" src="images/closedBookRed.png" style=
|
||||||
"width: 16px; height: 16px;"></TD>
|
"width: 16px; height: 16px;"></TD>
|
||||||
|
|
||||||
<TD style="">- Program data types</TD>
|
<TD>- Program data types</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
<TR valign="top">
|
<TR valign="top">
|
||||||
<TD style="width: 16px;"><IMG alt="" src="images/closedBookBlue.png" style=
|
<TD style="width: 16px;"><IMG alt="" src="images/closedBookBlue.png" style=
|
||||||
"width: 16px; height: 16px;"></TD>
|
"width: 16px; height: 16px;"></TD>
|
||||||
|
|
||||||
<TD style="">- Project Archive</TD>
|
<TD>- Project Archive</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
<TR valign="top">
|
<TR valign="top">
|
||||||
<TD style="width: 16px;"><IMG alt="" src="images/closedBookGreen.png" style=
|
<TD style="width: 16px;"><IMG alt="" src="images/closedBookGreen.png" style=
|
||||||
"width: 16px; height: 16px;"></TD>
|
"width: 16px; height: 16px;"></TD>
|
||||||
|
|
||||||
<TD style="">- File Archive</TD>
|
<TD>- File Archive</TD>
|
||||||
</TR>
|
</TR>
|
||||||
</TBODY>
|
</TBODY>
|
||||||
</TABLE>
|
</TABLE>
|
||||||
|
@ -91,7 +87,7 @@
|
||||||
<TD style="width: 40px;" align="right" valign="top"><IMG alt="" src=
|
<TD style="width: 40px;" align="right" valign="top"><IMG alt="" src=
|
||||||
"images/check.png" style="width: 17px; height: 17px;"></TD>
|
"images/check.png" style="width: 17px; height: 17px;"></TD>
|
||||||
|
|
||||||
<TD style="">- Indicates the archive is modifiable by you and possibly by
|
<TD>- Indicates the archive is modifiable by you and possibly by
|
||||||
others in your shared project</TD>
|
others in your shared project</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
|
@ -99,14 +95,14 @@
|
||||||
<TD style="width: 40px;" align="right" valign="top"><IMG alt="" src=
|
<TD style="width: 40px;" align="right" valign="top"><IMG alt="" src=
|
||||||
"images/checkex.png" style="width: 17px; height: 17px;"></TD>
|
"images/checkex.png" style="width: 17px; height: 17px;"></TD>
|
||||||
|
|
||||||
<TD style="">- Indicates the archive is currently modifiable only by you</TD>
|
<TD>- Indicates the archive is currently modifiable only by you</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
<TR valign="top">
|
<TR valign="top">
|
||||||
<TD style="width: 40px;" align="right" valign="top"><IMG alt="" src=
|
<TD style="width: 40px;" align="right" valign="top"><IMG alt="" src=
|
||||||
"images/checkNotLatest.gif" style="width: 16px; height: 16px;"></TD>
|
"images/checkNotLatest.gif" style="width: 16px; height: 16px;"></TD>
|
||||||
|
|
||||||
<TD style="">- Indicates the archive is out of date (someone has checked
|
<TD>- Indicates the archive is out of date (someone has checked
|
||||||
changes for this archive into the repository)</TD>
|
changes for this archive into the repository)</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
|
@ -114,7 +110,7 @@
|
||||||
<TD style="width: 40px;" align="right" valign="top"><IMG alt="" src=
|
<TD style="width: 40px;" align="right" valign="top"><IMG alt="" src=
|
||||||
"images/small_hijack.gif" style="width: 17px; height: 17px;" border="0"></TD>
|
"images/small_hijack.gif" style="width: 17px; height: 17px;" border="0"></TD>
|
||||||
|
|
||||||
<TD style="">- Indicates the archive is hijacked (modified without being
|
<TD>- Indicates the archive is hijacked (modified without being
|
||||||
checked out)</TD>
|
checked out)</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
|
@ -153,7 +149,7 @@
|
||||||
<TD style="width: 40px;" align="right" valign="top"><IMG alt="" src=
|
<TD style="width: 40px;" align="right" valign="top"><IMG alt="" src=
|
||||||
"images/doubleArrow.png" style="width: 16px; height: 10px;" border="0"></TD>
|
"images/doubleArrow.png" style="width: 16px; height: 10px;" border="0"></TD>
|
||||||
|
|
||||||
<TD style="">- Indicates the archive has datatypes that need updating and
|
<TD>- Indicates the archive has datatypes that need updating and
|
||||||
datatypes that need to be committed.</TD>
|
datatypes that need to be committed.</TD>
|
||||||
</TR>
|
</TR>
|
||||||
</TBODY>
|
</TBODY>
|
||||||
|
@ -170,63 +166,63 @@
|
||||||
<TD style="width: 25px;"><IMG alt="" src="images/closedFolder.png" style=
|
<TD style="width: 25px;"><IMG alt="" src="images/closedFolder.png" style=
|
||||||
"width: 25px; height: 17px;"></TD>
|
"width: 25px; height: 17px;"></TD>
|
||||||
|
|
||||||
<TD style="">- Category</TD>
|
<TD>- Category</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
<TR valign="top">
|
<TR valign="top">
|
||||||
<TD style="width: 25px;"><IMG alt="" src="images/package_development.png"
|
<TD style="width: 25px;"><IMG alt="" src="images/package_development.png"
|
||||||
style="width: 18px; height: 18px;"></TD>
|
style="width: 18px; height: 18px;"></TD>
|
||||||
|
|
||||||
<TD style="">- Built-in data type</TD>
|
<TD>- Built-in data type</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
<TR valign="top">
|
<TR valign="top">
|
||||||
<TD style="width: 25px;"><IMG alt="" src="images/cstruct.png" style=
|
<TD style="width: 25px;"><IMG alt="" src="images/cstruct.png" style=
|
||||||
"width: 16px; height: 16px;"></TD>
|
"width: 16px; height: 16px;"></TD>
|
||||||
|
|
||||||
<TD style="">- Structure</TD>
|
<TD>- Structure</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
<TR valign="top">
|
<TR valign="top">
|
||||||
<TD style="width: 25px;"><IMG alt="" src="images/cUnion.png" style=
|
<TD style="width: 25px;"><IMG alt="" src="images/cUnion.png" style=
|
||||||
"width: 16px; height: 16px;"></TD>
|
"width: 16px; height: 16px;"></TD>
|
||||||
|
|
||||||
<TD style="">- Union</TD>
|
<TD>- Union</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
<TR valign="top">
|
<TR valign="top">
|
||||||
<TD style="width: 25px;"><IMG alt="" src="images/typedef.png" style=
|
<TD style="width: 25px;"><IMG alt="" src="images/typedef.png" style=
|
||||||
"width: 16px; height: 16px;"></TD>
|
"width: 16px; height: 16px;"></TD>
|
||||||
|
|
||||||
<TD style="">- Typedef</TD>
|
<TD>- Typedef</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
<TR valign="top">
|
<TR valign="top">
|
||||||
<TD style="width: 25px;"><IMG alt="" src="images/functionDef.png" style=
|
<TD style="width: 25px;"><IMG alt="" src="images/functionDef.png" style=
|
||||||
"width: 16px; height: 16px;"></TD>
|
"width: 16px; height: 16px;"></TD>
|
||||||
|
|
||||||
<TD style="">- Function Definition</TD>
|
<TD>- Function Definition</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
<TR valign="top">
|
<TR valign="top">
|
||||||
<TD style="width: 25px;"><IMG alt="" src="images/enum.png" style=
|
<TD style="width: 25px;"><IMG alt="" src="images/enum.png" style=
|
||||||
"width: 16px; height: 16px;"></TD>
|
"width: 16px; height: 16px;"></TD>
|
||||||
|
|
||||||
<TD style="">- Enum</TD>
|
<TD>- Enum</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
<TR valign="top">
|
<TR valign="top">
|
||||||
<TD style="width: 25px;"><IMG alt="" src="images/fingerPointer.png" style=
|
<TD style="width: 25px;"><IMG alt="" src="images/fingerPointer.png" style=
|
||||||
"width: 16px; height: 16px;"></TD>
|
"width: 16px; height: 16px;"></TD>
|
||||||
|
|
||||||
<TD style="">- Pointer</TD>
|
<TD>- Pointer</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
<TR valign="top">
|
<TR valign="top">
|
||||||
<TD style="width: 25px;"><IMG alt="" src="images/emblem-favorite.png" style=
|
<TD style="width: 25px;"><IMG alt="" src="images/emblem-favorite.png" style=
|
||||||
"width: 18px; height: 18px;"></TD>
|
"width: 18px; height: 18px;"></TD>
|
||||||
|
|
||||||
<TD style="">- Favorite</TD>
|
<TD>- Favorite</TD>
|
||||||
</TR>
|
</TR>
|
||||||
</TBODY>
|
</TBODY>
|
||||||
</TABLE>
|
</TABLE>
|
||||||
|
@ -241,7 +237,7 @@
|
||||||
<TD style="width: 20px; text-align: center;"><IMG alt="" src=
|
<TD style="width: 20px; text-align: center;"><IMG alt="" src=
|
||||||
"images/smallRightArrow.png" style="width: 12px; height: 10px;"></TD>
|
"images/smallRightArrow.png" style="width: 12px; height: 10px;"></TD>
|
||||||
|
|
||||||
<TD style="">- Indicates the data type has changes that need to be committed
|
<TD>- Indicates the data type has changes that need to be committed
|
||||||
to the source archive</TD>
|
to the source archive</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
|
@ -249,7 +245,7 @@
|
||||||
<TD style="width: 20px; text-align: center;"><IMG alt="" src=
|
<TD style="width: 20px; text-align: center;"><IMG alt="" src=
|
||||||
"images/smallLeftArrow.png" style="width: 12px; height: 10px;"></TD>
|
"images/smallLeftArrow.png" style="width: 12px; height: 10px;"></TD>
|
||||||
|
|
||||||
<TD style="">- Indicates the data type has been updated in the source archive
|
<TD>- Indicates the data type has been updated in the source archive
|
||||||
and needs to be updated locally.</TD>
|
and needs to be updated locally.</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
|
||||||
|
@ -257,7 +253,7 @@
|
||||||
<TD style="width: 20px; text-align: center;"><IMG alt="" src=
|
<TD style="width: 20px; text-align: center;"><IMG alt="" src=
|
||||||
"images/doubleArrow.png" style="width: 16px; height: 10px;"></TD>
|
"images/doubleArrow.png" style="width: 16px; height: 10px;"></TD>
|
||||||
|
|
||||||
<TD style="">- Indicates the data type has changed both in this archive and
|
<TD>- Indicates the data type has changed both in this archive and
|
||||||
in the source archive. (conflict)<BR>
|
in the source archive. (conflict)<BR>
|
||||||
</TD>
|
</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
@ -266,7 +262,9 @@
|
||||||
<TD style="width: 20px; text-align: center;"><IMG alt="" src=
|
<TD style="width: 20px; text-align: center;"><IMG alt="" src=
|
||||||
"images/redQuestionMark.png"></TD>
|
"images/redQuestionMark.png"></TD>
|
||||||
|
|
||||||
<TD style="">- Indicates the data type is missing in the source archive.</TD>
|
<TD>- Indicates the data type is missing in the source archive. It is important to
|
||||||
|
note that this determination ibased upon a matching Universal ID and not just
|
||||||
|
its pathname.</TD>
|
||||||
</TR>
|
</TR>
|
||||||
</TBODY>
|
</TBODY>
|
||||||
</TABLE>
|
</TABLE>
|
||||||
|
@ -409,7 +407,7 @@
|
||||||
Archive...</B><BR>
|
Archive...</B><BR>
|
||||||
</TD>
|
</TD>
|
||||||
|
|
||||||
<TD style="">This action will launch a project data type archive chooser that can be
|
<TD>This action will launch a project data type archive chooser that can be
|
||||||
used to open an existing project archive. Project data type archives live in the
|
used to open an existing project archive. Project data type archives live in the
|
||||||
project and can be seen in the <A href=
|
project and can be seen in the <A href=
|
||||||
"../FrontEndPlugin/Ghidra_Front_end.htm">Ghidra Project Window</A>. Project data type
|
"../FrontEndPlugin/Ghidra_Front_end.htm">Ghidra Project Window</A>. Project data type
|
||||||
|
@ -432,7 +430,7 @@
|
||||||
Archive...</B><BR>
|
Archive...</B><BR>
|
||||||
</TD>
|
</TD>
|
||||||
|
|
||||||
<TD style="">This action is used to create a new project data type archive. A project
|
<TD>This action is used to create a new project data type archive. A project
|
||||||
window browser will be launched for choosing a location in the project and a name for
|
window browser will be launched for choosing a location in the project and a name for
|
||||||
the new project archive.</TD>
|
the new project archive.</TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
@ -501,7 +499,7 @@
|
||||||
Paths...</B><BR>
|
Paths...</B><BR>
|
||||||
</TD>
|
</TD>
|
||||||
|
|
||||||
<TD style=""><A name="Edit_Archive_Paths"></A>This action will launch a dialog that
|
<TD><A name="Edit_Archive_Paths"></A>This action will launch a dialog that
|
||||||
can be used to add, remove, or reorder the directories used for searching for a file
|
can be used to add, remove, or reorder the directories used for searching for a file
|
||||||
archive. Ghidra programs only store the name of the archive. Each directory in the <A
|
archive. Ghidra programs only store the name of the archive. Each directory in the <A
|
||||||
href="data_type_manager_description.htm#file_archive_path">archive path</A> is searched in order, looking for a file
|
href="data_type_manager_description.htm#file_archive_path">archive path</A> is searched in order, looking for a file
|
||||||
|
|
|
@ -116,6 +116,15 @@ public class DataTypeSynchronizer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void commitAssumingTransactionsOpen(DataTypeManager sourceDTM, DataType refDT) {
|
public static void commitAssumingTransactionsOpen(DataTypeManager sourceDTM, DataType refDT) {
|
||||||
|
|
||||||
|
// Must refresh associations of refDt and its dependencies to ensure that any
|
||||||
|
// non-sourced datatype is properly associated to the sourceDTM
|
||||||
|
DataTypeManager refDTM = refDT.getDataTypeManager();
|
||||||
|
SourceArchive sourceArchive = refDTM.getSourceArchive(sourceDTM.getUniversalID());
|
||||||
|
refDTM.associateDataTypeWithArchive(refDT, sourceArchive);
|
||||||
|
|
||||||
|
// Perform commit of changes by re-resolving and performing additional updates
|
||||||
|
// not handled by resolve.
|
||||||
long lastChangeTime = refDT.getLastChangeTime();
|
long lastChangeTime = refDT.getLastChangeTime();
|
||||||
DataType sourceDT = sourceDTM.resolve(refDT, DataTypeConflictHandler.REPLACE_HANDLER);
|
DataType sourceDT = sourceDTM.resolve(refDT, DataTypeConflictHandler.REPLACE_HANDLER);
|
||||||
if (!namesAreEquivalent(refDT, sourceDT)) {
|
if (!namesAreEquivalent(refDT, sourceDT)) {
|
||||||
|
|
|
@ -445,9 +445,8 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
versionExc = e.combine(versionExc);
|
versionExc = e.combine(versionExc);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
functionDefAdapter =
|
functionDefAdapter = FunctionDefinitionDBAdapter.getAdapter(dbHandle, openMode,
|
||||||
FunctionDefinitionDBAdapter.getAdapter(dbHandle, openMode, tablePrefix,
|
tablePrefix, callingConventionAdapter, monitor);
|
||||||
callingConventionAdapter, monitor);
|
|
||||||
}
|
}
|
||||||
catch (VersionException e) {
|
catch (VersionException e) {
|
||||||
versionExc = e.combine(versionExc);
|
versionExc = e.combine(versionExc);
|
||||||
|
@ -460,9 +459,8 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
versionExc = e.combine(versionExc);
|
versionExc = e.combine(versionExc);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
settingsAdapter =
|
settingsAdapter = SettingsDBAdapter.getAdapter(tablePrefix + SETTINGS_TABLE_NAME,
|
||||||
SettingsDBAdapter.getAdapter(tablePrefix + SETTINGS_TABLE_NAME, dbHandle, openMode,
|
dbHandle, openMode, null, monitor);
|
||||||
null, monitor);
|
|
||||||
}
|
}
|
||||||
catch (VersionException e) {
|
catch (VersionException e) {
|
||||||
versionExc = e.combine(versionExc);
|
versionExc = e.combine(versionExc);
|
||||||
|
@ -548,9 +546,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
*/
|
*/
|
||||||
private void initializedParentChildTable() {
|
private void initializedParentChildTable() {
|
||||||
buildSortedDataTypeList();
|
buildSortedDataTypeList();
|
||||||
Iterator<DataType> it = sortedDataTypes.iterator();
|
for (DataType dt : sortedDataTypes) {
|
||||||
while (it.hasNext()) {
|
|
||||||
DataType dt = it.next();
|
|
||||||
if (dt instanceof Array) {
|
if (dt instanceof Array) {
|
||||||
((Array) dt).getDataType().addParent(dt);
|
((Array) dt).getDataType().addParent(dt);
|
||||||
}
|
}
|
||||||
|
@ -765,9 +761,8 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
}
|
}
|
||||||
lock.acquire();
|
lock.acquire();
|
||||||
try {
|
try {
|
||||||
Set<String> previouslyUsedSet = previouslyUsedSettingsValuesMap
|
Set<String> previouslyUsedSet = previouslyUsedSettingsValuesMap.computeIfAbsent(
|
||||||
.computeIfAbsent(settingsDefinition.getStorageKey(),
|
settingsDefinition.getStorageKey(), n -> generateSuggestions(settingsDefinition));
|
||||||
n -> generateSuggestions(settingsDefinition));
|
|
||||||
// Last-minute additions are not cached since suggested values may change
|
// Last-minute additions are not cached since suggested values may change
|
||||||
Set<String> set = new TreeSet<>(previouslyUsedSet); // copy before updating
|
Set<String> set = new TreeSet<>(previouslyUsedSet); // copy before updating
|
||||||
settingsDefinition.addPreferredValues(this, set);
|
settingsDefinition.addPreferredValues(this, set);
|
||||||
|
@ -1866,8 +1861,8 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
replacementDt.setLastChangeTime(lastChangeTime);
|
replacementDt.setLastChangeTime(lastChangeTime);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Msg.error(this, "Unable to set the name to " + existingDt.getName() +
|
Msg.error(this, "Unable to set the name to " + existingDt.getName() + "on " +
|
||||||
"on " + replacementDt + " while replacing the original datatype", e);
|
replacementDt + " while replacing the original datatype", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CategoryPath path = existingDt.getCategoryPath();
|
CategoryPath path = existingDt.getCategoryPath();
|
||||||
|
@ -1878,8 +1873,8 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
// not sure what to do here
|
// not sure what to do here
|
||||||
Msg.error(this, "Unable to set the CatagoryPath to " + path +
|
Msg.error(this, "Unable to set the CatagoryPath to " + path + "on " +
|
||||||
"on " + replacementDt + " while replacing the original datatype", e);
|
replacementDt + " while replacing the original datatype", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return replacementDt;
|
return replacementDt;
|
||||||
|
@ -1929,11 +1924,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
buildSortedDataTypeList();
|
buildSortedDataTypeList();
|
||||||
// make copy of sortedDataTypes list before iterating as dt.dataTypeReplaced may
|
for (DataType dt : new ArrayList<>(sortedDataTypes)) {
|
||||||
// call back into this class and cause a modification to the sortedDataTypes list.
|
|
||||||
Iterator<DataType> it = new ArrayList<>(sortedDataTypes).iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
DataType dt = it.next();
|
|
||||||
dt.dataTypeReplaced(existingDt, newDt);
|
dt.dataTypeReplaced(existingDt, newDt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2229,9 +2220,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
deletedIds.addFirst(l);
|
deletedIds.addFirst(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<Long> it = deletedIds.iterator();
|
for (Long l : deletedIds) {
|
||||||
while (it.hasNext()) {
|
|
||||||
Long l = it.next();
|
|
||||||
deleteDataType(l.longValue());
|
deleteDataType(l.longValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2280,10 +2269,8 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"The given datatype must exist in this DataTypeManager");
|
"The given datatype must exist in this DataTypeManager");
|
||||||
}
|
}
|
||||||
if (!datatype.getSourceArchive().equals(getLocalSourceArchive())) {
|
SourceArchive currentSource = datatype.getSourceArchive();
|
||||||
return;
|
if (!currentSource.equals(getLocalSourceArchive()) && !currentSource.equals(archive)) {
|
||||||
}
|
|
||||||
if (datatype.getSourceArchive().equals(archive)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
resolveSourceArchive(archive);
|
resolveSourceArchive(archive);
|
||||||
|
@ -2557,8 +2544,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataType getDataType(CategoryPath path, String name) {
|
public DataType getDataType(CategoryPath path, String name) {
|
||||||
if (CategoryPath.ROOT.equals(path) &&
|
if (CategoryPath.ROOT.equals(path) && name.equals(DataType.DEFAULT.getName())) {
|
||||||
name.equals(DataType.DEFAULT.getName())) {
|
|
||||||
return DataType.DEFAULT;
|
return DataType.DEFAULT;
|
||||||
}
|
}
|
||||||
Category category = getCategory(path);
|
Category category = getCategory(path);
|
||||||
|
@ -2960,16 +2946,15 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
newDataType = createBuiltIn(builtInDataType, cat);
|
newDataType = createBuiltIn(builtInDataType, cat);
|
||||||
}
|
}
|
||||||
else if (dt instanceof StructureInternal structure) {
|
else if (dt instanceof StructureInternal structure) {
|
||||||
newDataType = createStructure(structure, name, cat, sourceArchiveIdValue,
|
newDataType =
|
||||||
id.getValue());
|
createStructure(structure, name, cat, sourceArchiveIdValue, id.getValue());
|
||||||
}
|
}
|
||||||
else if (dt instanceof TypeDef typedef) {
|
else if (dt instanceof TypeDef typedef) {
|
||||||
newDataType =
|
newDataType =
|
||||||
createTypeDef(typedef, name, cat, sourceArchiveIdValue, id.getValue());
|
createTypeDef(typedef, name, cat, sourceArchiveIdValue, id.getValue());
|
||||||
}
|
}
|
||||||
else if (dt instanceof UnionInternal union) {
|
else if (dt instanceof UnionInternal union) {
|
||||||
newDataType =
|
newDataType = createUnion(union, name, cat, sourceArchiveIdValue, id.getValue());
|
||||||
createUnion(union, name, cat, sourceArchiveIdValue, id.getValue());
|
|
||||||
}
|
}
|
||||||
else if (dt instanceof Enum enumm) {
|
else if (dt instanceof Enum enumm) {
|
||||||
newDataType = createEnum(enumm, name, cat, sourceArchiveIdValue, id.getValue());
|
newDataType = createEnum(enumm, name, cat, sourceArchiveIdValue, id.getValue());
|
||||||
|
@ -2995,8 +2980,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Structure createStructure(StructureInternal struct, String name, CategoryDB category,
|
private Structure createStructure(StructureInternal struct, String name, CategoryDB category,
|
||||||
long sourceArchiveIdValue, long universalIdValue)
|
long sourceArchiveIdValue, long universalIdValue) throws IOException {
|
||||||
throws IOException {
|
|
||||||
try {
|
try {
|
||||||
if (name == null || name.length() == 0) {
|
if (name == null || name.length() == 0) {
|
||||||
throw new IllegalArgumentException("Data type must have a valid name");
|
throw new IllegalArgumentException("Data type must have a valid name");
|
||||||
|
@ -3007,9 +2991,9 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
DBRecord record = compositeAdapter.createRecord(name, struct.getDescription(), false,
|
DBRecord record = compositeAdapter.createRecord(name, struct.getDescription(), false,
|
||||||
category.getID(), len, -1, sourceArchiveIdValue,
|
category.getID(), len, -1, sourceArchiveIdValue, universalIdValue,
|
||||||
universalIdValue, struct.getLastChangeTime(),
|
struct.getLastChangeTime(), struct.getStoredPackingValue(),
|
||||||
struct.getStoredPackingValue(), struct.getStoredMinimumAlignment());
|
struct.getStoredMinimumAlignment());
|
||||||
|
|
||||||
StructureDB structDB =
|
StructureDB structDB =
|
||||||
new StructureDB(this, dtCache, compositeAdapter, componentAdapter, record);
|
new StructureDB(this, dtCache, compositeAdapter, componentAdapter, record);
|
||||||
|
@ -3038,8 +3022,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private TypeDef createTypeDef(TypeDef typedef, String name, Category cat,
|
private TypeDef createTypeDef(TypeDef typedef, String name, Category cat,
|
||||||
long sourceArchiveIdValue, long universalIdValue)
|
long sourceArchiveIdValue, long universalIdValue) throws IOException {
|
||||||
throws IOException {
|
|
||||||
if (name == null || name.length() == 0) {
|
if (name == null || name.length() == 0) {
|
||||||
throw new IllegalArgumentException("Data type must have a valid name");
|
throw new IllegalArgumentException("Data type must have a valid name");
|
||||||
}
|
}
|
||||||
|
@ -3067,16 +3050,15 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Union createUnion(UnionInternal union, String name, CategoryDB category,
|
private Union createUnion(UnionInternal union, String name, CategoryDB category,
|
||||||
long sourceArchiveIdValue, long universalIdValue)
|
long sourceArchiveIdValue, long universalIdValue) throws IOException {
|
||||||
throws IOException {
|
|
||||||
if (name == null || name.length() == 0) {
|
if (name == null || name.length() == 0) {
|
||||||
throw new IllegalArgumentException("Data type must have a valid name");
|
throw new IllegalArgumentException("Data type must have a valid name");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
creatingDataType++;
|
creatingDataType++;
|
||||||
DBRecord record = compositeAdapter.createRecord(name, null, true, category.getID(), 0,
|
DBRecord record = compositeAdapter.createRecord(name, null, true, category.getID(), 0,
|
||||||
-1, sourceArchiveIdValue, universalIdValue,
|
-1, sourceArchiveIdValue, universalIdValue, union.getLastChangeTime(),
|
||||||
union.getLastChangeTime(), union.getStoredPackingValue(), union.getStoredMinimumAlignment());
|
union.getStoredPackingValue(), union.getStoredMinimumAlignment());
|
||||||
UnionDB unionDB =
|
UnionDB unionDB =
|
||||||
new UnionDB(this, dtCache, compositeAdapter, componentAdapter, record);
|
new UnionDB(this, dtCache, compositeAdapter, componentAdapter, record);
|
||||||
|
|
||||||
|
@ -3110,7 +3092,8 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
long enumID = record.getKey();
|
long enumID = record.getKey();
|
||||||
String[] enumNames = enumm.getNames();
|
String[] enumNames = enumm.getNames();
|
||||||
for (String enumName : enumNames) {
|
for (String enumName : enumNames) {
|
||||||
enumValueAdapter.createRecord(enumID, enumName, enumm.getValue(enumName), enumm.getComment(enumName));
|
enumValueAdapter.createRecord(enumID, enumName, enumm.getValue(enumName),
|
||||||
|
enumm.getComment(enumName));
|
||||||
}
|
}
|
||||||
EnumDB enumDB = new EnumDB(this, dtCache, enumAdapter, enumValueAdapter, record);
|
EnumDB enumDB = new EnumDB(this, dtCache, enumAdapter, enumValueAdapter, record);
|
||||||
return enumDB;
|
return enumDB;
|
||||||
|
@ -3318,14 +3301,12 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
creatingDataType++;
|
creatingDataType++;
|
||||||
byte callingConventionId =
|
byte callingConventionId = callingConventionAdapter.getCallingConventionId(
|
||||||
callingConventionAdapter.getCallingConventionId(funDef.getCallingConventionName(),
|
funDef.getCallingConventionName(), cc -> callingConventionNameAdded(cc));
|
||||||
cc -> callingConventionNameAdded(cc));
|
DBRecord record = functionDefAdapter.createRecord(name, funDef.getComment(),
|
||||||
DBRecord record =
|
cat.getID(), DEFAULT_DATATYPE_ID, funDef.hasNoReturn(), funDef.hasVarArgs(),
|
||||||
functionDefAdapter.createRecord(name, funDef.getComment(), cat.getID(),
|
callingConventionId, sourceArchiveIdValue, universalIdValue,
|
||||||
DEFAULT_DATATYPE_ID, funDef.hasNoReturn(), funDef.hasVarArgs(),
|
funDef.getLastChangeTime());
|
||||||
callingConventionId, sourceArchiveIdValue, universalIdValue,
|
|
||||||
funDef.getLastChangeTime());
|
|
||||||
FunctionDefinitionDB funDefDb =
|
FunctionDefinitionDB funDefDb =
|
||||||
new FunctionDefinitionDB(this, dtCache, functionDefAdapter, paramAdapter, record);
|
new FunctionDefinitionDB(this, dtCache, functionDefAdapter, paramAdapter, record);
|
||||||
|
|
||||||
|
@ -4192,12 +4173,10 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
* @param monitor task monitor
|
* @param monitor task monitor
|
||||||
* @throws CancelledException if task cancelled
|
* @throws CancelledException if task cancelled
|
||||||
*/
|
*/
|
||||||
protected void doSourceArchiveUpdates(TaskMonitor monitor)
|
protected void doSourceArchiveUpdates(TaskMonitor monitor) throws CancelledException {
|
||||||
throws CancelledException {
|
|
||||||
SourceArchiveUpgradeMap upgradeMap = new SourceArchiveUpgradeMap();
|
SourceArchiveUpgradeMap upgradeMap = new SourceArchiveUpgradeMap();
|
||||||
for (SourceArchive sourceArchive : getSourceArchives()) {
|
for (SourceArchive sourceArchive : getSourceArchives()) {
|
||||||
SourceArchive mappedSourceArchive =
|
SourceArchive mappedSourceArchive = upgradeMap.getMappedSourceArchive(sourceArchive);
|
||||||
upgradeMap.getMappedSourceArchive(sourceArchive);
|
|
||||||
if (mappedSourceArchive != null) {
|
if (mappedSourceArchive != null) {
|
||||||
replaceSourceArchive(sourceArchive, mappedSourceArchive);
|
replaceSourceArchive(sourceArchive, mappedSourceArchive);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@ public final class BuiltInDataTypeManager extends StandAloneDataTypeManager {
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected final void setProgramArchitecture(ProgramArchitecture programArchitecture,
|
protected final void setProgramArchitecture(ProgramArchitecture programArchitecture,
|
||||||
VariableStorageManager variableStorageMgr, boolean force, TaskMonitor monitor)
|
VariableStorageManager variableStorageMgr, boolean force, TaskMonitor monitor)
|
||||||
throws IOException, CancelledException {
|
throws IOException, CancelledException {
|
||||||
|
@ -168,9 +169,8 @@ public final class BuiltInDataTypeManager extends StandAloneDataTypeManager {
|
||||||
if (dataType instanceof BuiltInDataType) {
|
if (dataType instanceof BuiltInDataType) {
|
||||||
return DataTypeManager.BUILT_IN_ARCHIVE_UNIVERSAL_ID;
|
return DataTypeManager.BUILT_IN_ARCHIVE_UNIVERSAL_ID;
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException("Only Built-in data types can be resolved by the " +
|
||||||
"Only Built-in data types can be resolved by the " + getClass().getSimpleName() +
|
getClass().getSimpleName() + " manager.");
|
||||||
" manager.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -509,7 +509,9 @@ public interface DataTypeManager {
|
||||||
public SourceArchive getLocalSourceArchive();
|
public SourceArchive getLocalSourceArchive();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the given data type so that its source archive is the given archive
|
* Change the given data type and its dependencies so thier source archive is set to
|
||||||
|
* given archive. Only those data types not already associated with a source archive
|
||||||
|
* will be changed.
|
||||||
*
|
*
|
||||||
* @param datatype the type
|
* @param datatype the type
|
||||||
* @param archive the archive
|
* @param archive the archive
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue