mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
commit
ee25a7d0cc
34 changed files with 396 additions and 422 deletions
|
@ -422,7 +422,7 @@ public class SleighLanguage implements Language {
|
|||
String languageName = specName + ".slaspec";
|
||||
ResourceFile languageFile = new ResourceFile(slaFile.getParentFile(), languageName);
|
||||
|
||||
// see gradleScripts/processorUtils.gradle for sleighArgs.txt generation
|
||||
// see gradle/processorUtils.gradle for sleighArgs.txt generation
|
||||
ResourceFile sleighArgsFile = null;
|
||||
ResourceFile languageModule = Application.getModuleContainingResourceFile(languageFile);
|
||||
if (languageModule != null) {
|
||||
|
@ -430,21 +430,23 @@ public class SleighLanguage implements Language {
|
|||
sleighArgsFile = new ResourceFile(languageModule, "data/sleighArgs.txt");
|
||||
}
|
||||
else {
|
||||
sleighArgsFile = new ResourceFile(languageModule, "build/data/sleighArgs.txt");
|
||||
sleighArgsFile = new ResourceFile(languageModule, "build/tmp/sleighArgs.txt");
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, String> defineMap;
|
||||
String[] args;
|
||||
if (sleighArgsFile != null && sleighArgsFile.isFile()) {
|
||||
args = new String[] { "-i", sleighArgsFile.getAbsolutePath(),
|
||||
String baseDir = Application.getInstallationDirectory().getAbsolutePath().replace(
|
||||
File.separatorChar, '/');
|
||||
if (!baseDir.endsWith("/")) {
|
||||
baseDir += "/";
|
||||
}
|
||||
args = new String[] { "-DBaseDir=" + baseDir, "-i", sleighArgsFile.getAbsolutePath(),
|
||||
languageFile.getAbsolutePath(), description.getSlaFile().getAbsolutePath() };
|
||||
defineMap = new HashMap<>();
|
||||
}
|
||||
else {
|
||||
args = new String[] { languageFile.getAbsolutePath(),
|
||||
description.getSlaFile().getAbsolutePath() };
|
||||
defineMap = ModuleDefinitionsMap.getModuleMap();
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -454,7 +456,7 @@ public class SleighLanguage implements Language {
|
|||
buf.append(" ");
|
||||
}
|
||||
Msg.debug(this, "Sleigh compile: " + buf);
|
||||
int returnCode = SleighCompileLauncher.runMain(args, defineMap);
|
||||
int returnCode = SleighCompileLauncher.runMain(args);
|
||||
if (returnCode != 0) {
|
||||
throw new SleighException("Errors compiling " + languageFile.getAbsolutePath() +
|
||||
" -- please check log messages for details");
|
||||
|
|
|
@ -1706,6 +1706,6 @@ public class SleighCompile extends SleighBase {
|
|||
* @throws RecognitionException for parsing errors
|
||||
*/
|
||||
public static void main(String[] args) throws JDOMException, IOException, RecognitionException {
|
||||
System.exit(SleighCompileLauncher.runMain(args, new HashMap<String, String>()));
|
||||
System.exit(SleighCompileLauncher.runMain(args));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,24 +71,24 @@ public class SleighCompileLauncher implements GhidraLaunchable {
|
|||
ApplicationConfiguration configuration = new ApplicationConfiguration();
|
||||
Application.initializeApplication(layout, configuration);
|
||||
|
||||
System.exit(runMain(args, new HashMap<String, String>()));
|
||||
System.exit(runMain(args));
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the Sleigh compiler process
|
||||
*
|
||||
* @param args sleigh compiler command line arguments
|
||||
* @param preprocs additional preprocessor macro
|
||||
* @return exit code (TODO: exit codes are not well defined)
|
||||
* @throws JDOMException
|
||||
* @throws IOException
|
||||
* @throws RecognitionException
|
||||
*/
|
||||
public static int runMain(String[] args, Map<String, String> preprocs)
|
||||
public static int runMain(String[] args)
|
||||
throws JDOMException, IOException, RecognitionException {
|
||||
int retval;
|
||||
String filein = null;
|
||||
String fileout = null;
|
||||
Map<String, String> preprocs = new HashMap<>();
|
||||
|
||||
SleighCompile.yydebug = false;
|
||||
boolean allMode = false;
|
||||
|
@ -218,8 +218,8 @@ public class SleighCompileLauncher implements GhidraLaunchable {
|
|||
System.out.println("Compiling " + input + ":");
|
||||
SleighCompile compiler = new SleighCompile();
|
||||
initCompiler(compiler, preprocs, unnecessaryPcodeWarning, lenientConflict,
|
||||
allCollisionWarning,
|
||||
allNopWarning, deadTempWarning, unusedFieldWarning, enforceLocalKeyWord);
|
||||
allCollisionWarning, allNopWarning, deadTempWarning, unusedFieldWarning,
|
||||
enforceLocalKeyWord);
|
||||
|
||||
String outname = input.getName().replace(".slaspec", ".sla");
|
||||
File output = new File(input.getParent(), outname);
|
||||
|
@ -247,8 +247,8 @@ public class SleighCompileLauncher implements GhidraLaunchable {
|
|||
// single file compile
|
||||
SleighCompile compiler = new SleighCompile();
|
||||
initCompiler(compiler, preprocs, unnecessaryPcodeWarning, lenientConflict,
|
||||
allCollisionWarning, allNopWarning,
|
||||
deadTempWarning, unusedFieldWarning, enforceLocalKeyWord);
|
||||
allCollisionWarning, allNopWarning, deadTempWarning, unusedFieldWarning,
|
||||
enforceLocalKeyWord);
|
||||
if (i == args.length) {
|
||||
Msg.error(SleighCompile.class, "Missing input file name");
|
||||
return 1;
|
||||
|
@ -418,6 +418,7 @@ public class SleighCompileLauncher implements GhidraLaunchable {
|
|||
return 4;
|
||||
}
|
||||
catch (PreprocessorException e) {
|
||||
Msg.error(SleighCompile.class, e.getMessage());
|
||||
Msg.error(SleighCompile.class, "Errors during preprocessing, halting compilation");
|
||||
return 5;
|
||||
}
|
||||
|
|
|
@ -74,9 +74,6 @@ class DataTypeArchiveDBChangeSet implements DataTypeArchiveChangeSet, DomainObje
|
|||
addedSourceArchiveIds = new HashSet<Long>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.DataTypeChangeSet#dataTypeChanged(long)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void dataTypeChanged(long id) {
|
||||
if (!inTransaction) {
|
||||
|
@ -88,9 +85,6 @@ class DataTypeArchiveDBChangeSet implements DataTypeArchiveChangeSet, DomainObje
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.DataTypeChangeSet#dataTypeAdded(long)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void dataTypeAdded(long id) {
|
||||
if (!inTransaction) {
|
||||
|
@ -99,25 +93,16 @@ class DataTypeArchiveDBChangeSet implements DataTypeArchiveChangeSet, DomainObje
|
|||
tmpAddedDataTypeIds.add(new Long(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.DataTypeChangeSet#getDataTypeChanges()
|
||||
*/
|
||||
@Override
|
||||
public synchronized long[] getDataTypeChanges() {
|
||||
return getLongs(changedDataTypeIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.DataTypeChangeSet#getDataTypeAdditions()
|
||||
*/
|
||||
@Override
|
||||
public synchronized long[] getDataTypeAdditions() {
|
||||
return getLongs(addedDataTypeIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.DataTypeChangeSet#categoryChanged(long)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void categoryChanged(long id) {
|
||||
if (!inTransaction) {
|
||||
|
@ -129,9 +114,6 @@ class DataTypeArchiveDBChangeSet implements DataTypeArchiveChangeSet, DomainObje
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.DataTypeChangeSet#categoryAdded(long)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void categoryAdded(long id) {
|
||||
if (!inTransaction) {
|
||||
|
@ -140,25 +122,16 @@ class DataTypeArchiveDBChangeSet implements DataTypeArchiveChangeSet, DomainObje
|
|||
tmpAddedCategoryIds.add(new Long(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.DataTypeChangeSet#getCategoryChanges()
|
||||
*/
|
||||
@Override
|
||||
public synchronized long[] getCategoryChanges() {
|
||||
return getLongs(changedCategoryIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.DataTypeChangeSet#getCategoryAdditions()
|
||||
*/
|
||||
@Override
|
||||
public synchronized long[] getCategoryAdditions() {
|
||||
return getLongs(addedCategoryIds);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ghidra.program.model.listing.DataTypeChangeSet#archiveAdded(long)
|
||||
*/
|
||||
@Override
|
||||
public void sourceArchiveAdded(long id) {
|
||||
if (!inTransaction) {
|
||||
|
@ -167,9 +140,6 @@ class DataTypeArchiveDBChangeSet implements DataTypeArchiveChangeSet, DomainObje
|
|||
tmpAddedSourceArchiveIds.add(new Long(id));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ghidra.program.model.listing.DataTypeChangeSet#archiveChanged(long)
|
||||
*/
|
||||
@Override
|
||||
public void sourceArchiveChanged(long id) {
|
||||
if (!inTransaction) {
|
||||
|
@ -181,17 +151,11 @@ class DataTypeArchiveDBChangeSet implements DataTypeArchiveChangeSet, DomainObje
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ghidra.program.model.listing.DataTypeChangeSet#getArchiveAdditions()
|
||||
*/
|
||||
@Override
|
||||
public long[] getSourceArchiveAdditions() {
|
||||
return getLongs(addedSourceArchiveIds);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ghidra.program.model.listing.DataTypeChangeSet#getArchiveChanges()
|
||||
*/
|
||||
@Override
|
||||
public long[] getSourceArchiveChanges() {
|
||||
return getLongs(changedSourceArchiveIds);
|
||||
|
@ -213,9 +177,6 @@ class DataTypeArchiveDBChangeSet implements DataTypeArchiveChangeSet, DomainObje
|
|||
clearUndo();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.data.DomainObjectDBChangeSet#startTransaction()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void startTransaction() {
|
||||
redoList.clear();
|
||||
|
@ -229,9 +190,6 @@ class DataTypeArchiveDBChangeSet implements DataTypeArchiveChangeSet, DomainObje
|
|||
tmpAddedSourceArchiveIds = new HashSet<Long>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.data.DomainObjectDBChangeSet#endTransaction(boolean)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void endTransaction(boolean commit) {
|
||||
if (!inTransaction) {
|
||||
|
@ -268,9 +226,6 @@ class DataTypeArchiveDBChangeSet implements DataTypeArchiveChangeSet, DomainObje
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.data.DomainObjectDBChangeSet#undo()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void undo() {
|
||||
MyChangeDiff diff = undoList.removeLast();
|
||||
|
@ -283,9 +238,6 @@ class DataTypeArchiveDBChangeSet implements DataTypeArchiveChangeSet, DomainObje
|
|||
redoList.addLast(diff);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.data.DomainObjectDBChangeSet#redo()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void redo() {
|
||||
MyChangeDiff diff = redoList.removeLast();
|
||||
|
@ -298,26 +250,17 @@ class DataTypeArchiveDBChangeSet implements DataTypeArchiveChangeSet, DomainObje
|
|||
undoList.addLast(diff);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.model.ChangeSet#clearUndo()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void clearUndo() {
|
||||
undoList.clear();
|
||||
redoList.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.data.DomainObjectDBChangeSet#setMaxUndos(int)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void setMaxUndos(int numUndos) {
|
||||
this.numUndos = numUndos;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.model.ChangeSet#read(ghidra.framework.store.db.DBHandle)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void read(DBHandle dbh) throws IOException {
|
||||
|
||||
|
@ -343,6 +286,9 @@ class DataTypeArchiveDBChangeSet implements DataTypeArchiveChangeSet, DomainObje
|
|||
private void readIdRecords(DBHandle dbh, String tableName, Set<Long> ids) throws IOException {
|
||||
Table table = dbh.getTable(tableName);
|
||||
if (table != null) {
|
||||
if (table.getSchema().getVersion() != 0) {
|
||||
throw new IOException("Change data produced with newer version of Ghidra");
|
||||
}
|
||||
RecordIterator it = table.iterator();
|
||||
while (it.hasNext()) {
|
||||
Record rec = it.next();
|
||||
|
@ -351,9 +297,6 @@ class DataTypeArchiveDBChangeSet implements DataTypeArchiveChangeSet, DomainObje
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.model.ChangeSet#write(ghidra.framework.store.db.DBHandle)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void write(DBHandle dbh, boolean isRecoverySave) throws IOException {
|
||||
|
||||
|
|
|
@ -20,8 +20,7 @@ import java.io.IOException;
|
|||
import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import db.DBConstants;
|
||||
import db.DBHandle;
|
||||
import db.*;
|
||||
import db.buffers.BufferFile;
|
||||
import db.buffers.ManagedBufferFile;
|
||||
import ghidra.framework.data.*;
|
||||
|
@ -80,6 +79,9 @@ public class ProgramContentHandler extends DBContentHandler {
|
|||
success = true;
|
||||
return program;
|
||||
}
|
||||
catch (Field.UnsupportedFieldException e) {
|
||||
throw new VersionException(false);
|
||||
}
|
||||
catch (VersionException e) {
|
||||
throw e;
|
||||
}
|
||||
|
@ -136,6 +138,9 @@ public class ProgramContentHandler extends DBContentHandler {
|
|||
success = true;
|
||||
return program;
|
||||
}
|
||||
catch (Field.UnsupportedFieldException e) {
|
||||
throw new VersionException(false);
|
||||
}
|
||||
catch (VersionException e) {
|
||||
throw e;
|
||||
}
|
||||
|
@ -199,6 +204,9 @@ public class ProgramContentHandler extends DBContentHandler {
|
|||
success = true;
|
||||
return program;
|
||||
}
|
||||
catch (Field.UnsupportedFieldException e) {
|
||||
throw new VersionException(false);
|
||||
}
|
||||
catch (VersionException e) {
|
||||
throw e;
|
||||
}
|
||||
|
|
|
@ -126,9 +126,6 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
addedTagIds = new HashSet<Long>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#getAddressSet()
|
||||
*/
|
||||
@Override
|
||||
public synchronized AddressSetView getAddressSet() {
|
||||
SynchronizedAddressSetCollection addressSetCollection =
|
||||
|
@ -149,9 +146,6 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#add(ghidra.program.model.address.AddressSetView)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void add(AddressSetView addrSet) {
|
||||
if (!inTransaction) {
|
||||
|
@ -160,9 +154,6 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
tmpAddrs.add(addrSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#addRange(ghidra.program.model.address.Address, ghidra.program.model.address.Address)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void addRange(Address addr1, Address addr2) {
|
||||
if (!inTransaction) {
|
||||
|
@ -173,9 +164,6 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#addRegisterRange(ghidra.program.model.address.Address, ghidra.program.model.address.Address)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void addRegisterRange(Address addr1, Address addr2) {
|
||||
if (!inTransaction) {
|
||||
|
@ -184,9 +172,6 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
tmpRegAddrs.addRange(addr1, addr2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#getRegisterAddressSet()
|
||||
*/
|
||||
@Override
|
||||
public synchronized AddressSetView getRegisterAddressSet() {
|
||||
SynchronizedAddressSetCollection addressSetCollection =
|
||||
|
@ -195,9 +180,6 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
return addressSetCollection.getCombinedAddressSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#dataTypeChanged(long)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void dataTypeChanged(long id) {
|
||||
if (!inTransaction) {
|
||||
|
@ -209,9 +191,6 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#dataTypeAdded(long)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void dataTypeAdded(long id) {
|
||||
if (!inTransaction) {
|
||||
|
@ -220,25 +199,16 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
tmpAddedDataTypeIds.add(new Long(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#getDataTypeChanges()
|
||||
*/
|
||||
@Override
|
||||
public synchronized long[] getDataTypeChanges() {
|
||||
return getLongs(changedDataTypeIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#getDataTypeAdditions()
|
||||
*/
|
||||
@Override
|
||||
public synchronized long[] getDataTypeAdditions() {
|
||||
return getLongs(addedDataTypeIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#categoryChanged(long)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void categoryChanged(long id) {
|
||||
if (!inTransaction) {
|
||||
|
@ -250,9 +220,6 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#categoryAdded(long)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void categoryAdded(long id) {
|
||||
if (!inTransaction) {
|
||||
|
@ -261,25 +228,16 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
tmpAddedCategoryIds.add(new Long(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#getCategoryChanges()
|
||||
*/
|
||||
@Override
|
||||
public synchronized long[] getCategoryChanges() {
|
||||
return getLongs(changedCategoryIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#getCategoryAdditions()
|
||||
*/
|
||||
@Override
|
||||
public synchronized long[] getCategoryAdditions() {
|
||||
return getLongs(addedCategoryIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#programTreeChanged(long)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void programTreeChanged(long id) {
|
||||
if (!inTransaction) {
|
||||
|
@ -291,9 +249,6 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#programTreeAdded(long)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void programTreeAdded(long id) {
|
||||
if (!inTransaction) {
|
||||
|
@ -302,25 +257,16 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
tmpAddedProgramTreeIds.add(new Long(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#getProgramTreeChanges()
|
||||
*/
|
||||
@Override
|
||||
public synchronized long[] getProgramTreeChanges() {
|
||||
return getLongs(changedProgramTreeIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#getProgramTreeAdditions()
|
||||
*/
|
||||
@Override
|
||||
public synchronized long[] getProgramTreeAdditions() {
|
||||
return getLongs(addedProgramTreeIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#symbolChanged(long)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void symbolChanged(long id) {
|
||||
if (!inTransaction) {
|
||||
|
@ -332,9 +278,6 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#symbolAdded(long)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void symbolAdded(long id) {
|
||||
if (!inTransaction) {
|
||||
|
@ -343,25 +286,16 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
tmpAddedSymbolIds.add(new Long(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#getSymbolChanges()
|
||||
*/
|
||||
@Override
|
||||
public synchronized long[] getSymbolChanges() {
|
||||
return getLongs(changedSymbolIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#getSymbolAdditions()
|
||||
*/
|
||||
@Override
|
||||
public synchronized long[] getSymbolAdditions() {
|
||||
return getLongs(addedSymbolIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#tagChanged(long)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void tagChanged(long id) {
|
||||
if (!inTransaction) {
|
||||
|
@ -373,9 +307,6 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#tagCreated(long)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void tagCreated(long id) {
|
||||
if (!inTransaction) {
|
||||
|
@ -384,25 +315,16 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
tmpAddedTagIds.add(new Long(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#getTagChanges()
|
||||
*/
|
||||
@Override
|
||||
public synchronized long[] getTagChanges() {
|
||||
return getLongs(changedTagIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.listing.ProgramChangeSet#getTagCreations()
|
||||
*/
|
||||
@Override
|
||||
public synchronized long[] getTagCreations() {
|
||||
return getLongs(addedTagIds);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ghidra.program.model.listing.DataTypeChangeSet#archiveAdded(long)
|
||||
*/
|
||||
@Override
|
||||
public void sourceArchiveAdded(long id) {
|
||||
if (!inTransaction) {
|
||||
|
@ -411,9 +333,6 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
tmpAddedSourceArchiveIds.add(new Long(id));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ghidra.program.model.listing.DataTypeChangeSet#archiveChanged(long)
|
||||
*/
|
||||
@Override
|
||||
public void sourceArchiveChanged(long id) {
|
||||
if (!inTransaction) {
|
||||
|
@ -425,25 +344,16 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ghidra.program.model.listing.DataTypeChangeSet#getArchiveAdditions()
|
||||
*/
|
||||
@Override
|
||||
public long[] getSourceArchiveAdditions() {
|
||||
return getLongs(addedSourceArchiveIds);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ghidra.program.model.listing.DataTypeChangeSet#getArchiveChanges()
|
||||
*/
|
||||
@Override
|
||||
public long[] getSourceArchiveChanges() {
|
||||
return getLongs(changedSourceArchiveIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.data.DomainObjectDBChangeSet#clear()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void clearUndo(boolean isCheckedOut) {
|
||||
if (inTransaction) {
|
||||
|
@ -470,9 +380,6 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
clearUndo();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.data.DomainObjectDBChangeSet#startTransaction()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void startTransaction() {
|
||||
inTransaction = true;
|
||||
|
@ -493,9 +400,6 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
tmpAddedTagIds = new HashSet<Long>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.data.DomainObjectDBChangeSet#endTransaction(boolean)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void endTransaction(boolean commit) {
|
||||
if (!inTransaction) {
|
||||
|
@ -556,9 +460,6 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
tmpAddedTagIds = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.data.DomainObjectDBChangeSet#undo()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void undo() {
|
||||
ChangeDiff diff = undoList.removeLast();
|
||||
|
@ -579,9 +480,6 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
redoList.addLast(diff);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.data.DomainObjectDBChangeSet#redo()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void redo() {
|
||||
ChangeDiff diff = redoList.removeLast();
|
||||
|
@ -602,26 +500,17 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
undoList.addLast(diff);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.model.ChangeSet#clearUndo()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void clearUndo() {
|
||||
undoList.clear();
|
||||
redoList.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.data.DomainObjectDBChangeSet#setMaxUndos(int)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void setMaxUndos(int numUndos) {
|
||||
this.numUndos = numUndos;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.model.ChangeSet#read(ghidra.framework.store.db.DBHandle)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void read(DBHandle dbh) throws IOException {
|
||||
|
||||
|
@ -648,6 +537,9 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
private void readIdRecords(DBHandle dbh, String tableName, Set<Long> ids) throws IOException {
|
||||
Table table = dbh.getTable(tableName);
|
||||
if (table != null) {
|
||||
if (table.getSchema().getVersion() != 0) {
|
||||
throw new IOException("Change data produced with newer version of Ghidra");
|
||||
}
|
||||
RecordIterator it = table.iterator();
|
||||
while (it.hasNext()) {
|
||||
Record rec = it.next();
|
||||
|
@ -660,6 +552,9 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
throws IOException {
|
||||
Table table = dbh.getTable(tableName);
|
||||
if (table != null) {
|
||||
if (table.getSchema().getVersion() != 0) {
|
||||
throw new IOException("Change data produced with newer version of Ghidra");
|
||||
}
|
||||
RecordIterator it = table.iterator();
|
||||
while (it.hasNext()) {
|
||||
Record rec = it.next();
|
||||
|
@ -673,9 +568,6 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.model.ChangeSet#write(ghidra.framework.store.db.DBHandle)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void write(DBHandle dbh, boolean isRecoverySave) throws IOException {
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package ghidra.pcodeCPort.slgh_compile.regression;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
@ -167,11 +167,9 @@ public class SleighCompileRegressionTest extends AbstractGenericTest {
|
|||
|
||||
private int runActualCompiler(File inputFile, File actualFile)
|
||||
throws JDOMException, IOException, RecognitionException {
|
||||
return SleighCompileLauncher.runMain(
|
||||
new String[] { "-DMIPS=../../../../../../ghidra/Ghidra/Processors/MIPS",
|
||||
"-D8051=../../../../../../ghidra/Ghidra/Processors/8051",
|
||||
inputFile.getAbsolutePath(), actualFile.getAbsolutePath() },
|
||||
new HashMap<String, String>());
|
||||
return SleighCompileLauncher.runMain(new String[] { "-DBaseDir=../../../../../../",
|
||||
"-DMIPS=ghidra/Ghidra/Processors/MIPS", "-D8051=ghidra/Ghidra/Processors/8051",
|
||||
inputFile.getAbsolutePath(), actualFile.getAbsolutePath() });
|
||||
}
|
||||
|
||||
private static final Pattern SPACEMATCH = Pattern.compile("^\\s*<print piece=\" \"/>\\s*$");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue