A.10.1. CADIDisassembler class definition

If a component supports disassembly, the Disassembly API can be used to display the disassembly during a simulation.

Caution

Obtaining a disassembler from the CADI interface by calling CADIGetDissambler() is deprecated. The function is retains to enable compatibility with CADI 1.1.

New code must use the ObtainInterface() call for both disassembler and profiling support.

Note

A program memory space must exist to use the disassembly feature.

Example A.13. 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;

    // Support for multiple modes (e.g. 32bit versus 16bit mode)
    virtual uint32_t GetModeCount() const =0;
    virtual void GetModeNames(CADIDisassemblerCB *callback) =0;
    virtual uint32_t GetCurrentMode() =0;
    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.
    // This implementation assumes that there will be no other interfaces
    // implemented on the component providing CADIDisassembler.
    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;
        }
};

Copyright © 2008-2010 ARM Limited. All rights reserved.ARM DUI 0444F
Non-ConfidentialID110210