mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-02-16 15:40:14 +00:00
GP-1797 removed unused DataTypeConflictException
This commit is contained in:
parent
0acb497263
commit
01067debde
@ -62,7 +62,8 @@ import ghidra.framework.plugintool.AutoService;
|
||||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
||||
import ghidra.framework.plugintool.annotation.AutoServiceConsumed;
|
||||
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.util.CodeUnitInsertionException;
|
||||
import ghidra.trace.model.*;
|
||||
@ -840,7 +841,7 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter
|
||||
}
|
||||
tid.commit();
|
||||
}
|
||||
catch (CodeUnitInsertionException | DataTypeConflictException | CancelledException e) {
|
||||
catch (CodeUnitInsertionException | CancelledException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,6 @@ import ghidra.framework.plugintool.annotation.AutoServiceConsumed;
|
||||
import ghidra.pcode.exec.trace.TraceSleighUtils;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.data.DataType;
|
||||
import ghidra.program.model.data.DataTypeConflictException;
|
||||
import ghidra.program.model.lang.Register;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.util.CodeUnitInsertionException;
|
||||
@ -528,7 +527,7 @@ public class DebuggerWatchesProvider extends ComponentProviderAdapter {
|
||||
listing.clearCodeUnits(row.getAddress(), row.getRange().getMaxAddress(), false);
|
||||
listing.createData(address, dataType, size);
|
||||
}
|
||||
catch (CodeUnitInsertionException | DataTypeConflictException e) {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
errs.add(address + " " + dataType + "(" + size + "): " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ import ghidra.app.plugin.core.symtable.SymbolTablePlugin;
|
||||
import ghidra.app.plugin.debug.MemoryUsagePlugin;
|
||||
import ghidra.framework.plugintool.util.PluginException;
|
||||
import ghidra.program.model.address.AddressOverflowException;
|
||||
import ghidra.program.model.data.DataTypeConflictException;
|
||||
import ghidra.program.model.data.Undefined4DataType;
|
||||
import ghidra.program.model.lang.Language;
|
||||
import ghidra.program.model.util.CodeUnitInsertionException;
|
||||
@ -78,7 +77,7 @@ public class DebuggerManualTest extends AbstractGhidraHeadedDebuggerGUITest {
|
||||
@Test
|
||||
@Ignore
|
||||
public void testManual01() throws PluginException, CodeUnitInsertionException,
|
||||
DataTypeConflictException, AddressOverflowException, DuplicateNameException,
|
||||
AddressOverflowException, DuplicateNameException,
|
||||
TraceOverlappedRegionException, InterruptedException {
|
||||
addPlugin(tool, DebuggerBreakpointMarkerPlugin.class);
|
||||
|
||||
|
@ -23,7 +23,6 @@ import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.data.AlignmentDataType;
|
||||
import ghidra.program.model.data.DataTypeConflictException;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.mem.Memory;
|
||||
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);
|
||||
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
|
||||
|
@ -18,7 +18,8 @@ package ghidra.app.cmd.data;
|
||||
import ghidra.framework.cmd.BackgroundCommand;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
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.util.CodeUnitInsertionException;
|
||||
import ghidra.util.Swing;
|
||||
@ -126,8 +127,7 @@ public class CreateDataBackgroundCmd extends BackgroundCommand {
|
||||
}
|
||||
|
||||
private void createData(Address start, Address end, DataType dataType, Program p,
|
||||
TaskMonitor monitor)
|
||||
throws AddressOverflowException, CodeUnitInsertionException, DataTypeConflictException {
|
||||
TaskMonitor monitor) throws AddressOverflowException, CodeUnitInsertionException {
|
||||
|
||||
Listing listing = p.getListing();
|
||||
listing.clearCodeUnits(start, end, false);
|
||||
|
@ -459,9 +459,6 @@ public class ConstantPropagationAnalyzer extends AbstractAnalyzer {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
// don't care; we tried
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
// don't care; we tried
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,7 +20,8 @@ import ghidra.app.util.bin.format.pef.PefDebug;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.app.util.opinion.PefLoader;
|
||||
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.listing.*;
|
||||
import ghidra.program.model.mem.Memory;
|
||||
@ -69,8 +70,8 @@ public class PefDebugAnalyzer extends AbstractAnalyzer {
|
||||
}
|
||||
|
||||
private void applyStructure(Program program, Address address) throws MemoryAccessException,
|
||||
AddressOutOfBoundsException, CodeUnitInsertionException, DataTypeConflictException,
|
||||
DuplicateNameException, InvalidInputException, CircularDependencyException {
|
||||
AddressOutOfBoundsException, CodeUnitInsertionException, DuplicateNameException,
|
||||
InvalidInputException, CircularDependencyException {
|
||||
|
||||
Listing listing = program.getListing();
|
||||
Memory memory = program.getMemory();
|
||||
|
@ -29,7 +29,8 @@ import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import ghidra.framework.plugintool.Plugin;
|
||||
import ghidra.program.database.util.ProgramTransaction;
|
||||
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.mem.MemoryAccessException;
|
||||
import ghidra.program.model.util.CodeUnitInsertionException;
|
||||
@ -146,7 +147,7 @@ public class PatchDataAction extends AbstractPatchAction {
|
||||
catch (MemoryAccessException 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
|
||||
}
|
||||
}
|
||||
|
@ -527,12 +527,10 @@ public abstract class CompEditorModel extends CompositeEditorModel {
|
||||
*
|
||||
* @throws InvalidDataTypeException if the structure being edited is part
|
||||
* 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
|
||||
public DataTypeComponent insert(int rowIndex, DataType datatype, int length)
|
||||
throws UsrException {
|
||||
throws InvalidDataTypeException, UsrException {
|
||||
|
||||
if (isEditingField()) {
|
||||
endFieldEditing();
|
||||
@ -999,8 +997,7 @@ public abstract class CompEditorModel extends CompositeEditorModel {
|
||||
public abstract void clearComponents(int[] rows) throws UsrException;
|
||||
|
||||
@Override
|
||||
protected void createArray(int numElements)
|
||||
throws InvalidDataTypeException, DataTypeConflictException, UsrException {
|
||||
protected void createArray(int numElements) throws InvalidDataTypeException, UsrException {
|
||||
if (selection.getNumRanges() != 1) {
|
||||
throw new UsrException("Can only create arrays on a contiguous selection.");
|
||||
}
|
||||
|
@ -509,8 +509,7 @@ public abstract class CompositeEditorModel extends CompositeViewerModel implemen
|
||||
}
|
||||
}
|
||||
|
||||
protected void createArray(int numElements)
|
||||
throws InvalidDataTypeException, DataTypeConflictException, UsrException {
|
||||
protected void createArray(int numElements) throws InvalidDataTypeException, UsrException {
|
||||
if (selection.getNumRanges() != 1) {
|
||||
throw new UsrException("Can only create arrays on a contiguous selection.");
|
||||
}
|
||||
|
@ -1091,7 +1091,7 @@ class StructureEditorModel extends CompEditorModel {
|
||||
}
|
||||
|
||||
public void createInternalStructure(TaskMonitor monitor)
|
||||
throws InvalidDataTypeException, DataTypeConflictException, UsrException {
|
||||
throws InvalidDataTypeException, UsrException {
|
||||
|
||||
if (selection.getNumRanges() != 1) {
|
||||
throw new UsrException("Can only create structure on a contiguous selection.");
|
||||
|
@ -187,8 +187,7 @@ class UnionEditorModel extends CompEditorModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createArray(int numElements)
|
||||
throws InvalidDataTypeException, DataTypeConflictException, UsrException {
|
||||
protected void createArray(int numElements) throws InvalidDataTypeException, UsrException {
|
||||
if (getNumSelectedComponentRows() != 1) {
|
||||
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
|
||||
* 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
|
||||
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)) {
|
||||
throw new InvalidDataTypeException(
|
||||
"Inserting undefined bytes is not allowed in a union.");
|
||||
|
@ -351,120 +351,118 @@ public class AddressTable {
|
||||
|
||||
// create table size dw's after the jmp
|
||||
// (could create as an array)
|
||||
try {
|
||||
// create a case label
|
||||
Symbol curSymbol = program.getSymbolTable().getPrimarySymbol(tableAddr);
|
||||
if (curSymbol != null && curSymbol.getName().startsWith("Addr")) {
|
||||
tableNameLabel = new AddLabelCmd(tableAddr, tableName, true, SourceType.ANALYSIS);
|
||||
}
|
||||
else {
|
||||
tableNameLabel = new AddLabelCmd(tableAddr, tableName, true, SourceType.ANALYSIS);
|
||||
}
|
||||
|
||||
Address lastAddress = null;
|
||||
DataType ptrDT = program.getDataTypeManager().addDataType(
|
||||
PointerDataType.getPointer(null, addrSize), null);
|
||||
for (int i = 0; i < tableSize; i++) {
|
||||
Address loc = tableAddr.add(i * addrSize);
|
||||
// create a case label
|
||||
Symbol curSymbol = program.getSymbolTable().getPrimarySymbol(tableAddr);
|
||||
if (curSymbol != null && curSymbol.getName().startsWith("Addr")) {
|
||||
tableNameLabel = new AddLabelCmd(tableAddr, tableName, true, SourceType.ANALYSIS);
|
||||
}
|
||||
else {
|
||||
tableNameLabel = new AddLabelCmd(tableAddr, tableName, true, SourceType.ANALYSIS);
|
||||
}
|
||||
|
||||
Address lastAddress = null;
|
||||
DataType ptrDT = program.getDataTypeManager()
|
||||
.addDataType(
|
||||
PointerDataType.getPointer(null, addrSize), null);
|
||||
for (int i = 0; i < tableSize; i++) {
|
||||
Address loc = tableAddr.add(i * addrSize);
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
program.getListing().createData(loc, ptrDT, addrSize);
|
||||
}
|
||||
catch (CodeUnitInsertionException e) {
|
||||
CodeUnit cu = listing.getCodeUnitAt(loc);
|
||||
if (cu instanceof Instruction) {
|
||||
break;
|
||||
}
|
||||
if (cu == null) {
|
||||
Msg.warn(this, "Couldn't get data at ");
|
||||
cu = listing.getDefinedDataContaining(loc);
|
||||
if (cu == null || cu instanceof Instruction) {
|
||||
break;
|
||||
}
|
||||
cu = ((Data) cu).getPrimitiveAt((int) loc.subtract(cu.getMinAddress()));
|
||||
if (cu == null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!((Data) cu).isPointer()) {
|
||||
listing.clearCodeUnits(loc, loc.add(addrSize - 1), false);
|
||||
program.getListing().createData(loc, ptrDT, addrSize);
|
||||
}
|
||||
}
|
||||
program.getListing().createData(loc, ptrDT, addrSize);
|
||||
}
|
||||
catch (CodeUnitInsertionException e) {
|
||||
}
|
||||
Data data = program.getListing().getDataAt(loc);
|
||||
if (data == null) {
|
||||
continue;
|
||||
}
|
||||
Address target = ((Address) data.getValue());
|
||||
if (target == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// make sure the pointer created is the same as the table target
|
||||
Address tableTarget = tableElements[i];
|
||||
if (tableTarget != null && !target.equals(tableTarget)) {
|
||||
data.removeValueReference(target);
|
||||
data.addValueReference(tableTarget, RefType.DATA);
|
||||
target = tableTarget;
|
||||
}
|
||||
|
||||
// Don't allow the targets of the switch to vary widely
|
||||
MemoryBlock thisBlock = program.getMemory().getBlock(target);
|
||||
if (lastAddress != null) {
|
||||
try {
|
||||
long diff = lastAddress.subtract(target);
|
||||
if (diff > 1024 * 128) {
|
||||
CodeUnit cu = listing.getCodeUnitAt(loc);
|
||||
if (cu instanceof Instruction) {
|
||||
break;
|
||||
}
|
||||
if (cu == null) {
|
||||
Msg.warn(this, "Couldn't get data at ");
|
||||
cu = listing.getDefinedDataContaining(loc);
|
||||
if (cu == null || cu instanceof Instruction) {
|
||||
break;
|
||||
}
|
||||
cu = ((Data) cu).getPrimitiveAt((int) loc.subtract(cu.getMinAddress()));
|
||||
if (cu == null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
break;
|
||||
if (!((Data) cu).isPointer()) {
|
||||
listing.clearCodeUnits(loc, loc.add(addrSize - 1), false);
|
||||
program.getListing().createData(loc, ptrDT, addrSize);
|
||||
}
|
||||
MemoryBlock lastBlock = program.getMemory().getBlock(lastAddress);
|
||||
}
|
||||
}
|
||||
catch (CodeUnitInsertionException e) {
|
||||
// couldn't create
|
||||
}
|
||||
Data data = program.getListing().getDataAt(loc);
|
||||
if (data == null) {
|
||||
continue;
|
||||
}
|
||||
Address target = ((Address) data.getValue());
|
||||
if (target == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lastBlock == null || !lastBlock.equals(thisBlock)) {
|
||||
// make sure the pointer created is the same as the table target
|
||||
Address tableTarget = tableElements[i];
|
||||
if (tableTarget != null && !target.equals(tableTarget)) {
|
||||
data.removeValueReference(target);
|
||||
data.addValueReference(tableTarget, RefType.DATA);
|
||||
target = tableTarget;
|
||||
}
|
||||
|
||||
// Don't allow the targets of the switch to vary widely
|
||||
MemoryBlock thisBlock = program.getMemory().getBlock(target);
|
||||
if (lastAddress != null) {
|
||||
try {
|
||||
long diff = lastAddress.subtract(target);
|
||||
if (diff > 1024 * 128) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
lastAddress = target;
|
||||
|
||||
// check that the block we are in and the block targetted is executable
|
||||
if (instrBlockExecutable && thisBlock != null && !thisBlock.isExecute()) {
|
||||
catch (IllegalArgumentException e) {
|
||||
break;
|
||||
}
|
||||
// disassemble the case
|
||||
if (program.getListing().getInstructionAt(target) == null || notInAFunction) {
|
||||
if (!tableInProgress) {
|
||||
newCodeFound = true;
|
||||
}
|
||||
MemoryBlock lastBlock = program.getMemory().getBlock(lastAddress);
|
||||
|
||||
if (lastBlock == null || !lastBlock.equals(thisBlock)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
lastAddress = target;
|
||||
|
||||
if (!flagNewCode || !newCodeFound) {
|
||||
// create a case label
|
||||
if (!ftype.isCall()) {
|
||||
AddLabelCmd lcmd = new AddLabelCmd(target,
|
||||
caseName + Integer.toHexString(i), true, SourceType.ANALYSIS);
|
||||
switchLabelList.add(lcmd);
|
||||
}
|
||||
|
||||
// add a reference to the case
|
||||
start_inst.addMnemonicReference(target, ftype, SourceType.ANALYSIS);
|
||||
//program.getReferenceManager().addMemReference(start_inst.getMinAddress(), target, ftype, false, CodeUnit.MNEMONIC);
|
||||
// check that the block we are in and the block targetted is executable
|
||||
if (instrBlockExecutable && thisBlock != null && !thisBlock.isExecute()) {
|
||||
break;
|
||||
}
|
||||
// disassemble the case
|
||||
if (program.getListing().getInstructionAt(target) == null || notInAFunction) {
|
||||
if (!tableInProgress) {
|
||||
newCodeFound = true;
|
||||
}
|
||||
|
||||
disassembleTarget(program, target, monitor);
|
||||
}
|
||||
|
||||
// if we are in a function, fix up it's body
|
||||
if (!ftype.isCall()) {
|
||||
fixupFunctionBody(program, start_inst, monitor);
|
||||
if (!flagNewCode || !newCodeFound) {
|
||||
// create a case label
|
||||
if (!ftype.isCall()) {
|
||||
AddLabelCmd lcmd = new AddLabelCmd(target,
|
||||
caseName + Integer.toHexString(i), true, SourceType.ANALYSIS);
|
||||
switchLabelList.add(lcmd);
|
||||
}
|
||||
|
||||
// add a reference to the case
|
||||
start_inst.addMnemonicReference(target, ftype, SourceType.ANALYSIS);
|
||||
//program.getReferenceManager().addMemReference(start_inst.getMinAddress(), target, ftype, false, CodeUnit.MNEMONIC);
|
||||
}
|
||||
|
||||
disassembleTarget(program, target, monitor);
|
||||
}
|
||||
catch (DataTypeConflictException e1) {
|
||||
return false;
|
||||
|
||||
// if we are in a function, fix up it's body
|
||||
if (!ftype.isCall()) {
|
||||
fixupFunctionBody(program, start_inst, monitor);
|
||||
}
|
||||
|
||||
// create the index array if this table has one
|
||||
|
@ -30,7 +30,6 @@ import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.program.disassemble.Disassembler;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.data.DataTypeConflictException;
|
||||
import ghidra.program.model.data.PointerDataType;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.symbol.*;
|
||||
@ -362,9 +361,6 @@ public class EntryPointAnalyzer extends AbstractAnalyzer {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
// couldn't create
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
// couldn't create
|
||||
}
|
||||
}
|
||||
|
||||
private int addExternalSymbolsToSet(Program program, AddressSetView addressSet,
|
||||
|
@ -26,7 +26,8 @@ import ghidra.docking.settings.Settings;
|
||||
import ghidra.framework.cmd.BackgroundCommand;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
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.scalar.Scalar;
|
||||
import ghidra.program.model.symbol.Equate;
|
||||
@ -89,8 +90,7 @@ public class ConvertCommand extends BackgroundCommand {
|
||||
return msg == null;
|
||||
}
|
||||
|
||||
private boolean applyDataSettings(Data data)
|
||||
throws CodeUnitInsertionException, DataTypeConflictException {
|
||||
private boolean applyDataSettings(Data data) throws CodeUnitInsertionException {
|
||||
|
||||
DataType dt = data.getBaseDataType();
|
||||
Settings settings = data;
|
||||
@ -130,7 +130,7 @@ public class ConvertCommand extends BackgroundCommand {
|
||||
}
|
||||
|
||||
private void createData(Data data, DataType unsignedDataType)
|
||||
throws CodeUnitInsertionException, DataTypeConflictException {
|
||||
throws CodeUnitInsertionException {
|
||||
Listing listing = data.getProgram().getListing();
|
||||
Address addr = data.getAddress();
|
||||
listing.clearCodeUnits(addr, data.getMaxAddress(), false);
|
||||
|
@ -85,7 +85,8 @@ public abstract class GccAnalysisClass {
|
||||
// try creating without clearing, the code units should be clear
|
||||
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);
|
||||
dataCmd.applyTo(program);
|
||||
}
|
||||
|
@ -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.DWARFTag.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.cmd.comments.AppendCommentCmd;
|
||||
import ghidra.app.cmd.label.SetLabelPrimaryCmd;
|
||||
import ghidra.app.util.bin.format.dwarf4.*;
|
||||
@ -976,7 +975,7 @@ public class DWARFFunctionImporter {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch (CodeUnitInsertionException | DataTypeConflictException e) {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
Msg.error(this, "Error creating data object at " + address, e);
|
||||
}
|
||||
return null;
|
||||
|
@ -22,8 +22,9 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import ghidra.app.util.bin.format.elf.*;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
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.PointerTypedef;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.mem.MemoryAccessException;
|
||||
import ghidra.program.model.util.CodeUnitInsertionException;
|
||||
@ -90,7 +91,7 @@ abstract public class ElfRelocationHandler implements ExtensionPoint {
|
||||
DataUtilities.createData(program, addr, dt, -1, false,
|
||||
ClearDataMode.CLEAR_ALL_UNDEFINED_CONFLICT_DATA);
|
||||
}
|
||||
catch (CodeUnitInsertionException | DataTypeConflictException e) {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
Msg.error(ElfRelocationHandler.class,
|
||||
"Failed to apply component-offset pointer at " + addr);
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ public final class ObjectiveC1_Utilities {
|
||||
* Applies the data type at the specified address.
|
||||
*/
|
||||
public static void applyData(Program program, DataType dt, Address address)
|
||||
throws CodeUnitInsertionException, DataTypeConflictException {
|
||||
throws CodeUnitInsertionException {
|
||||
Data data = program.getListing().getDefinedDataAt(address);
|
||||
if (data != null && data.getDataType().isEquivalent(dt)) {
|
||||
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.
|
||||
*/
|
||||
public static Address createPointerAndReturnAddressBeingReferenced(Program program,
|
||||
Address address) throws CodeUnitInsertionException, DataTypeConflictException {
|
||||
Address address) throws CodeUnitInsertionException {
|
||||
program.getListing().createData(address, new PointerDataType());
|
||||
Data data = program.getListing().getDefinedDataAt(address);
|
||||
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.
|
||||
* If it does not exist, then create it and return it.
|
||||
|
@ -65,7 +65,7 @@ public class DebugDataDirectory extends DataDirectory {
|
||||
@Override
|
||||
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
|
||||
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
|
||||
DataTypeConflictException, IOException {
|
||||
IOException {
|
||||
|
||||
monitor.setMessage(program.getName()+": debug...");
|
||||
Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress);
|
||||
|
@ -87,7 +87,7 @@ public class DelayImportDataDirectory extends DataDirectory {
|
||||
@Override
|
||||
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
|
||||
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
|
||||
DataTypeConflictException, IOException {
|
||||
IOException {
|
||||
|
||||
monitor.setMessage(program.getName()+": delay import(s)...");
|
||||
Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress);
|
||||
@ -187,7 +187,7 @@ public class DelayImportDataDirectory extends DataDirectory {
|
||||
DelayImportDescriptor descriptor,
|
||||
TaskMonitor monitor,
|
||||
MessageLog log)
|
||||
throws DataTypeConflictException, DuplicateNameException {
|
||||
throws DuplicateNameException {
|
||||
|
||||
Map<ThunkData, ImportByName> map = descriptor.getImportByNameMap();
|
||||
Iterator<ThunkData> thunks = map.keySet().iterator();
|
||||
|
@ -50,7 +50,7 @@ public class ExceptionDataDirectory extends DataDirectory {
|
||||
@Override
|
||||
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
|
||||
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
|
||||
DataTypeConflictException, IOException {
|
||||
IOException {
|
||||
monitor.setMessage(program.getName()+": exceptions...");
|
||||
Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress);
|
||||
if (!program.getMemory().contains(addr)) {
|
||||
|
@ -146,7 +146,7 @@ public class ExportDataDirectory extends DataDirectory {
|
||||
@Override
|
||||
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
|
||||
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
|
||||
DataTypeConflictException, IOException {
|
||||
IOException {
|
||||
monitor.setMessage("[" + program.getName() + "]: exports...");
|
||||
|
||||
Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress);
|
||||
|
@ -42,7 +42,7 @@ public class GlobalPointerDataDirectory extends DataDirectory {
|
||||
@Override
|
||||
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
|
||||
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
|
||||
DataTypeConflictException, IOException {
|
||||
IOException {
|
||||
monitor.setMessage(program.getName()+": global pointers...");
|
||||
Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress);
|
||||
if (!program.getMemory().contains(addr)) {
|
||||
|
@ -77,7 +77,7 @@ public class ImportDataDirectory extends DataDirectory {
|
||||
@Override
|
||||
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
|
||||
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
|
||||
DataTypeConflictException, IOException, MemoryAccessException {
|
||||
IOException, MemoryAccessException {
|
||||
|
||||
if (imports == null || descriptors == null) {
|
||||
return;
|
||||
|
@ -51,7 +51,7 @@ public class LoadConfigDataDirectory extends DataDirectory {
|
||||
@Override
|
||||
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
|
||||
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
|
||||
DataTypeConflictException, IOException {
|
||||
IOException {
|
||||
|
||||
monitor.setMessage(program.getName()+": load config directory...");
|
||||
Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress);
|
||||
|
@ -178,7 +178,7 @@ public class ResourceDataDirectory extends DataDirectory {
|
||||
@Override
|
||||
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
|
||||
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
|
||||
DataTypeConflictException, IOException {
|
||||
IOException {
|
||||
|
||||
if (rootDirectory == null) {
|
||||
return;
|
||||
|
@ -64,7 +64,7 @@ public class SecurityDataDirectory extends DataDirectory implements ByteArrayCon
|
||||
@Override
|
||||
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
|
||||
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
|
||||
DataTypeConflictException, IOException {
|
||||
IOException {
|
||||
|
||||
if (!isBinary) {//certificates are never mapped into running program...
|
||||
return;
|
||||
|
@ -21,7 +21,8 @@ import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.program.model.address.Address;
|
||||
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.mem.DumbMemBufferImpl;
|
||||
import ghidra.program.model.symbol.SourceType;
|
||||
@ -58,7 +59,7 @@ public class TLSDataDirectory extends DataDirectory {
|
||||
@Override
|
||||
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log,
|
||||
NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException,
|
||||
DataTypeConflictException, IOException {
|
||||
IOException {
|
||||
|
||||
monitor.setMessage(program.getName()+": TLS...");
|
||||
Address addr = PeUtils.getMarkupAddress(program, isBinary, ntHeader, virtualAddress);
|
||||
|
@ -456,9 +456,6 @@ public class CliTableMethodDef extends CliAbstractTable {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
// Ignore, something there already
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
// Ignore, something there already
|
||||
}
|
||||
catch (NullPointerException e) {
|
||||
Msg.warn(this, "Error processing function \"" + funcName + "\" (" + methodRowIndex +
|
||||
"): Bad parameters provided");
|
||||
|
@ -173,9 +173,6 @@ public class ThreadEnvironmentBlock {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
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) {
|
||||
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 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 DataTypeConflictException for conflicts with other data-types
|
||||
* @throws CodeUnitInsertionException for problems laying down the structure on the block
|
||||
* @throws InvalidInputException for problems with the symbol name attached to the TEB
|
||||
*/
|
||||
public void createBlockAndStructure() throws MemoryConflictException, LockException,
|
||||
IllegalArgumentException, AddressOverflowException, CodeUnitInsertionException,
|
||||
DataTypeConflictException, InvalidInputException {
|
||||
InvalidInputException {
|
||||
Memory memory = program.getMemory();
|
||||
MemoryBlock block = memory.getBlock(BLOCK_NAME);
|
||||
if (block != null) {
|
||||
|
@ -568,9 +568,6 @@ public class DemangledFunction extends DemangledObject {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
// ignore
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
// ignore - should not happen
|
||||
}
|
||||
}
|
||||
|
||||
private DataType resolveReturnType(Program program, Function function,
|
||||
|
@ -30,7 +30,8 @@ import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
import ghidra.program.database.mem.FileBytes;
|
||||
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.listing.*;
|
||||
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)
|
||||
throws CodeUnitInsertionException, DataTypeConflictException {
|
||||
throws CodeUnitInsertionException {
|
||||
MemoryBlock block = memory.getBlock(addr);
|
||||
if (block == null || !block.isInitialized()) {
|
||||
return null;
|
||||
|
@ -502,9 +502,6 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
// ignore
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
if (cu == null) {
|
||||
cu = listing.getCodeUnitAt(nextAddr);
|
||||
@ -2099,9 +2096,6 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
log("ELF data markup conflict at " + address);
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
throw new AssertException("unexpected", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -2118,9 +2112,6 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
log("ELF data markup conflict while applying " + dt.getName() + " at " + address);
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
log("ELF data type conflict:" + getMessage(e));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -2556,8 +2547,7 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
|
||||
}
|
||||
}
|
||||
|
||||
private int createString(Address address)
|
||||
throws CodeUnitInsertionException, DataTypeConflictException {
|
||||
private int createString(Address address) throws CodeUnitInsertionException {
|
||||
Data d = listing.getDataAt(address);
|
||||
if (d == null || !TerminatedStringDataType.dataType.isEquivalent(d.getDataType())) {
|
||||
d = listing.createData(address, TerminatedStringDataType.dataType, -1);
|
||||
|
@ -24,12 +24,12 @@ import ghidra.app.util.MemoryBlockUtils;
|
||||
import ghidra.app.util.Option;
|
||||
import ghidra.app.util.bin.ByteProvider;
|
||||
import ghidra.app.util.bin.format.ne.*;
|
||||
import ghidra.app.util.bin.format.ne.Resource;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.program.database.function.OverlappingFunctionException;
|
||||
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.listing.*;
|
||||
import ghidra.program.model.mem.*;
|
||||
@ -375,8 +375,7 @@ public class NeLoader extends AbstractLibrarySupportLoader {
|
||||
listing.createData(straddr, new StringDataType(),
|
||||
Conv.byteToInt(string.getLength()));
|
||||
}
|
||||
catch (AddressOverflowException | CodeUnitInsertionException
|
||||
| DataTypeConflictException e) {
|
||||
catch (AddressOverflowException | CodeUnitInsertionException e) {
|
||||
log.appendMsg("Error creating data");
|
||||
log.appendException(e);
|
||||
}
|
||||
|
@ -27,7 +27,8 @@ import ghidra.app.util.bin.format.omf.OmfFixupRecord.Subrecord;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.program.model.address.Address;
|
||||
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.listing.*;
|
||||
import ghidra.program.model.mem.*;
|
||||
@ -552,10 +553,9 @@ public class OmfLoader extends AbstractLibrarySupportLoader {
|
||||
* @param size is the number of bytes in the data
|
||||
* @return the new created Data 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)
|
||||
throws CodeUnitInsertionException, DataTypeConflictException {
|
||||
throws CodeUnitInsertionException {
|
||||
MemoryBlock block = memory.getBlock(addr);
|
||||
if (block == null || !block.isInitialized()) {
|
||||
return null;
|
||||
|
@ -160,9 +160,6 @@ public class PeLoader extends AbstractPeDebugLoader {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
catch (MemoryAccessException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
|
@ -2399,9 +2399,6 @@ public class SymbolicPropogator {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
data = program.getListing().getDefinedDataAt(address);
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
// do nothing
|
||||
}
|
||||
int addrByteSize = dt.getLength();
|
||||
|
||||
return addrByteSize;
|
||||
|
@ -279,9 +279,6 @@ public abstract class PCodeTestAbstractControlBlock {
|
||||
// catch (CodeUnitInsertionException e) {
|
||||
// // ignore
|
||||
// }
|
||||
// catch (DataTypeConflictException e) {
|
||||
// // ignore
|
||||
// }
|
||||
// }
|
||||
|
||||
protected void applyU4Data(Address addr) {
|
||||
@ -291,9 +288,6 @@ public abstract class PCodeTestAbstractControlBlock {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
// ignore
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
protected int getStructureComponent(Structure testInfoStruct, String fieldName) {
|
||||
|
@ -43,7 +43,8 @@ import ghidra.program.database.*;
|
||||
import ghidra.program.disassemble.Disassembler;
|
||||
import ghidra.program.disassemble.DisassemblerMessageListener;
|
||||
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.listing.*;
|
||||
import ghidra.program.model.mem.*;
|
||||
@ -134,8 +135,7 @@ public abstract class AbstractListingMergeManagerTest extends AbstractMergeTest
|
||||
program.getMemory().setBytes(addr, bytes);
|
||||
listing.createData(addr, dt);
|
||||
}
|
||||
catch (CodeUnitInsertionException | DataTypeConflictException
|
||||
| MemoryAccessException e) {
|
||||
catch (CodeUnitInsertionException | MemoryAccessException e) {
|
||||
Assert.fail(e.getMessage());
|
||||
}
|
||||
Data data = listing.getDataAt(addr);
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package ghidra.app.merge.listing;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
@ -892,9 +892,6 @@ public class CodeUnitMergeManager1Test extends AbstractListingMergeManagerTest {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
program.endTransaction(txId, commit);
|
||||
}
|
||||
@ -1016,9 +1013,6 @@ public class CodeUnitMergeManager1Test extends AbstractListingMergeManagerTest {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
program.endTransaction(txId, commit);
|
||||
}
|
||||
@ -1134,9 +1128,6 @@ public class CodeUnitMergeManager1Test extends AbstractListingMergeManagerTest {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
program.endTransaction(txId, commit);
|
||||
}
|
||||
@ -1276,9 +1267,6 @@ public class CodeUnitMergeManager1Test extends AbstractListingMergeManagerTest {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
program.endTransaction(txId, commit);
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ public class CodeBrowserTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
}
|
||||
|
||||
@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
|
||||
cb.getListingPanel().setView(new AddressSet(addr("0100101c"), addr("0100101e")));
|
||||
|
||||
|
@ -118,10 +118,6 @@ public class CFStringAnalyzer extends AbstractAnalyzer {
|
||||
log.appendException(e);
|
||||
return false;
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
log.appendException(e);
|
||||
return false;
|
||||
}
|
||||
catch (InvalidInputException e) {
|
||||
log.appendException(e);
|
||||
// return false;
|
||||
|
@ -15,12 +15,14 @@
|
||||
*/
|
||||
package ghidra.macosx.analyzers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ghidra.app.services.*;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.app.util.opinion.MachoLoader;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.address.AddressSetView;
|
||||
import ghidra.program.model.data.DataTypeConflictException;
|
||||
import ghidra.program.model.data.PointerDataType;
|
||||
import ghidra.program.model.listing.Data;
|
||||
import ghidra.program.model.listing.Program;
|
||||
@ -29,9 +31,6 @@ import ghidra.program.model.util.CodeUnitInsertionException;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MachoConstructorDestructorAnalyzer extends AbstractAnalyzer {
|
||||
private static final String NAME = "Mach-O Constructor/Destructor";
|
||||
private static final String DESCRIPTION =
|
||||
@ -67,9 +66,6 @@ public class MachoConstructorDestructorAnalyzer extends AbstractAnalyzer {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
break;
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,10 +73,6 @@ public class TestAnalyzer extends AbstractAnalyzer {
|
||||
log.appendException(e);
|
||||
return false;
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
log.appendException(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -190,7 +190,7 @@ public abstract class AbstractCreateDataBackgroundCmd<T extends AbstractCreateDa
|
||||
setStatusMsg(getName() + " completed successfully!");
|
||||
return success;
|
||||
}
|
||||
catch (AddressOutOfBoundsException | CodeUnitInsertionException | DataTypeConflictException
|
||||
catch (AddressOutOfBoundsException | CodeUnitInsertionException
|
||||
| InvalidDataTypeException e) {
|
||||
handleErrorMessage(program, name, address, address, e);
|
||||
return false;
|
||||
|
@ -180,7 +180,7 @@ public class DataSymbolApplier extends MsSymbolApplier {
|
||||
applicator.getProgram().getListing().createData(address, dataType);
|
||||
}
|
||||
}
|
||||
catch (CodeUnitInsertionException | DataTypeConflictException e) {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
applicator.appendLogMsg("Unable to create " + dataType.getDisplayName() + " at 0x" +
|
||||
address + ": " + e.getMessage());
|
||||
}
|
||||
@ -191,7 +191,7 @@ public class DataSymbolApplier extends MsSymbolApplier {
|
||||
address.add(dataTypeLength - 1), false);
|
||||
applicator.getProgram().getListing().createData(address, dataType, dataTypeLength);
|
||||
}
|
||||
catch (CodeUnitInsertionException | DataTypeConflictException e) {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
applicator.appendLogMsg("Unable to replace " + dataType.getDisplayName() +
|
||||
" at 0x" + address + ": " + e.getMessage());
|
||||
}
|
||||
|
@ -207,8 +207,7 @@ public class DataTypeMarkupType extends VTMarkupType {
|
||||
|
||||
private boolean setDataType(Program program, Address startAddress, DataType dataType,
|
||||
int dataLength, VTMatchApplyChoices.ReplaceDataChoices replaceChoice)
|
||||
throws CodeUnitInsertionException, DataTypeConflictException,
|
||||
VersionTrackingApplyException {
|
||||
throws CodeUnitInsertionException, VersionTrackingApplyException {
|
||||
|
||||
Listing listing = program.getListing();
|
||||
// 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);
|
||||
throw e;
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
tryToRestoreOriginalData(listing, startAddress, originalDataType, originalDataLength);
|
||||
throw e;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -293,13 +288,6 @@ public class DataTypeMarkupType extends VTMarkupType {
|
||||
" after failing to set data type markup at " + address.toString() + ".\n" +
|
||||
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
|
||||
@ -349,11 +337,6 @@ public class DataTypeMarkupType extends VTMarkupType {
|
||||
sourceDataLength, replaceChoice);
|
||||
}
|
||||
catch (CodeUnitInsertionException e) {
|
||||
|
||||
throw new VersionTrackingApplyException(getApplyFailedMessage(sourceAddress,
|
||||
destinationAddress, e, sourceDataLength, destinationData.getLength()), e);
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
throw new VersionTrackingApplyException(getApplyFailedMessage(sourceAddress,
|
||||
destinationAddress, e, sourceDataLength, destinationData.getLength()), e);
|
||||
}
|
||||
@ -408,10 +391,6 @@ public class DataTypeMarkupType extends VTMarkupType {
|
||||
throw new VersionTrackingApplyException("Couldn't unapply data type markup @ " +
|
||||
destinationAddress.toString() + "." + e.getMessage() + ".", e);
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
throw new VersionTrackingApplyException("Couldn't unapply data type markup @ " +
|
||||
destinationAddress.toString() + "." + e.getMessage() + ".", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,9 +15,8 @@
|
||||
*/
|
||||
package ghidra.feature.vt.api;
|
||||
|
||||
import static ghidra.feature.vt.db.VTTestUtils.addr;
|
||||
import static ghidra.feature.vt.db.VTTestUtils.createMatchSetWithOneDataMatch;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static ghidra.feature.vt.db.VTTestUtils.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -157,7 +156,7 @@ public class VTMatchAcceptTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
}
|
||||
|
||||
private Data setData(DataType dataType, int dtLength, Address address, Program program)
|
||||
throws CodeUnitInsertionException, DataTypeConflictException {
|
||||
throws CodeUnitInsertionException {
|
||||
|
||||
Listing listing = program.getListing();
|
||||
Data data = null;
|
||||
|
@ -1847,7 +1847,7 @@ public class VTMatchApplyTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
}
|
||||
|
||||
private Data setData(DataType dataType, int dtLength, Address address, Program program)
|
||||
throws CodeUnitInsertionException, DataTypeConflictException {
|
||||
throws CodeUnitInsertionException {
|
||||
|
||||
Listing listing = program.getListing();
|
||||
Data data = null;
|
||||
|
@ -279,13 +279,13 @@ class ListingDB implements Listing {
|
||||
|
||||
@Override
|
||||
public Data createData(Address addr, DataType dataType)
|
||||
throws CodeUnitInsertionException, DataTypeConflictException {
|
||||
throws CodeUnitInsertionException {
|
||||
return codeMgr.createCodeUnit(addr, dataType, dataType.getLength());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Data createData(Address addr, DataType dataType, int length)
|
||||
throws CodeUnitInsertionException, DataTypeConflictException {
|
||||
throws CodeUnitInsertionException {
|
||||
return codeMgr.createCodeUnit(addr, dataType, length);
|
||||
}
|
||||
|
||||
|
@ -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 };
|
||||
}
|
||||
}
|
@ -635,11 +635,9 @@ public interface Listing {
|
||||
* @return newly created data unit
|
||||
* @exception CodeUnitInsertionException thrown if the new Instruction would
|
||||
* 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)
|
||||
throws CodeUnitInsertionException, DataTypeConflictException;
|
||||
throws CodeUnitInsertionException;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @exception CodeUnitInsertionException thrown if the new Instruction would
|
||||
* 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)
|
||||
throws CodeUnitInsertionException, DataTypeConflictException;
|
||||
throws CodeUnitInsertionException;
|
||||
|
||||
/**
|
||||
* Clears any code units in the given range returning everything to "db"s,
|
||||
|
@ -299,13 +299,13 @@ public class ListingStub implements Listing {
|
||||
|
||||
@Override
|
||||
public Data createData(Address addr, DataType dataType, int length)
|
||||
throws CodeUnitInsertionException, DataTypeConflictException {
|
||||
throws CodeUnitInsertionException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Data createData(Address addr, DataType dataType)
|
||||
throws CodeUnitInsertionException, DataTypeConflictException {
|
||||
throws CodeUnitInsertionException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -636,9 +636,6 @@ public class ArmAnalyzer extends ConstantPropagationAnalyzer {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
data = program.getListing().getDefinedDataAt(address);
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
// ignore data type conflict
|
||||
}
|
||||
int addrByteSize = dt.getLength();
|
||||
//data = program.getListing().getDefinedDataAt(address);
|
||||
if (data != null) {
|
||||
|
@ -626,9 +626,6 @@ public class PowerPCAddressAnalyzer extends ConstantPropagationAnalyzer {
|
||||
catch (CodeUnitInsertionException e) {
|
||||
// ignore
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user