Package ghidra.trace.database.listing
Class DBTraceInstructionsView
java.lang.Object
ghidra.trace.database.listing.AbstractBaseDBTraceCodeUnitsView<DBTraceInstruction>
ghidra.trace.database.listing.AbstractSingleDBTraceCodeUnitsView<DBTraceInstruction>
ghidra.trace.database.listing.AbstractBaseDBTraceDefinedUnitsView<DBTraceInstruction>
ghidra.trace.database.listing.DBTraceInstructionsView
- All Implemented Interfaces:
InternalBaseCodeUnitsView<TraceInstruction>,InternalTraceBaseDefinedUnitsView<TraceInstruction>,TraceBaseCodeUnitsView<TraceInstruction>,TraceBaseDefinedUnitsView<TraceInstruction>,TraceInstructionsView
public class DBTraceInstructionsView
extends AbstractBaseDBTraceDefinedUnitsView<DBTraceInstruction>
implements TraceInstructionsView, InternalTraceBaseDefinedUnitsView<TraceInstruction>
The implementation of
TraceCodeOperations.instructions()-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classA mechanism for adding a block of instructionsNested classes/interfaces inherited from class ghidra.trace.database.listing.AbstractBaseDBTraceDefinedUnitsView
AbstractBaseDBTraceDefinedUnitsView.CacheForGetUnitContainingQueries, AbstractBaseDBTraceDefinedUnitsView.CacheForGetUnitSequenceQueries -
Field Summary
Fields inherited from class ghidra.trace.database.listing.AbstractBaseDBTraceDefinedUnitsView
CACHE_ADDRESS_BREADTH, CACHE_MAX_POINTS, CACHE_MAX_REGIONS, cacheForContaining, cacheForSequence, mapSpaceFields inherited from class ghidra.trace.database.listing.AbstractBaseDBTraceCodeUnitsView
space -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddInstructionSet(Lifespan lifespan, TracePlatform platform, InstructionSet instructionSet, boolean overwrite) Create several instructionsprotected voidcheckInstructionSet(long startSnap, InstructionSet instructionSet, Set<Address> skipDelaySlots) Checks the intended locations for conflicts with existing units.create(Lifespan lifespan, Address address, TracePlatform platform, InstructionPrototype prototype, ProcessorContextView context, int forcedLengthOverride) Create an instructionprotected DBTraceInstructiondoCreate(Lifespan lifespan, Address address, InternalTracePlatform platform, InstructionPrototype prototype, ProcessorContextView context, int length) Create an instructionprotected voiddoSetContext(TraceAddressSnapRange tasr, Language language, ProcessorContextView context) Set the context over the given boxprotected booleanisKnown(DBTraceMemorySpace ms, long snap, CodeUnit cu) protected static <T> TreplaceIfNotNull(T cur, T rep) startAddingBlock(Lifespan lifespan, Set<Address> skipDelaySlots, InternalTracePlatform platform, InstructionBlock block, boolean overwrite) Start adding the given block to the databaseprotected OverlappingObjectIterator<Instruction, CodeUnit> startCheckingBlock(long startSnap, InstructionBlock block) Prepare to check a block for conflictsMethods inherited from class ghidra.trace.database.listing.AbstractBaseDBTraceDefinedUnitsView
clear, clearContext, computeTruncatedMax, containsAddress, coversRange, get, getAddressSetView, getAt, getCeiling, getContaining, getFloor, getIntersecting, intersectsRange, invalidateCache, size, subtractFrom, truncateSoonestDefined, unitRemoved, unitSpanChangedMethods inherited from class ghidra.trace.database.listing.AbstractBaseDBTraceCodeUnitsView
coversRange, get, get, get, get, getAddressSetView, getAddressSpace, getAfter, getBefore, getSpace, getTrace, intersectsRangeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.trace.database.listing.InternalBaseCodeUnitsView
get, getContaining, getForRegister, getSpaceMethods inherited from interface ghidra.trace.database.listing.InternalTraceBaseDefinedUnitsView
clearMethods inherited from interface ghidra.trace.model.listing.TraceBaseCodeUnitsView
containsAddress, coversRange, coversRange, get, get, get, get, get, get, getAddressSetView, getAddressSetView, getAfter, getAt, getBefore, getCeiling, getContaining, getContaining, getFloor, getForRegister, getIntersecting, getTrace, intersectsRange, intersectsRange, sizeMethods inherited from interface ghidra.trace.model.listing.TraceBaseDefinedUnitsView
clear, clearMethods inherited from interface ghidra.trace.model.listing.TraceInstructionsView
addInstructionSet, create
-
Constructor Details
-
DBTraceInstructionsView
Construct the view- Parameters:
space- the space, bound to an address space
-
-
Method Details
-
replaceIfNotNull
protected static <T> T replaceIfNotNull(T cur, T rep) -
doSetContext
protected void doSetContext(TraceAddressSnapRange tasr, Language language, ProcessorContextView context) Set the context over the given boxIf the given context matches the language's default at the mininum address of the box, the context is cleared.
- Parameters:
tasr- the boxlanguage- the language for the instructioncontext- the desired context
-
doCreate
protected DBTraceInstruction doCreate(Lifespan lifespan, Address address, InternalTracePlatform platform, InstructionPrototype prototype, ProcessorContextView context, int length) throws CodeUnitInsertionException, AddressOverflowException Create an instruction- Parameters:
lifespan- the lifespan of the instructionaddress- the minimum address of the instructionplatform- the platform (language, compiler) for the instructionprototype- the instruction's prototypecontext- the initial context for parsing the instructionlength- instruction byte-length (must be in the range 0..prototype.getLength()). If smaller than the prototype length it must have a value no greater than 7, otherwise an error will be thrown. A value of 0 or greater-than-or-equal the prototype length will be ignored and not impose and override length. The length value must be a multiple of theinstruction alignment.- Returns:
- the newly created instruction.
- Throws:
CodeUnitInsertionException- thrown if the new Instruction would overlap and existingCodeUnitor the specifiedlengthis unsupported.IllegalArgumentException- if a negativelengthis specified.AddressOverflowException- if the instruction would fall off the address space
-
create
public DBTraceInstruction create(Lifespan lifespan, Address address, TracePlatform platform, InstructionPrototype prototype, ProcessorContextView context, int forcedLengthOverride) throws CodeUnitInsertionException Description copied from interface:TraceInstructionsViewCreate an instruction- Specified by:
createin interfaceTraceInstructionsView- Parameters:
lifespan- the lifespan for the instruction unitaddress- the starting address of the instructionplatform- the platformprototype- the instruction prototypecontext- the input disassembly context for the instructionforcedLengthOverride- reduced instruction byte-length (1..7) or 0 to use default length- Returns:
- the new instruction
- Throws:
CodeUnitInsertionException- if the instruction cannot be created
-
startCheckingBlock
protected OverlappingObjectIterator<Instruction,CodeUnit> startCheckingBlock(long startSnap, InstructionBlock block) Prepare to check a block for conflicts- Parameters:
startSnap- the minimum snap for each instructionblock- the block of instructions- Returns:
- an iterator for overlapping object pairs
-
startAddingBlock
protected DBTraceInstructionsView.InstructionBlockAdder startAddingBlock(Lifespan lifespan, Set<Address> skipDelaySlots, InternalTracePlatform platform, InstructionBlock block, boolean overwrite) Start adding the given block to the databaseIf this returns non-null, it should be immediately followed by
DBTraceInstructionsView.InstructionBlockAdder.doAddInstructions().- Parameters:
lifespan- the lifespan of each instructionskipDelaySlots- the addresses of delay-slotted instructions to skipplatform- the instructions' platform (language, compiler)block- the block of instructions to addoverwrite- true to overwrite existing defined units- Returns:
- the adder, or null
-
isKnown
-
checkInstructionSet
protected void checkInstructionSet(long startSnap, InstructionSet instructionSet, Set<Address> skipDelaySlots) Checks the intended locations for conflicts with existing units.This also clears locations where delay slots will be replacing non-delay slots.
skipDelaySlotswill be populated with any existing delay slot locations which should not be overwritten- Parameters:
instructionSet- the instruction set to examineskipDelaySlots- an empty mutable set to be populated
-
addInstructionSet
public AddressSetView addInstructionSet(Lifespan lifespan, TracePlatform platform, InstructionSet instructionSet, boolean overwrite) Description copied from interface:TraceInstructionsViewCreate several instructionsNOTE: This does not throw
CodeUnitInsertionException. Conflicts are instead recorded in theinstructionSet.- Specified by:
addInstructionSetin interfaceTraceInstructionsView- Parameters:
lifespan- the lifespan for all instruction unitsplatform- the optional guest platform, null for the hostinstructionSet- the set of instructions to addoverwrite- true to replace conflicting instructions- Returns:
- the (host) address set of instructions actually added
-