Class DBTraceGuestPlatform
- All Implemented Interfaces:
ProgramArchitecture,InternalTracePlatform,TraceGuestPlatform,TracePlatform
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DBTraceDataTypeManagerprotected final AddressSetprotected final AddressSetprotected final NavigableMap<Address, DBTraceGuestPlatformMappedRange> protected final NavigableMap<Address, DBTraceGuestPlatformMappedRange> static final StringFields inherited from class ghidra.program.database.DatabaseObject
keyFields inherited from interface ghidra.trace.database.guest.InternalTracePlatform
REG_MAP_BE, REG_MAP_LE -
Constructor Summary
ConstructorsConstructorDescriptionDBTraceGuestPlatform(DBTracePlatformManager manager, DBCachedObjectStore<?> store, DBRecord record) -
Method Summary
Modifier and TypeMethodDescriptionaddMappedRange(Address hostStart, Address guestStart, long length) Add an address mapping from host to guestAdd an address mapping from host register space to guest register spaceprotected Addressvoiddelete(TaskMonitor monitor) Remove the mapped language, including all code units of the languageprotected voiddeleteMappedRange(DBTraceGuestPlatformMappedRange range, TaskMonitor monitor) protected voidfresh(boolean created) Extension point: Called when the object's fields are populated.Get the compiler of the guest platformGet the data type manager for this platform.Get the addresses in the guest which are mapped to somehere in the hostGet the addresses in the host which are mapped to somewhere in the guestintGet the entry's key in the table as an integerGet the language of the guest platformgetMappedMemBuffer(long snap, Address guestAddress) Get a memory buffer, which presents the host bytes in the guest address spacegetTrace()Get the tracebooleanisGuest()Check if this is a guest platformprotected voidloadDataTypeManager(OpenMode openMode, TaskMonitor monitor) mapGuestInstructionAddressesToHost(InstructionSet instructionSet) Copy the given instruction set, but with addresses mapped from the guest space to the host spacemapGuestToHost(Address guestAddress) Translate an address from guest to hostmapGuestToHost(AddressRange guestRange) Translate a range from guest to hostmapGuestToHost(Address guestMin, Address guestMax) Map an address only if the entire range is contained in a single mapped rangemapGuestToHost(AddressSetView guestSet) Translate a set from guest to hostmapHostToGuest(Address hostAddress) Translate an address from host to guestmapHostToGuest(AddressRange hostRange) Translate a range from host to guestmapHostToGuest(AddressSetView hostSet) Translate a set from host to guestMethods inherited from class ghidra.util.database.DBAnnotatedObject
doRefresh, doUpdateAll, doUpdated, doWrite, getObjectKey, getTableName, isDeleted, refresh, refresh, update, update, update, updateMethods inherited from class ghidra.program.database.DatabaseObject
checkDeleted, checkIsValid, checkIsValid, getKey, isDeleted, isInvalid, keyChanged, setDeleted, setInvalid, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.trace.database.guest.InternalTracePlatform
addRegisterMapOverride, getAddressFactory, getConventionalRegisterObjectNames, getConventionalRegisterPath, getConventionalRegisterPath, getConventionalRegisterPath, getConventionalRegisterPath, getConventionalRegisterRange, getRegistersRange, listRegNamesMethods inherited from interface ghidra.program.model.lang.ProgramArchitecture
getLanguageCompilerSpecPairMethods inherited from interface ghidra.trace.model.guest.TracePlatform
isHost
-
Field Details
-
TABLE_NAME
- See Also:
-
rangesByHostAddress
-
hostAddressSet
-
rangesByGuestAddress
-
guestAddressSet
-
dataTypeManager
-
-
Constructor Details
-
DBTraceGuestPlatform
public DBTraceGuestPlatform(DBTracePlatformManager manager, DBCachedObjectStore<?> store, DBRecord record)
-
-
Method Details
-
fresh
Description copied from class:DBAnnotatedObjectExtension point: Called when the object's fields are populated.This provides an opportunity for the object to initialize any non-database-backed fields that depend on the database-backed fields. Note that its use may indicate a situation better solved by a custom
DBCachedObjectStoreFactory.DBFieldCodec. If both the database-backed and non-database-backed fields are used frequently, then a codec may not be indicated. If the database-backed fields are only used in this method or to encode another frequently-used field, then a codec is likely better.For a new object, the database-backed fields remain at their initial values. They will be saved after this method returns, so they may be further initialized with custom logic.
For an object loaded from the database, the database-backed fields are already populated from the record when this method is called. They are not automatically saved after this method returns. This method should not further initialize database-backed fields in this case.
- Overrides:
freshin classDBAnnotatedObject- Parameters:
created-truewhen object is being created, orfalsewhen it is being loaded.- Throws:
IOException- if further initialization fails.
-
loadDataTypeManager
protected void loadDataTypeManager(OpenMode openMode, TaskMonitor monitor) throws CancelledException, VersionException, IOException -
getTrace
Description copied from interface:TracePlatformGet the trace- Specified by:
getTracein interfaceTracePlatform- Returns:
- the trace
-
getIntKey
public int getIntKey()Description copied from interface:InternalTracePlatformGet the entry's key in the table as an integer- Specified by:
getIntKeyin interfaceInternalTracePlatform- Returns:
- the key
-
isGuest
public boolean isGuest()Description copied from interface:TracePlatformCheck if this is a guest platform- Specified by:
isGuestin interfaceTracePlatform- Returns:
- true for guest, false for host
-
deleteMappedRange
protected void deleteMappedRange(DBTraceGuestPlatformMappedRange range, TaskMonitor monitor) throws CancelledException - Throws:
CancelledException
-
getLanguageEntry
- Specified by:
getLanguageEntryin interfaceInternalTracePlatform
-
getLanguage
Description copied from interface:TracePlatformGet the language of the guest platform- Specified by:
getLanguagein interfaceProgramArchitecture- Specified by:
getLanguagein interfaceTracePlatform- Returns:
- the language
-
getCompilerSpec
Description copied from interface:TracePlatformGet the compiler of the guest platform- Specified by:
getCompilerSpecin interfaceProgramArchitecture- Specified by:
getCompilerSpecin interfaceTracePlatform- Returns:
- the compiler specification
-
getDataTypeManager
Description copied from interface:TracePlatformGet the data type manager for this platform.- Specified by:
getDataTypeManagerin interfaceTracePlatform- Returns:
- the data type manager
-
delete
Description copied from interface:TraceGuestPlatformRemove the mapped language, including all code units of the language- Specified by:
deletein interfaceTraceGuestPlatform- Parameters:
monitor- to monitor task progress- Throws:
CancelledException- if the task is cancelled by the monitor
-
addMappedRange
public DBTraceGuestPlatformMappedRange addMappedRange(Address hostStart, Address guestStart, long length) throws AddressOverflowException Description copied from interface:TraceGuestPlatformAdd an address mapping from host to guest- Specified by:
addMappedRangein interfaceTraceGuestPlatform- Parameters:
hostStart- the starting host address (mapped to guestStart)guestStart- the starting guest address (mapped to hostStart)length- the length of the range to map- Returns:
- the mapped range
- Throws:
AddressOverflowException- if length is too long for either start
-
computeNextRegisterMin
-
addMappedRegisterRange
Description copied from interface:TraceGuestPlatformAdd an address mapping from host register space to guest register spaceIn guest space, the mapping is placed at 0 and has length large enough to accommodate all registers in the guest language. In host space, the mapping is placed after every other register mapping for every platform.
- Specified by:
addMappedRegisterRangein interfaceTraceGuestPlatform- Returns:
- the mapped range
- Throws:
AddressOverflowException- if host register space was exhausted
-
getHostAddressSet
Description copied from interface:TracePlatformGet the addresses in the host which are mapped to somewhere in the guest- Specified by:
getHostAddressSetin interfaceTracePlatform- Returns:
- the address set
-
getGuestAddressSet
Description copied from interface:TracePlatformGet the addresses in the guest which are mapped to somehere in the host- Specified by:
getGuestAddressSetin interfaceTracePlatform- Returns:
- the address set
-
mapHostToGuest
Description copied from interface:TracePlatformTranslate an address from host to guest- Specified by:
mapHostToGuestin interfaceTracePlatform- Parameters:
hostAddress- the host address- Returns:
- the guest address
-
mapHostToGuest
Description copied from interface:TracePlatformTranslate a range from host to guestThe entire range must be mapped to a single range.
- Specified by:
mapHostToGuestin interfaceTracePlatform- Parameters:
hostRange- the host range- Returns:
- the guest range
-
mapHostToGuest
Description copied from interface:TracePlatformTranslate a set from host to guestOnly those ranges (or parts of ranges) that mapped are included.
- Specified by:
mapHostToGuestin interfaceTracePlatform- Parameters:
hostSet- the host set- Returns:
- the guest set
-
mapGuestToHost
Description copied from interface:TracePlatformTranslate an address from guest to host- Specified by:
mapGuestToHostin interfaceTracePlatform- Parameters:
guestAddress- the guest address- Returns:
- the host address
-
mapGuestToHost
Description copied from interface:TracePlatformTranslate a range from guest to hostThe entire range must be mapped to a single range.
- Specified by:
mapGuestToHostin interfaceTracePlatform- Parameters:
guestRange- the guest range- Returns:
- the host range
-
mapGuestToHost
Description copied from interface:TracePlatformTranslate a set from guest to hostOnly those ranges (or parts of ranges) that mapped are included.
- Specified by:
mapGuestToHostin interfaceTracePlatform- Parameters:
guestSet- the guest set- Returns:
- the host set
-
mapGuestToHost
Map an address only if the entire range is contained in a single mapped range- Parameters:
guestMin- the min address of the range to mapguestMax- the max address of the range to check- Returns:
- the mapped min address
-
getMappedMemBuffer
Description copied from interface:TracePlatformGet a memory buffer, which presents the host bytes in the guest address spaceThis, with pseudo-disassembly, is the primary mechanism for adding instructions in the guest language.
- Specified by:
getMappedMemBufferin interfaceTracePlatform- Parameters:
snap- the snap, up to which the most recent memory changes are presentedguestAddress- the starting address in the guest space- Returns:
- the mapped memory buffer
-
mapGuestInstructionAddressesToHost
Description copied from interface:TracePlatformCopy the given instruction set, but with addresses mapped from the guest space to the host spaceInstructions which do not map are silently ignored. If concerned, the caller ought to examine the resulting instruction set and/or the resulting address set after it is added to the trace. A single instruction cannot span two mapped ranges, even if the comprised bytes are consecutive in the guest space. Mapping such an instruction back into the host space would cause the instruction to be split in the middle, which is not possible. Thus, such instructions are silently ignored.
- Specified by:
mapGuestInstructionAddressesToHostin interfaceTracePlatform- Parameters:
instructionSet- the instruction set in the guest space- Returns:
- the instruction set in the host space
-