Interface TracePlatform
- All Known Subinterfaces:
InternalTracePlatform,TraceGuestPlatform
- All Known Implementing Classes:
DBTraceGuestPlatform,DBTracePlatformManager.DBTraceHostPlatform
Traces can model systems where multiple processors or languages are involved. Every trace has a "host" platform. There may also be zero or more "guest" platforms. The guest platforms' memories and registers must be mapped into the host platform to be used in the trace. This class provides access to the properties of a platform and a mechanisms for translating addresses between this and the host platform. If this is the host platform, the translation methods are the identity function.
-
Method Summary
Modifier and TypeMethodDescriptionaddRegisterMapOverride(Register register, String objectName) Add a label the conventionally maps the value of aTraceRegisterin the object manager to a register from this platformdefault AddressFactoryGet the address factory of the guest platformGet the compiler of the guest platformgetConventionalRegisterObjectNames(Register register) Get the names or indices of the register object for the given platform registergetConventionalRegisterPath(AddressSpace overlay, Register register) Get the expected path where an object defining the register value would begetConventionalRegisterPath(TraceObjectSchema schema, KeyPath path, Register register) Get the expected path where an object defining the register value would begetConventionalRegisterPath(TraceObjectSchema schema, KeyPath path, Collection<String> names) Get the expected path where an object defining the register value would begetConventionalRegisterPath(TraceObject container, Register register) Get the expected path where an object defining the register value would begetConventionalRegisterRange(AddressSpace overlay, Register register) Translate the given platform register to the given host overlay spaceGet 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 guestGet 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 platformdefault booleanisHost()Check if this is the host platformCopy 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(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 guest
-
Method Details
-
getTrace
Trace getTrace()Get the trace- Returns:
- the trace
-
isGuest
boolean isGuest()Check if this is a guest platform- Returns:
- true for guest, false for host
-
isHost
default boolean isHost()Check if this is the host platform- Returns:
- true for host, false for guest
-
getLanguage
Language getLanguage()Get the language of the guest platform- Returns:
- the language
-
getAddressFactory
Get the address factory of the guest platform- Returns:
- the factory
-
getCompilerSpec
CompilerSpec getCompilerSpec()Get the compiler of the guest platform- Returns:
- the compiler specification
-
getDataTypeManager
TraceBasedDataTypeManager getDataTypeManager()Get the data type manager for this platform.- Returns:
- the data type manager
-
getHostAddressSet
AddressSetView getHostAddressSet()Get the addresses in the host which are mapped to somewhere in the guest- Returns:
- the address set
-
getGuestAddressSet
AddressSetView getGuestAddressSet()Get the addresses in the guest which are mapped to somehere in the host- Returns:
- the address set
-
mapHostToGuest
Translate an address from host to guest- Parameters:
hostAddress- the host address- Returns:
- the guest address
-
mapHostToGuest
Translate a range from host to guestThe entire range must be mapped to a single range.
- Parameters:
hostRange- the host range- Returns:
- the guest range
-
mapHostToGuest
Translate a set from host to guestOnly those ranges (or parts of ranges) that mapped are included.
- Parameters:
hostSet- the host set- Returns:
- the guest set
-
mapGuestToHost
Translate an address from guest to host- Parameters:
guestAddress- the guest address- Returns:
- the host address
-
mapGuestToHost
Translate a range from guest to hostThe entire range must be mapped to a single range.
- Parameters:
guestRange- the guest range- Returns:
- the host range
-
mapGuestToHost
Translate a set from guest to hostOnly those ranges (or parts of ranges) that mapped are included.
- Parameters:
guestSet- the guest set- Returns:
- the host set
-
getConventionalRegisterRange
Translate the given platform register to the given host overlay space- Parameters:
overlay- the overlay space, usually that allocated for a thread or frameregister- the platform register- Returns:
- the host range
-
getConventionalRegisterObjectNames
Get the names or indices of the register object for the given platform registerThis will check for a label in the host physical space, allowing a mapper to specify an alternative register object name. See
addRegisterMapOverride(Register, String). If one exists, then only that name is returned. Otherwise, the given register's names and aliases are all returned as defined and in all-upper and all-lower case.- Parameters:
register- the platform register- Returns:
- the mapped name
-
getConventionalRegisterPath
PathFilter getConventionalRegisterPath(TraceObjectSchema schema, KeyPath path, Collection<String> names) Get the expected path where an object defining the register value would be- Parameters:
schema- the schema of the register containerpath- the path to the register containernames- the possible names of the register on the target- Returns:
- the path matcher, possibly empty
-
getConventionalRegisterPath
Get the expected path where an object defining the register value would beThis will check for a label in the host physical space, allowing a mapper to specify an alternative register object name. See
addRegisterMapOverride(Register, String).- Parameters:
schema- the schema of the register containerpath- the path to the register containerregister- the platform register- Returns:
- the path matcher, possibly empty
-
getConventionalRegisterPath
Get the expected path where an object defining the register value would be- Parameters:
container- the register containerregister- the platform register- Returns:
- that path matcher, possibly empty, or null if the trace has no root schema
- See Also:
-
getConventionalRegisterPath
Get the expected path where an object defining the register value would be- Parameters:
overlay- the overlay space allocated for a thread or frameregister- the platform register- Returns:
- the path matcher, or null if there is no root schema
- See Also:
-
addRegisterMapOverride
Add a label the conventionally maps the value of aTraceRegisterin the object manager to a register from this platform- Parameters:
register- the language registerobjectName- the name of theTraceRegisterin the object tree- Returns:
- the label
-
getMappedMemBuffer
Get 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.
- 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
Copy 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.
- Parameters:
set- the instruction set in the guest space- Returns:
- the instruction set in the host space
-