2.6. Getting a target interface

After obtaining a CADISimulation pointer,
an individual target can be connected to. The steps are the same
for connecting to an existing simulation or for instantiating a
new one.

Figure 2.8. Getting a target interface

To view this graphic, your browser must support the SVG format. Either install a browser with native support, or install an appropriate plugin such as Adobe SVG Viewer.

The CADISimulation class holds information
on the contained target components that can be retrieved using the GetTargetInfos() method.
This information includes the ID and properties of the target that
might be important for a debugger such as, for example, whether
the target executes software.

The caller can decide which target to connect to based on
the retrieved information. The required component is specified by
its ID. The ID is forwarded as a parameter to the GetTarget() method
in a later call.

The result of the GetTarget() call is
a CAInterface pointer to the implementation of
the CADI interface in the target component. This pointer is then
used to obtain the required interface in combination with a compatibility
check by calling ObtainInterface(). Typically,
the requested interface is of type CADI as shown
in Figure 2.9, but
other interfaces such as CADIDisassembler, CADIProfiling,
or a custom extension, can also be requested.

After acquiring another non-NULLCAInterface pointer,
the caller must perform a static_cast to the
appropriate type to access its full functionality.

Figure 2.9. Getting a CADI interface

To view this graphic, your browser must support the SVG format. Either install a browser with native support, or install an appropriate plugin such as Adobe SVG Viewer.