| |||
| Home > The Cycle Accurate Debug Interface > The CADIDisassembler class |
If the component supports disassembly, the disassembly API can be used to display the disassembly during a simulation.
The CADI class provides the function CADIGetDisassembler().
It is called by the simulation environment to obtain a pointer to
the disassembly API.
A program memory space must exist to use the disassembly feature.
Example 3.4. CADIDisassembler class
class CADIDisassembler : public CAInterface
{
public:
static if_name_t IFNAME() { return "eslapi.CADIDisassembler2"; }
static if_rev_t IFREVISION() { return 0; }
// Two types: distinguish standard and history type
virtual CADIDisassemblerType getType() const =0;
// mode handling functions
virtual uint32_t getModeCount() const =0;
virtual void getModeNames(CADIDisassemblerCB *callback) =0;
virtual uint32_t getCurrentMode() =0;
// set disassembly callback for this object
virtual void registerModeChangeCB(CADIDisasmModeChangeCB* cb);
virtual CADIDisassemblerStatus GetSourceReferenceForAddress(
CADIDisassemblerCB *callback, const CADIAddr_t &address) =0;
virtual CADIDisassemblerStatus getAddressForSourceReference(
const char *sourceFile, uint32_t sourceLine, CADIAddr_t &address) =0
// function for standard type disassembly
virtual CADIDisassemblerStatus getDisassembly(CADIDisassemblerCB *callback,
const CADIAddr_t &address, CADIAddr_t &nextAddr, const uint32_t mode,
uint32_t desiredCount = 1) =0;
// Query if an instruction is a call instruction
virtual CADIDisassemblerStatus GetInstructionType(const CADIAddr_t &address,
CADIDisassemblerInstructionType &insn_type) =0;
// A default minimum implementation, to provide backwards-compatibility.
virtual CAInterface * ObtainInterface(if_name_t ifName, if_rev_t minRev,
if_rev_t * actualRev)
{
if((strcmp(ifName,IFNAME()) == 0) && (minRev <= IFREVISION()))
{
if (actualRev) // make sure this is not a NULL pointer
{
*actualRev = IFREVISION();
}
return this;
}
if((strcmp(ifName, CAInterface::IFNAME()) == 0) &&
minRev <= CAInterface::IFREVISION())
{
if (actualRev != NULL)
{
*actualRev = CAInterface::IFREVISION();
}
return this;
}
return NULL;
}
};