GP-1797 removed unused DataTypeConflictException

This commit is contained in:
ghidra1 2022-05-16 12:33:16 -04:00
parent 0acb497263
commit 01067debde
56 changed files with 172 additions and 365 deletions

View file

@ -62,7 +62,8 @@ import ghidra.framework.plugintool.AutoService;
import ghidra.framework.plugintool.ComponentProviderAdapter; import ghidra.framework.plugintool.ComponentProviderAdapter;
import ghidra.framework.plugintool.annotation.AutoServiceConsumed; import ghidra.framework.plugintool.annotation.AutoServiceConsumed;
import ghidra.program.model.address.*; import ghidra.program.model.address.*;
import ghidra.program.model.data.*; import ghidra.program.model.data.DataType;
import ghidra.program.model.data.DataTypeEncodeException;
import ghidra.program.model.lang.*; import ghidra.program.model.lang.*;
import ghidra.program.model.util.CodeUnitInsertionException; import ghidra.program.model.util.CodeUnitInsertionException;
import ghidra.trace.model.*; import ghidra.trace.model.*;
@ -840,7 +841,7 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter
} }
tid.commit(); tid.commit();
} }
catch (CodeUnitInsertionException | DataTypeConflictException | CancelledException e) { catch (CodeUnitInsertionException | CancelledException e) {
throw new AssertionError(e); throw new AssertionError(e);
} }
} }

View file

@ -60,7 +60,6 @@ import ghidra.framework.plugintool.annotation.AutoServiceConsumed;
import ghidra.pcode.exec.trace.TraceSleighUtils; import ghidra.pcode.exec.trace.TraceSleighUtils;
import ghidra.program.model.address.*; import ghidra.program.model.address.*;
import ghidra.program.model.data.DataType; import ghidra.program.model.data.DataType;
import ghidra.program.model.data.DataTypeConflictException;
import ghidra.program.model.lang.Register; import ghidra.program.model.lang.Register;
import ghidra.program.model.listing.*; import ghidra.program.model.listing.*;
import ghidra.program.model.util.CodeUnitInsertionException; import ghidra.program.model.util.CodeUnitInsertionException;
@ -528,7 +527,7 @@ public class DebuggerWatchesProvider extends ComponentProviderAdapter {
listing.clearCodeUnits(row.getAddress(), row.getRange().getMaxAddress(), false); listing.clearCodeUnits(row.getAddress(), row.getRange().getMaxAddress(), false);
listing.createData(address, dataType, size); listing.createData(address, dataType, size);
} }
catch (CodeUnitInsertionException | DataTypeConflictException e) { catch (CodeUnitInsertionException e) {
errs.add(address + " " + dataType + "(" + size + "): " + e.getMessage()); errs.add(address + " " + dataType + "(" + size + "): " + e.getMessage());
} }
} }

View file

@ -41,7 +41,6 @@ import ghidra.app.plugin.core.symtable.SymbolTablePlugin;
import ghidra.app.plugin.debug.MemoryUsagePlugin; import ghidra.app.plugin.debug.MemoryUsagePlugin;
import ghidra.framework.plugintool.util.PluginException; import ghidra.framework.plugintool.util.PluginException;
import ghidra.program.model.address.AddressOverflowException; import ghidra.program.model.address.AddressOverflowException;
import ghidra.program.model.data.DataTypeConflictException;
import ghidra.program.model.data.Undefined4DataType; import ghidra.program.model.data.Undefined4DataType;
import ghidra.program.model.lang.Language; import ghidra.program.model.lang.Language;
import ghidra.program.model.util.CodeUnitInsertionException; import ghidra.program.model.util.CodeUnitInsertionException;
@ -78,7 +77,7 @@ public class DebuggerManualTest extends AbstractGhidraHeadedDebuggerGUITest {
@Test @Test
@Ignore @Ignore
public void testManual01() throws PluginException, CodeUnitInsertionException, public void testManual01() throws PluginException, CodeUnitInsertionException,
DataTypeConflictException, AddressOverflowException, DuplicateNameException, AddressOverflowException, DuplicateNameException,
TraceOverlappedRegionException, InterruptedException { TraceOverlappedRegionException, InterruptedException {
addPlugin(tool, DebuggerBreakpointMarkerPlugin.class); addPlugin(tool, DebuggerBreakpointMarkerPlugin.class);

View file

@ -23,7 +23,6 @@ import ghidra.app.util.importer.MessageLog;
import ghidra.framework.options.Options; import ghidra.framework.options.Options;
import ghidra.program.model.address.*; import ghidra.program.model.address.*;
import ghidra.program.model.data.AlignmentDataType; import ghidra.program.model.data.AlignmentDataType;
import ghidra.program.model.data.DataTypeConflictException;
import ghidra.program.model.listing.*; import ghidra.program.model.listing.*;
import ghidra.program.model.mem.Memory; import ghidra.program.model.mem.Memory;
import ghidra.program.model.mem.MemoryAccessException; import ghidra.program.model.mem.MemoryAccessException;
@ -213,12 +212,6 @@ public class CondenseFillerBytesAnalyzer extends AbstractAnalyzer {
"Unable to condense filler bytes (bad filler value?) at " + fillerAddress, e); "Unable to condense filler bytes (bad filler value?) at " + fillerAddress, e);
return; return;
} }
catch (DataTypeConflictException e) {
// shouldn't happen if we have true filler bytes
Msg.error(this,
"Unable to condense filler bytes (bad filler value?) at " + fillerAddress, e);
return;
}
} }
@Override @Override

View file

@ -18,7 +18,8 @@ package ghidra.app.cmd.data;
import ghidra.framework.cmd.BackgroundCommand; import ghidra.framework.cmd.BackgroundCommand;
import ghidra.framework.model.DomainObject; import ghidra.framework.model.DomainObject;
import ghidra.program.model.address.*; import ghidra.program.model.address.*;
import ghidra.program.model.data.*; import ghidra.program.model.data.DataType;
import ghidra.program.model.data.DataUtilities;
import ghidra.program.model.listing.*; import ghidra.program.model.listing.*;
import ghidra.program.model.util.CodeUnitInsertionException; import ghidra.program.model.util.CodeUnitInsertionException;
import ghidra.util.Swing; import ghidra.util.Swing;
@ -126,8 +127,7 @@ public class CreateDataBackgroundCmd extends BackgroundCommand {
} }
private void createData(Address start, Address end, DataType dataType, Program p, private void createData(Address start, Address end, DataType dataType, Program p,
TaskMonitor monitor) TaskMonitor monitor) throws AddressOverflowException, CodeUnitInsertionException {
throws AddressOverflowException, CodeUnitInsertionException, DataTypeConflictException {
Listing listing = p.getListing(); Listing listing = p.getListing();
listing.clearCodeUnits(start, end, false); listing.clearCodeUnits(start, end, false);

View file

@ -459,9 +459,6 @@ public class ConstantPropagationAnalyzer extends AbstractAnalyzer {
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
// don't care; we tried // don't care; we tried
} }
catch (DataTypeConflictException e) {
// don't care; we tried
}
} }
@Override @Override

View file

@ -20,7 +20,8 @@ import ghidra.app.util.bin.format.pef.PefDebug;
import ghidra.app.util.importer.MessageLog; import ghidra.app.util.importer.MessageLog;
import ghidra.app.util.opinion.PefLoader; import ghidra.app.util.opinion.PefLoader;
import ghidra.program.model.address.*; import ghidra.program.model.address.*;
import ghidra.program.model.data.*; import ghidra.program.model.data.DataType;
import ghidra.program.model.data.DataUtilities;
import ghidra.program.model.data.DataUtilities.ClearDataMode; import ghidra.program.model.data.DataUtilities.ClearDataMode;
import ghidra.program.model.listing.*; import ghidra.program.model.listing.*;
import ghidra.program.model.mem.Memory; import ghidra.program.model.mem.Memory;
@ -69,8 +70,8 @@ public class PefDebugAnalyzer extends AbstractAnalyzer {
} }
private void applyStructure(Program program, Address address) throws MemoryAccessException, private void applyStructure(Program program, Address address) throws MemoryAccessException,
AddressOutOfBoundsException, CodeUnitInsertionException, DataTypeConflictException, AddressOutOfBoundsException, CodeUnitInsertionException, DuplicateNameException,
DuplicateNameException, InvalidInputException, CircularDependencyException { InvalidInputException, CircularDependencyException {
Listing listing = program.getListing(); Listing listing = program.getListing();
Memory memory = program.getMemory(); Memory memory = program.getMemory();

View file

@ -29,7 +29,8 @@ import docking.widgets.fieldpanel.support.FieldLocation;
import ghidra.framework.plugintool.Plugin; import ghidra.framework.plugintool.Plugin;
import ghidra.program.database.util.ProgramTransaction; import ghidra.program.database.util.ProgramTransaction;
import ghidra.program.model.address.*; import ghidra.program.model.address.*;
import ghidra.program.model.data.*; import ghidra.program.model.data.DataType;
import ghidra.program.model.data.DataTypeEncodeException;
import ghidra.program.model.listing.*; import ghidra.program.model.listing.*;
import ghidra.program.model.mem.MemoryAccessException; import ghidra.program.model.mem.MemoryAccessException;
import ghidra.program.model.util.CodeUnitInsertionException; import ghidra.program.model.util.CodeUnitInsertionException;
@ -146,7 +147,7 @@ public class PatchDataAction extends AbstractPatchAction {
catch (MemoryAccessException e) { catch (MemoryAccessException e) {
Msg.showError(this, null, "Patch Failure", e.getMessage(), e); Msg.showError(this, null, "Patch Failure", e.getMessage(), e);
} }
catch (CodeUnitInsertionException | DataTypeConflictException e) { catch (CodeUnitInsertionException e) {
throw new AssertionError(); // Should have been cleared first throw new AssertionError(); // Should have been cleared first
} }
} }

View file

@ -527,12 +527,10 @@ public abstract class CompEditorModel extends CompositeEditorModel {
* *
* @throws InvalidDataTypeException if the structure being edited is part * @throws InvalidDataTypeException if the structure being edited is part
* of the data type being inserted or if inserting isn't allowed. * of the data type being inserted or if inserting isn't allowed.
* @throws DataTypeConflictException if creating the data type or one of
* its sub-parts conflicted with an existing data type.
*/ */
@Override @Override
public DataTypeComponent insert(int rowIndex, DataType datatype, int length) public DataTypeComponent insert(int rowIndex, DataType datatype, int length)
throws UsrException { throws InvalidDataTypeException, UsrException {
if (isEditingField()) { if (isEditingField()) {
endFieldEditing(); endFieldEditing();
@ -999,8 +997,7 @@ public abstract class CompEditorModel extends CompositeEditorModel {
public abstract void clearComponents(int[] rows) throws UsrException; public abstract void clearComponents(int[] rows) throws UsrException;
@Override @Override
protected void createArray(int numElements) protected void createArray(int numElements) throws InvalidDataTypeException, UsrException {
throws InvalidDataTypeException, DataTypeConflictException, UsrException {
if (selection.getNumRanges() != 1) { if (selection.getNumRanges() != 1) {
throw new UsrException("Can only create arrays on a contiguous selection."); throw new UsrException("Can only create arrays on a contiguous selection.");
} }

View file

@ -509,8 +509,7 @@ public abstract class CompositeEditorModel extends CompositeViewerModel implemen
} }
} }
protected void createArray(int numElements) protected void createArray(int numElements) throws InvalidDataTypeException, UsrException {
throws InvalidDataTypeException, DataTypeConflictException, UsrException {
if (selection.getNumRanges() != 1) { if (selection.getNumRanges() != 1) {
throw new UsrException("Can only create arrays on a contiguous selection."); throw new UsrException("Can only create arrays on a contiguous selection.");
} }

View file

@ -1091,7 +1091,7 @@ class StructureEditorModel extends CompEditorModel {
} }
public void createInternalStructure(TaskMonitor monitor) public void createInternalStructure(TaskMonitor monitor)
throws InvalidDataTypeException, DataTypeConflictException, UsrException { throws InvalidDataTypeException, UsrException {
if (selection.getNumRanges() != 1) { if (selection.getNumRanges() != 1) {
throw new UsrException("Can only create structure on a contiguous selection."); throw new UsrException("Can only create structure on a contiguous selection.");

View file

@ -187,8 +187,7 @@ class UnionEditorModel extends CompEditorModel {
} }
@Override @Override
protected void createArray(int numElements) protected void createArray(int numElements) throws InvalidDataTypeException, UsrException {
throws InvalidDataTypeException, DataTypeConflictException, UsrException {
if (getNumSelectedComponentRows() != 1) { if (getNumSelectedComponentRows() != 1) {
throw new UsrException("Select an individual component to create an array."); throw new UsrException("Select an individual component to create an array.");
} }
@ -362,11 +361,10 @@ class UnionEditorModel extends CompEditorModel {
* *
* @throws InvalidDataTypeException if the union being edited is part * @throws InvalidDataTypeException if the union being edited is part
* of the data type being inserted or if inserting isn't allowed. * of the data type being inserted or if inserting isn't allowed.
* @throws DataTypeConflictException if creating the data type or one of
* its sub-parts conflicted with an existing data type.
*/ */
@Override @Override
public DataTypeComponent insert(int rowIndex, DataType dt, int dtLength) throws UsrException { public DataTypeComponent insert(int rowIndex, DataType dt, int dtLength)
throws InvalidDataTypeException, UsrException {
if (dt.equals(DataType.DEFAULT)) { if (dt.equals(DataType.DEFAULT)) {
throw new InvalidDataTypeException( throw new InvalidDataTypeException(
"Inserting undefined bytes is not allowed in a union."); "Inserting undefined bytes is not allowed in a union.");

View file

@ -351,7 +351,7 @@ public class AddressTable {
// create table size dw's after the jmp // create table size dw's after the jmp
// (could create as an array) // (could create as an array)
try {
// create a case label // create a case label
Symbol curSymbol = program.getSymbolTable().getPrimarySymbol(tableAddr); Symbol curSymbol = program.getSymbolTable().getPrimarySymbol(tableAddr);
if (curSymbol != null && curSymbol.getName().startsWith("Addr")) { if (curSymbol != null && curSymbol.getName().startsWith("Addr")) {
@ -362,7 +362,8 @@ public class AddressTable {
} }
Address lastAddress = null; Address lastAddress = null;
DataType ptrDT = program.getDataTypeManager().addDataType( DataType ptrDT = program.getDataTypeManager()
.addDataType(
PointerDataType.getPointer(null, addrSize), null); PointerDataType.getPointer(null, addrSize), null);
for (int i = 0; i < tableSize; i++) { for (int i = 0; i < tableSize; i++) {
Address loc = tableAddr.add(i * addrSize); Address loc = tableAddr.add(i * addrSize);
@ -393,6 +394,7 @@ public class AddressTable {
} }
} }
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
// couldn't create
} }
Data data = program.getListing().getDataAt(loc); Data data = program.getListing().getDataAt(loc);
if (data == null) { if (data == null) {
@ -462,10 +464,6 @@ public class AddressTable {
if (!ftype.isCall()) { if (!ftype.isCall()) {
fixupFunctionBody(program, start_inst, monitor); fixupFunctionBody(program, start_inst, monitor);
} }
}
catch (DataTypeConflictException e1) {
return false;
}
// create the index array if this table has one // create the index array if this table has one
if (getIndexLength() > 0) { if (getIndexLength() > 0) {

View file

@ -30,7 +30,6 @@ import ghidra.app.util.importer.MessageLog;
import ghidra.framework.options.Options; import ghidra.framework.options.Options;
import ghidra.program.disassemble.Disassembler; import ghidra.program.disassemble.Disassembler;
import ghidra.program.model.address.*; import ghidra.program.model.address.*;
import ghidra.program.model.data.DataTypeConflictException;
import ghidra.program.model.data.PointerDataType; import ghidra.program.model.data.PointerDataType;
import ghidra.program.model.listing.*; import ghidra.program.model.listing.*;
import ghidra.program.model.symbol.*; import ghidra.program.model.symbol.*;
@ -362,9 +361,6 @@ public class EntryPointAnalyzer extends AbstractAnalyzer {
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
// couldn't create // couldn't create
} }
catch (DataTypeConflictException e) {
// couldn't create
}
} }
private int addExternalSymbolsToSet(Program program, AddressSetView addressSet, private int addExternalSymbolsToSet(Program program, AddressSetView addressSet,

View file

@ -26,7 +26,8 @@ import ghidra.docking.settings.Settings;
import ghidra.framework.cmd.BackgroundCommand; import ghidra.framework.cmd.BackgroundCommand;
import ghidra.framework.model.DomainObject; import ghidra.framework.model.DomainObject;
import ghidra.program.model.address.Address; import ghidra.program.model.address.Address;
import ghidra.program.model.data.*; import ghidra.program.model.data.AbstractIntegerDataType;
import ghidra.program.model.data.DataType;
import ghidra.program.model.listing.*; import ghidra.program.model.listing.*;
import ghidra.program.model.scalar.Scalar; import ghidra.program.model.scalar.Scalar;
import ghidra.program.model.symbol.Equate; import ghidra.program.model.symbol.Equate;
@ -89,8 +90,7 @@ public class ConvertCommand extends BackgroundCommand {
return msg == null; return msg == null;
} }
private boolean applyDataSettings(Data data) private boolean applyDataSettings(Data data) throws CodeUnitInsertionException {
throws CodeUnitInsertionException, DataTypeConflictException {
DataType dt = data.getBaseDataType(); DataType dt = data.getBaseDataType();
Settings settings = data; Settings settings = data;
@ -130,7 +130,7 @@ public class ConvertCommand extends BackgroundCommand {
} }
private void createData(Data data, DataType unsignedDataType) private void createData(Data data, DataType unsignedDataType)
throws CodeUnitInsertionException, DataTypeConflictException { throws CodeUnitInsertionException {
Listing listing = data.getProgram().getListing(); Listing listing = data.getProgram().getListing();
Address addr = data.getAddress(); Address addr = data.getAddress();
listing.clearCodeUnits(addr, data.getMaxAddress(), false); listing.clearCodeUnits(addr, data.getMaxAddress(), false);

View file

@ -85,7 +85,8 @@ public abstract class GccAnalysisClass {
// try creating without clearing, the code units should be clear // try creating without clearing, the code units should be clear
program.getListing().createData(addr, dt); program.getListing().createData(addr, dt);
} }
catch (CodeUnitInsertionException | DataTypeConflictException e) { catch (CodeUnitInsertionException e) {
// TODO: not sure what this accomplishes since no clearing will be done
CreateDataCmd dataCmd = new CreateDataCmd(addr, dt); CreateDataCmd dataCmd = new CreateDataCmd(addr, dt);
dataCmd.applyTo(program); dataCmd.applyTo(program);
} }

View file

@ -18,11 +18,10 @@ package ghidra.app.util.bin.format.dwarf4.next;
import static ghidra.app.util.bin.format.dwarf4.encoding.DWARFAttribute.*; import static ghidra.app.util.bin.format.dwarf4.encoding.DWARFAttribute.*;
import static ghidra.app.util.bin.format.dwarf4.encoding.DWARFTag.*; import static ghidra.app.util.bin.format.dwarf4.encoding.DWARFTag.*;
import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.io.IOException;
import ghidra.app.cmd.comments.AppendCommentCmd; import ghidra.app.cmd.comments.AppendCommentCmd;
import ghidra.app.cmd.label.SetLabelPrimaryCmd; import ghidra.app.cmd.label.SetLabelPrimaryCmd;
import ghidra.app.util.bin.format.dwarf4.*; import ghidra.app.util.bin.format.dwarf4.*;
@ -976,7 +975,7 @@ public class DWARFFunctionImporter {
} }
return result; return result;
} }
catch (CodeUnitInsertionException | DataTypeConflictException e) { catch (CodeUnitInsertionException e) {
Msg.error(this, "Error creating data object at " + address, e); Msg.error(this, "Error creating data object at " + address, e);
} }
return null; return null;

View file

@ -22,8 +22,9 @@ import org.apache.commons.lang3.StringUtils;
import ghidra.app.util.bin.format.elf.*; import ghidra.app.util.bin.format.elf.*;
import ghidra.app.util.importer.MessageLog; import ghidra.app.util.importer.MessageLog;
import ghidra.program.model.address.Address; import ghidra.program.model.address.Address;
import ghidra.program.model.data.*; import ghidra.program.model.data.DataUtilities;
import ghidra.program.model.data.DataUtilities.ClearDataMode; import ghidra.program.model.data.DataUtilities.ClearDataMode;
import ghidra.program.model.data.PointerTypedef;
import ghidra.program.model.listing.*; import ghidra.program.model.listing.*;
import ghidra.program.model.mem.MemoryAccessException; import ghidra.program.model.mem.MemoryAccessException;
import ghidra.program.model.util.CodeUnitInsertionException; import ghidra.program.model.util.CodeUnitInsertionException;
@ -90,7 +91,7 @@ abstract public class ElfRelocationHandler implements ExtensionPoint {
DataUtilities.createData(program, addr, dt, -1, false, DataUtilities.createData(program, addr, dt, -1, false,
ClearDataMode.CLEAR_ALL_UNDEFINED_CONFLICT_DATA); ClearDataMode.CLEAR_ALL_UNDEFINED_CONFLICT_DATA);
} }
catch (CodeUnitInsertionException | DataTypeConflictException e) { catch (CodeUnitInsertionException e) {
Msg.error(ElfRelocationHandler.class, Msg.error(ElfRelocationHandler.class,
"Failed to apply component-offset pointer at " + addr); "Failed to apply component-offset pointer at " + addr);
} }

View file

@ -139,7 +139,7 @@ public final class ObjectiveC1_Utilities {
* Applies the data type at the specified address. * Applies the data type at the specified address.
*/ */
public static void applyData(Program program, DataType dt, Address address) public static void applyData(Program program, DataType dt, Address address)
throws CodeUnitInsertionException, DataTypeConflictException { throws CodeUnitInsertionException {
Data data = program.getListing().getDefinedDataAt(address); Data data = program.getListing().getDefinedDataAt(address);
if (data != null && data.getDataType().isEquivalent(dt)) { if (data != null && data.getDataType().isEquivalent(dt)) {
return; return;
@ -176,26 +176,12 @@ public final class ObjectiveC1_Utilities {
* Applies a pointer data type at the specified address and returns the address being referenced. * Applies a pointer data type at the specified address and returns the address being referenced.
*/ */
public static Address createPointerAndReturnAddressBeingReferenced(Program program, public static Address createPointerAndReturnAddressBeingReferenced(Program program,
Address address) throws CodeUnitInsertionException, DataTypeConflictException { Address address) throws CodeUnitInsertionException {
program.getListing().createData(address, new PointerDataType()); program.getListing().createData(address, new PointerDataType());
Data data = program.getListing().getDefinedDataAt(address); Data data = program.getListing().getDefinedDataAt(address);
return (Address) data.getValue(); return (Address) data.getValue();
} }
/**
* Applies a pointer data type at the specified address and returns the newly created data object.
*/
public static Data createPointer(Program program, Address address) {
try {
program.getListing().createData(address, new PointerDataType());
Data data = program.getListing().getDefinedDataAt(address);
return data;
}
catch (Exception e) {
}
return null;
}
/** /**
* Returns the name space inside the given parent name space. * Returns the name space inside the given parent name space.
* If it does not exist, then create it and return it. * If it does not exist, then create it and return it.

View file

@ -65,7 +65,7 @@ public class DebugDataDirectory extends DataDirectory {
@Override @Override
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException, NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
DataTypeConflictException, IOException { IOException {
monitor.setMessage(program.getName()+": debug..."); monitor.setMessage(program.getName()+": debug...");
Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress); Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress);

View file

@ -87,7 +87,7 @@ public class DelayImportDataDirectory extends DataDirectory {
@Override @Override
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException, NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
DataTypeConflictException, IOException { IOException {
monitor.setMessage(program.getName()+": delay import(s)..."); monitor.setMessage(program.getName()+": delay import(s)...");
Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress); Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress);
@ -187,7 +187,7 @@ public class DelayImportDataDirectory extends DataDirectory {
DelayImportDescriptor descriptor, DelayImportDescriptor descriptor,
TaskMonitor monitor, TaskMonitor monitor,
MessageLog log) MessageLog log)
throws DataTypeConflictException, DuplicateNameException { throws DuplicateNameException {
Map<ThunkData, ImportByName> map = descriptor.getImportByNameMap(); Map<ThunkData, ImportByName> map = descriptor.getImportByNameMap();
Iterator<ThunkData> thunks = map.keySet().iterator(); Iterator<ThunkData> thunks = map.keySet().iterator();

View file

@ -50,7 +50,7 @@ public class ExceptionDataDirectory extends DataDirectory {
@Override @Override
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException, NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
DataTypeConflictException, IOException { IOException {
monitor.setMessage(program.getName()+": exceptions..."); monitor.setMessage(program.getName()+": exceptions...");
Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress); Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress);
if (!program.getMemory().contains(addr)) { if (!program.getMemory().contains(addr)) {

View file

@ -146,7 +146,7 @@ public class ExportDataDirectory extends DataDirectory {
@Override @Override
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException, NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
DataTypeConflictException, IOException { IOException {
monitor.setMessage("[" + program.getName() + "]: exports..."); monitor.setMessage("[" + program.getName() + "]: exports...");
Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress); Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress);

View file

@ -42,7 +42,7 @@ public class GlobalPointerDataDirectory extends DataDirectory {
@Override @Override
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException, NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
DataTypeConflictException, IOException { IOException {
monitor.setMessage(program.getName()+": global pointers..."); monitor.setMessage(program.getName()+": global pointers...");
Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress); Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress);
if (!program.getMemory().contains(addr)) { if (!program.getMemory().contains(addr)) {

View file

@ -77,7 +77,7 @@ public class ImportDataDirectory extends DataDirectory {
@Override @Override
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException, NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
DataTypeConflictException, IOException, MemoryAccessException { IOException, MemoryAccessException {
if (imports == null || descriptors == null) { if (imports == null || descriptors == null) {
return; return;

View file

@ -51,7 +51,7 @@ public class LoadConfigDataDirectory extends DataDirectory {
@Override @Override
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException, NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
DataTypeConflictException, IOException { IOException {
monitor.setMessage(program.getName()+": load config directory..."); monitor.setMessage(program.getName()+": load config directory...");
Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress); Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress);

View file

@ -178,7 +178,7 @@ public class ResourceDataDirectory extends DataDirectory {
@Override @Override
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException, NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
DataTypeConflictException, IOException { IOException {
if (rootDirectory == null) { if (rootDirectory == null) {
return; return;

View file

@ -64,7 +64,7 @@ public class SecurityDataDirectory extends DataDirectory implements ByteArrayCon
@Override @Override
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException, NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
DataTypeConflictException, IOException { IOException {
if (!isBinary) {//certificates are never mapped into running program... if (!isBinary) {//certificates are never mapped into running program...
return; return;

View file

@ -21,7 +21,8 @@ import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.importer.MessageLog; import ghidra.app.util.importer.MessageLog;
import ghidra.program.model.address.Address; import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressSpace; import ghidra.program.model.address.AddressSpace;
import ghidra.program.model.data.*; import ghidra.program.model.data.DataType;
import ghidra.program.model.data.PointerDataType;
import ghidra.program.model.listing.Program; import ghidra.program.model.listing.Program;
import ghidra.program.model.mem.DumbMemBufferImpl; import ghidra.program.model.mem.DumbMemBufferImpl;
import ghidra.program.model.symbol.SourceType; import ghidra.program.model.symbol.SourceType;
@ -58,7 +59,7 @@ public class TLSDataDirectory extends DataDirectory {
@Override @Override
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException, NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
DataTypeConflictException, IOException { IOException {
monitor.setMessage(program.getName()+": TLS..."); monitor.setMessage(program.getName()+": TLS...");
Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress); Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress);

View file

@ -456,9 +456,6 @@ public class CliTableMethodDef extends CliAbstractTable {
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
// Ignore, something there already // Ignore, something there already
} }
catch (DataTypeConflictException e) {
// Ignore, something there already
}
catch (NullPointerException e) { catch (NullPointerException e) {
Msg.warn(this, "Error processing function \"" + funcName + "\" (" + methodRowIndex + Msg.warn(this, "Error processing function \"" + funcName + "\" (" + methodRowIndex +
"): Bad parameters provided"); "): Bad parameters provided");

View file

@ -173,9 +173,6 @@ public class ThreadEnvironmentBlock {
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
Msg.warn(this, "Unable to insert TEB field: " + name); Msg.warn(this, "Unable to insert TEB field: " + name);
} }
catch (DataTypeConflictException e) {
Msg.warn(this, "TEB data-type conflicts with existing data-type: " + dat.getName());
}
catch (InvalidInputException e) { catch (InvalidInputException e) {
Msg.warn(this, "Unable to create TEB symbol name: " + name); Msg.warn(this, "Unable to create TEB symbol name: " + name);
} }
@ -706,13 +703,12 @@ public class ThreadEnvironmentBlock {
* @throws AddressOverflowException for problems with block's start Address * @throws AddressOverflowException for problems with block's start Address
* @throws IllegalArgumentException for problems with the block name or the TEB data-type * @throws IllegalArgumentException for problems with the block name or the TEB data-type
* @throws LockException if it cannot get an exclusive lock on the program * @throws LockException if it cannot get an exclusive lock on the program
* @throws DataTypeConflictException for conflicts with other data-types
* @throws CodeUnitInsertionException for problems laying down the structure on the block * @throws CodeUnitInsertionException for problems laying down the structure on the block
* @throws InvalidInputException for problems with the symbol name attached to the TEB * @throws InvalidInputException for problems with the symbol name attached to the TEB
*/ */
public void createBlockAndStructure() throws MemoryConflictException, LockException, public void createBlockAndStructure() throws MemoryConflictException, LockException,
IllegalArgumentException, AddressOverflowException, CodeUnitInsertionException, IllegalArgumentException, AddressOverflowException, CodeUnitInsertionException,
DataTypeConflictException, InvalidInputException { InvalidInputException {
Memory memory = program.getMemory(); Memory memory = program.getMemory();
MemoryBlock block = memory.getBlock(BLOCK_NAME); MemoryBlock block = memory.getBlock(BLOCK_NAME);
if (block != null) { if (block != null) {

View file

@ -568,9 +568,6 @@ public class DemangledFunction extends DemangledObject {
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
// ignore // ignore
} }
catch (DataTypeConflictException e) {
// ignore - should not happen
}
} }
private DataType resolveReturnType(Program program, Function function, private DataType resolveReturnType(Program program, Function function,

View file

@ -30,7 +30,8 @@ import ghidra.app.util.importer.MessageLog;
import ghidra.framework.model.DomainObject; import ghidra.framework.model.DomainObject;
import ghidra.program.database.mem.FileBytes; import ghidra.program.database.mem.FileBytes;
import ghidra.program.model.address.*; import ghidra.program.model.address.*;
import ghidra.program.model.data.*; import ghidra.program.model.data.DataType;
import ghidra.program.model.data.Undefined;
import ghidra.program.model.lang.Language; import ghidra.program.model.lang.Language;
import ghidra.program.model.listing.*; import ghidra.program.model.listing.*;
import ghidra.program.model.mem.*; import ghidra.program.model.mem.*;
@ -384,7 +385,7 @@ public class CoffLoader extends AbstractLibrarySupportLoader {
} }
private Data createUndefined(Listing listing, Memory memory, Address addr, int size) private Data createUndefined(Listing listing, Memory memory, Address addr, int size)
throws CodeUnitInsertionException, DataTypeConflictException { throws CodeUnitInsertionException {
MemoryBlock block = memory.getBlock(addr); MemoryBlock block = memory.getBlock(addr);
if (block == null || !block.isInitialized()) { if (block == null || !block.isInitialized()) {
return null; return null;

View file

@ -502,9 +502,6 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
// ignore // ignore
} }
catch (DataTypeConflictException e) {
// ignore
}
if (cu == null) { if (cu == null) {
cu = listing.getCodeUnitAt(nextAddr); cu = listing.getCodeUnitAt(nextAddr);
@ -2099,9 +2096,6 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
log("ELF data markup conflict at " + address); log("ELF data markup conflict at " + address);
} }
catch (DataTypeConflictException e) {
throw new AssertException("unexpected", e);
}
return null; return null;
} }
@ -2118,9 +2112,6 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
log("ELF data markup conflict while applying " + dt.getName() + " at " + address); log("ELF data markup conflict while applying " + dt.getName() + " at " + address);
} }
catch (DataTypeConflictException e) {
log("ELF data type conflict:" + getMessage(e));
}
return null; return null;
} }
@ -2556,8 +2547,7 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
} }
} }
private int createString(Address address) private int createString(Address address) throws CodeUnitInsertionException {
throws CodeUnitInsertionException, DataTypeConflictException {
Data d = listing.getDataAt(address); Data d = listing.getDataAt(address);
if (d == null || !TerminatedStringDataType.dataType.isEquivalent(d.getDataType())) { if (d == null || !TerminatedStringDataType.dataType.isEquivalent(d.getDataType())) {
d = listing.createData(address, TerminatedStringDataType.dataType, -1); d = listing.createData(address, TerminatedStringDataType.dataType, -1);

View file

@ -24,12 +24,12 @@ import ghidra.app.util.MemoryBlockUtils;
import ghidra.app.util.Option; import ghidra.app.util.Option;
import ghidra.app.util.bin.ByteProvider; import ghidra.app.util.bin.ByteProvider;
import ghidra.app.util.bin.format.ne.*; import ghidra.app.util.bin.format.ne.*;
import ghidra.app.util.bin.format.ne.Resource;
import ghidra.app.util.importer.MessageLog; import ghidra.app.util.importer.MessageLog;
import ghidra.framework.options.Options; import ghidra.framework.options.Options;
import ghidra.program.database.function.OverlappingFunctionException; import ghidra.program.database.function.OverlappingFunctionException;
import ghidra.program.model.address.*; import ghidra.program.model.address.*;
import ghidra.program.model.data.*; import ghidra.program.model.data.ByteDataType;
import ghidra.program.model.data.StringDataType;
import ghidra.program.model.lang.Register; import ghidra.program.model.lang.Register;
import ghidra.program.model.listing.*; import ghidra.program.model.listing.*;
import ghidra.program.model.mem.*; import ghidra.program.model.mem.*;
@ -375,8 +375,7 @@ public class NeLoader extends AbstractLibrarySupportLoader {
listing.createData(straddr, new StringDataType(), listing.createData(straddr, new StringDataType(),
Conv.byteToInt(string.getLength())); Conv.byteToInt(string.getLength()));
} }
catch (AddressOverflowException | CodeUnitInsertionException catch (AddressOverflowException | CodeUnitInsertionException e) {
| DataTypeConflictException e) {
log.appendMsg("Error creating data"); log.appendMsg("Error creating data");
log.appendException(e); log.appendException(e);
} }

View file

@ -27,7 +27,8 @@ import ghidra.app.util.bin.format.omf.OmfFixupRecord.Subrecord;
import ghidra.app.util.importer.MessageLog; import ghidra.app.util.importer.MessageLog;
import ghidra.program.model.address.Address; import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressOverflowException; import ghidra.program.model.address.AddressOverflowException;
import ghidra.program.model.data.*; import ghidra.program.model.data.DataType;
import ghidra.program.model.data.Undefined;
import ghidra.program.model.lang.Language; import ghidra.program.model.lang.Language;
import ghidra.program.model.listing.*; import ghidra.program.model.listing.*;
import ghidra.program.model.mem.*; import ghidra.program.model.mem.*;
@ -552,10 +553,9 @@ public class OmfLoader extends AbstractLibrarySupportLoader {
* @param size is the number of bytes in the data * @param size is the number of bytes in the data
* @return the new created Data object * @return the new created Data object
* @throws CodeUnitInsertionException if the new data conflicts with another object * @throws CodeUnitInsertionException if the new data conflicts with another object
* @throws DataTypeConflictException if the data-type cannot be created
*/ */
private Data createUndefined(Listing listing, Memory memory, Address addr, int size) private Data createUndefined(Listing listing, Memory memory, Address addr, int size)
throws CodeUnitInsertionException, DataTypeConflictException { throws CodeUnitInsertionException {
MemoryBlock block = memory.getBlock(addr); MemoryBlock block = memory.getBlock(addr);
if (block == null || !block.isInitialized()) { if (block == null || !block.isInitialized()) {
return null; return null;

View file

@ -160,9 +160,6 @@ public class PeLoader extends AbstractPeDebugLoader {
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
throw new IOException(e); throw new IOException(e);
} }
catch (DataTypeConflictException e) {
throw new IOException(e);
}
catch (MemoryAccessException e) { catch (MemoryAccessException e) {
throw new IOException(e); throw new IOException(e);
} }

View file

@ -2399,9 +2399,6 @@ public class SymbolicPropogator {
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
data = program.getListing().getDefinedDataAt(address); data = program.getListing().getDefinedDataAt(address);
} }
catch (DataTypeConflictException e) {
// do nothing
}
int addrByteSize = dt.getLength(); int addrByteSize = dt.getLength();
return addrByteSize; return addrByteSize;

View file

@ -279,9 +279,6 @@ public abstract class PCodeTestAbstractControlBlock {
// catch (CodeUnitInsertionException e) { // catch (CodeUnitInsertionException e) {
// // ignore // // ignore
// } // }
// catch (DataTypeConflictException e) {
// // ignore
// }
// } // }
protected void applyU4Data(Address addr) { protected void applyU4Data(Address addr) {
@ -291,9 +288,6 @@ public abstract class PCodeTestAbstractControlBlock {
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
// ignore // ignore
} }
catch (DataTypeConflictException e) {
// ignore
}
} }
protected int getStructureComponent(Structure testInfoStruct, String fieldName) { protected int getStructureComponent(Structure testInfoStruct, String fieldName) {

View file

@ -43,7 +43,8 @@ import ghidra.program.database.*;
import ghidra.program.disassemble.Disassembler; import ghidra.program.disassemble.Disassembler;
import ghidra.program.disassemble.DisassemblerMessageListener; import ghidra.program.disassemble.DisassemblerMessageListener;
import ghidra.program.model.address.*; import ghidra.program.model.address.*;
import ghidra.program.model.data.*; import ghidra.program.model.data.ByteDataType;
import ghidra.program.model.data.DataType;
import ghidra.program.model.lang.*; import ghidra.program.model.lang.*;
import ghidra.program.model.listing.*; import ghidra.program.model.listing.*;
import ghidra.program.model.mem.*; import ghidra.program.model.mem.*;
@ -134,8 +135,7 @@ public abstract class AbstractListingMergeManagerTest extends AbstractMergeTest
program.getMemory().setBytes(addr, bytes); program.getMemory().setBytes(addr, bytes);
listing.createData(addr, dt); listing.createData(addr, dt);
} }
catch (CodeUnitInsertionException | DataTypeConflictException catch (CodeUnitInsertionException | MemoryAccessException e) {
| MemoryAccessException e) {
Assert.fail(e.getMessage()); Assert.fail(e.getMessage());
} }
Data data = listing.getDataAt(addr); Data data = listing.getDataAt(addr);

View file

@ -15,7 +15,7 @@
*/ */
package ghidra.app.merge.listing; package ghidra.app.merge.listing;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.*;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -892,9 +892,6 @@ public class CodeUnitMergeManager1Test extends AbstractListingMergeManagerTest {
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
e.printStackTrace(); e.printStackTrace();
} }
catch (DataTypeConflictException e) {
e.printStackTrace();
}
finally { finally {
program.endTransaction(txId, commit); program.endTransaction(txId, commit);
} }
@ -1016,9 +1013,6 @@ public class CodeUnitMergeManager1Test extends AbstractListingMergeManagerTest {
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
e.printStackTrace(); e.printStackTrace();
} }
catch (DataTypeConflictException e) {
e.printStackTrace();
}
finally { finally {
program.endTransaction(txId, commit); program.endTransaction(txId, commit);
} }
@ -1134,9 +1128,6 @@ public class CodeUnitMergeManager1Test extends AbstractListingMergeManagerTest {
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
e.printStackTrace(); e.printStackTrace();
} }
catch (DataTypeConflictException e) {
e.printStackTrace();
}
finally { finally {
program.endTransaction(txId, commit); program.endTransaction(txId, commit);
} }
@ -1276,9 +1267,6 @@ public class CodeUnitMergeManager1Test extends AbstractListingMergeManagerTest {
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
e.printStackTrace(); e.printStackTrace();
} }
catch (DataTypeConflictException e) {
e.printStackTrace();
}
finally { finally {
program.endTransaction(txId, commit); program.endTransaction(txId, commit);
} }

View file

@ -193,7 +193,7 @@ public class CodeBrowserTest extends AbstractGhidraHeadedIntegrationTest {
} }
@Test @Test
public void testSelectionOnStructureInOffcutView_SCR_8089() throws DataTypeConflictException { public void testSelectionOnStructureInOffcutView_SCR_8089() {
// create offcut view, the view will contain 3 bytes, but the structure will be 4 bytes // create offcut view, the view will contain 3 bytes, but the structure will be 4 bytes
cb.getListingPanel().setView(new AddressSet(addr("0100101c"), addr("0100101e"))); cb.getListingPanel().setView(new AddressSet(addr("0100101c"), addr("0100101e")));

View file

@ -118,10 +118,6 @@ public class CFStringAnalyzer extends AbstractAnalyzer {
log.appendException(e); log.appendException(e);
return false; return false;
} }
catch (DataTypeConflictException e) {
log.appendException(e);
return false;
}
catch (InvalidInputException e) { catch (InvalidInputException e) {
log.appendException(e); log.appendException(e);
// return false; // return false;

View file

@ -15,12 +15,14 @@
*/ */
package ghidra.macosx.analyzers; package ghidra.macosx.analyzers;
import java.util.ArrayList;
import java.util.List;
import ghidra.app.services.*; import ghidra.app.services.*;
import ghidra.app.util.importer.MessageLog; import ghidra.app.util.importer.MessageLog;
import ghidra.app.util.opinion.MachoLoader; import ghidra.app.util.opinion.MachoLoader;
import ghidra.program.model.address.Address; import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressSetView; import ghidra.program.model.address.AddressSetView;
import ghidra.program.model.data.DataTypeConflictException;
import ghidra.program.model.data.PointerDataType; import ghidra.program.model.data.PointerDataType;
import ghidra.program.model.listing.Data; import ghidra.program.model.listing.Data;
import ghidra.program.model.listing.Program; import ghidra.program.model.listing.Program;
@ -29,9 +31,6 @@ import ghidra.program.model.util.CodeUnitInsertionException;
import ghidra.util.exception.CancelledException; import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
import java.util.ArrayList;
import java.util.List;
public class MachoConstructorDestructorAnalyzer extends AbstractAnalyzer { public class MachoConstructorDestructorAnalyzer extends AbstractAnalyzer {
private static final String NAME = "Mach-O Constructor/Destructor"; private static final String NAME = "Mach-O Constructor/Destructor";
private static final String DESCRIPTION = private static final String DESCRIPTION =
@ -67,9 +66,6 @@ public class MachoConstructorDestructorAnalyzer extends AbstractAnalyzer {
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
break; break;
} }
catch (DataTypeConflictException e) {
break;
}
} }
} }

View file

@ -73,10 +73,6 @@ public class TestAnalyzer extends AbstractAnalyzer {
log.appendException(e); log.appendException(e);
return false; return false;
} }
catch (DataTypeConflictException e) {
log.appendException(e);
return false;
}
} }
return true; return true;

View file

@ -190,7 +190,7 @@ public abstract class AbstractCreateDataBackgroundCmd<T extends AbstractCreateDa
setStatusMsg(getName() + " completed successfully!"); setStatusMsg(getName() + " completed successfully!");
return success; return success;
} }
catch (AddressOutOfBoundsException | CodeUnitInsertionException | DataTypeConflictException catch (AddressOutOfBoundsException | CodeUnitInsertionException
| InvalidDataTypeException e) { | InvalidDataTypeException e) {
handleErrorMessage(program, name, address, address, e); handleErrorMessage(program, name, address, address, e);
return false; return false;

View file

@ -180,7 +180,7 @@ public class DataSymbolApplier extends MsSymbolApplier {
applicator.getProgram().getListing().createData(address, dataType); applicator.getProgram().getListing().createData(address, dataType);
} }
} }
catch (CodeUnitInsertionException | DataTypeConflictException e) { catch (CodeUnitInsertionException e) {
applicator.appendLogMsg("Unable to create " + dataType.getDisplayName() + " at 0x" + applicator.appendLogMsg("Unable to create " + dataType.getDisplayName() + " at 0x" +
address + ": " + e.getMessage()); address + ": " + e.getMessage());
} }
@ -191,7 +191,7 @@ public class DataSymbolApplier extends MsSymbolApplier {
address.add(dataTypeLength - 1), false); address.add(dataTypeLength - 1), false);
applicator.getProgram().getListing().createData(address, dataType, dataTypeLength); applicator.getProgram().getListing().createData(address, dataType, dataTypeLength);
} }
catch (CodeUnitInsertionException | DataTypeConflictException e) { catch (CodeUnitInsertionException e) {
applicator.appendLogMsg("Unable to replace " + dataType.getDisplayName() + applicator.appendLogMsg("Unable to replace " + dataType.getDisplayName() +
" at 0x" + address + ": " + e.getMessage()); " at 0x" + address + ": " + e.getMessage());
} }

View file

@ -207,8 +207,7 @@ public class DataTypeMarkupType extends VTMarkupType {
private boolean setDataType(Program program, Address startAddress, DataType dataType, private boolean setDataType(Program program, Address startAddress, DataType dataType,
int dataLength, VTMatchApplyChoices.ReplaceDataChoices replaceChoice) int dataLength, VTMatchApplyChoices.ReplaceDataChoices replaceChoice)
throws CodeUnitInsertionException, DataTypeConflictException, throws CodeUnitInsertionException, VersionTrackingApplyException {
VersionTrackingApplyException {
Listing listing = program.getListing(); Listing listing = program.getListing();
// For now this will only clear the code unit at the address. // For now this will only clear the code unit at the address.
@ -273,10 +272,6 @@ public class DataTypeMarkupType extends VTMarkupType {
tryToRestoreOriginalData(listing, startAddress, originalDataType, originalDataLength); tryToRestoreOriginalData(listing, startAddress, originalDataType, originalDataLength);
throw e; throw e;
} }
catch (DataTypeConflictException e) {
tryToRestoreOriginalData(listing, startAddress, originalDataType, originalDataLength);
throw e;
}
return true; return true;
} }
@ -293,13 +288,6 @@ public class DataTypeMarkupType extends VTMarkupType {
" after failing to set data type markup at " + address.toString() + ".\n" + " after failing to set data type markup at " + address.toString() + ".\n" +
e2.getMessage()); e2.getMessage());
} }
catch (DataTypeConflictException e2) {
// If we get an error trying to put the original back then dump a message and bail out.
Msg.error(this,
"Couldn't restore data type of " + originalDataType.getName() +
" after failing to set data type markup at " + address.toString() + ".\n" +
e2.getMessage());
}
} }
@Override @Override
@ -349,11 +337,6 @@ public class DataTypeMarkupType extends VTMarkupType {
sourceDataLength, replaceChoice); sourceDataLength, replaceChoice);
} }
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
throw new VersionTrackingApplyException(getApplyFailedMessage(sourceAddress,
destinationAddress, e, sourceDataLength, destinationData.getLength()), e);
}
catch (DataTypeConflictException e) {
throw new VersionTrackingApplyException(getApplyFailedMessage(sourceAddress, throw new VersionTrackingApplyException(getApplyFailedMessage(sourceAddress,
destinationAddress, e, sourceDataLength, destinationData.getLength()), e); destinationAddress, e, sourceDataLength, destinationData.getLength()), e);
} }
@ -408,10 +391,6 @@ public class DataTypeMarkupType extends VTMarkupType {
throw new VersionTrackingApplyException("Couldn't unapply data type markup @ " + throw new VersionTrackingApplyException("Couldn't unapply data type markup @ " +
destinationAddress.toString() + "." + e.getMessage() + ".", e); destinationAddress.toString() + "." + e.getMessage() + ".", e);
} }
catch (DataTypeConflictException e) {
throw new VersionTrackingApplyException("Couldn't unapply data type markup @ " +
destinationAddress.toString() + "." + e.getMessage() + ".", e);
}
} }
@Override @Override

View file

@ -15,9 +15,8 @@
*/ */
package ghidra.feature.vt.api; package ghidra.feature.vt.api;
import static ghidra.feature.vt.db.VTTestUtils.addr; import static ghidra.feature.vt.db.VTTestUtils.*;
import static ghidra.feature.vt.db.VTTestUtils.createMatchSetWithOneDataMatch; import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import java.util.*; import java.util.*;
@ -157,7 +156,7 @@ public class VTMatchAcceptTest extends AbstractGhidraHeadedIntegrationTest {
} }
private Data setData(DataType dataType, int dtLength, Address address, Program program) private Data setData(DataType dataType, int dtLength, Address address, Program program)
throws CodeUnitInsertionException, DataTypeConflictException { throws CodeUnitInsertionException {
Listing listing = program.getListing(); Listing listing = program.getListing();
Data data = null; Data data = null;

View file

@ -1847,7 +1847,7 @@ public class VTMatchApplyTest extends AbstractGhidraHeadedIntegrationTest {
} }
private Data setData(DataType dataType, int dtLength, Address address, Program program) private Data setData(DataType dataType, int dtLength, Address address, Program program)
throws CodeUnitInsertionException, DataTypeConflictException { throws CodeUnitInsertionException {
Listing listing = program.getListing(); Listing listing = program.getListing();
Data data = null; Data data = null;

View file

@ -279,13 +279,13 @@ class ListingDB implements Listing {
@Override @Override
public Data createData(Address addr, DataType dataType) public Data createData(Address addr, DataType dataType)
throws CodeUnitInsertionException, DataTypeConflictException { throws CodeUnitInsertionException {
return codeMgr.createCodeUnit(addr, dataType, dataType.getLength()); return codeMgr.createCodeUnit(addr, dataType, dataType.getLength());
} }
@Override @Override
public Data createData(Address addr, DataType dataType, int length) public Data createData(Address addr, DataType dataType, int length)
throws CodeUnitInsertionException, DataTypeConflictException { throws CodeUnitInsertionException {
return codeMgr.createCodeUnit(addr, dataType, length); return codeMgr.createCodeUnit(addr, dataType, length);
} }

View file

@ -1,72 +0,0 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.program.model.data;
/**
* Exception thrown when an attempt is made to add a data type to a category
* and the category has a data type by that name but the types do not
* match.
*/
public class DataTypeConflictException extends RuntimeException {
DataType datatype1;
DataType datatype2;
/**
* Construct a new DataTypeConflictException with no message
*/
public DataTypeConflictException() {
super();
}
/**
* Construct a new DataTypeConflictException with the given message
*
* @param msg the exception message
*/
public DataTypeConflictException(String msg) {
super(msg);
}
/**
* Construct a new DataTypeConflictException with the given datatypes.
* The message will indicate there is a conflict between the two data types.
*
* @param dt1 the first of the two conflicting data types.
* (The new data type.)
* @param dt2 the second of the two conflicting data types.
* (The existing data type.)
*/
public DataTypeConflictException(DataType dt1, DataType dt2) {
super("Data type \"" + dt1.getPathName() + "\" conflicts\nwith data type \"" +
dt2.getPathName() + "\".\n");
this.datatype1 = dt1;
this.datatype2 = dt2;
}
/**
* Returns the conflicting data types in a Data Type array of size 2.
* The first entry is the first data type in conflict.
* The second entry is the second data type in conflict.
* <P>Note: These values can be null. They are only known if this
* object was created using the constructor that has the conflicting
* data types as parameters.
* @return the two conflicting data types or nulls.
*/
public DataType[] getConflictingDataTypes() {
return new DataType[] { this.datatype1, this.datatype2 };
}
}

View file

@ -635,11 +635,9 @@ public interface Listing {
* @return newly created data unit * @return newly created data unit
* @exception CodeUnitInsertionException thrown if the new Instruction would * @exception CodeUnitInsertionException thrown if the new Instruction would
* overlap and existing Instruction or defined data. * overlap and existing Instruction or defined data.
* @throws DataTypeConflictException if the given datatype conflicts (same
* name, but not equal) with an existing datatype.
*/ */
public Data createData(Address addr, DataType dataType, int length) public Data createData(Address addr, DataType dataType, int length)
throws CodeUnitInsertionException, DataTypeConflictException; throws CodeUnitInsertionException;
/** /**
* Creates a new defined Data object at the given address. This ignores the * Creates a new defined Data object at the given address. This ignores the
@ -651,11 +649,9 @@ public interface Listing {
* @return newly created data unit * @return newly created data unit
* @exception CodeUnitInsertionException thrown if the new Instruction would * @exception CodeUnitInsertionException thrown if the new Instruction would
* overlap and existing Instruction or defined data. * overlap and existing Instruction or defined data.
* @throws DataTypeConflictException if the given datatype conflicts (same
* name, but not equal) with an existing datatype.
*/ */
public Data createData(Address addr, DataType dataType) public Data createData(Address addr, DataType dataType)
throws CodeUnitInsertionException, DataTypeConflictException; throws CodeUnitInsertionException;
/** /**
* Clears any code units in the given range returning everything to "db"s, * Clears any code units in the given range returning everything to "db"s,

View file

@ -299,13 +299,13 @@ public class ListingStub implements Listing {
@Override @Override
public Data createData(Address addr, DataType dataType, int length) public Data createData(Address addr, DataType dataType, int length)
throws CodeUnitInsertionException, DataTypeConflictException { throws CodeUnitInsertionException {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override @Override
public Data createData(Address addr, DataType dataType) public Data createData(Address addr, DataType dataType)
throws CodeUnitInsertionException, DataTypeConflictException { throws CodeUnitInsertionException {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

View file

@ -636,9 +636,6 @@ public class ArmAnalyzer extends ConstantPropagationAnalyzer {
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
data = program.getListing().getDefinedDataAt(address); data = program.getListing().getDefinedDataAt(address);
} }
catch (DataTypeConflictException e) {
// ignore data type conflict
}
int addrByteSize = dt.getLength(); int addrByteSize = dt.getLength();
//data = program.getListing().getDefinedDataAt(address); //data = program.getListing().getDefinedDataAt(address);
if (data != null) { if (data != null) {

View file

@ -626,9 +626,6 @@ public class PowerPCAddressAnalyzer extends ConstantPropagationAnalyzer {
catch (CodeUnitInsertionException e) { catch (CodeUnitInsertionException e) {
// ignore // ignore
} }
catch (DataTypeConflictException e) {
// ignore
}
} }
} }
} }