winIDEA SDK
isys::CAddressController Class Reference

Description

This class provides information about symbols and source code - sizes and addresses in the memory.

Python example for method getSymbolAtAddress(): test_get_symbol_at_address.py

#include <CAddressController.h>

Inheritance diagram for isys::CAddressController:
isys::WrapperBase

Public Member Functions

 CAddressController (std::shared_ptr< ConnectionMgr > connectionMgr)
 Instantiates object. More...
 
iconnect::AddressVector getAddressOfSourceLine (const std::string &fileName, int line, bool isReportSize=false)
 Returns vector of addresses used by the given line of source code. More...
 
std::string getAnySymbolAtAddress (uint32_t symbolTypes, uint8_t memArea, ADDRESS_64 address, isys::IConnectDebug::ESymbolFlags scope)
 Returns the name of the symbol at the specified address, or empty string if there is no symbol at the given address. More...
 
int getCodeArea (bool bPhysical)
 Returns memory area, where the code is located. More...
 
CMemAddress getExpressionAddress (const std::string &expression)
 Returns address of an expression. More...
 
CMemAddress getFunctionAddress (const std::string &functionName)
 Returns address of a function. More...
 
void getFunctionNames (const iconnect::AddressVector &addresses, iconnect::StrVector &names, iconnect::IntVector &types)
 Returns names of functions at given addresses. More...
 
CMemAddress getLabelAddress (const std::string &labelName)
 Returns address of a label. More...
 
CLineLocation getSourceLineAtAddress (ADDRESS_64 address)
 Returns the location of source line which generates code at the given address. More...
 
CLineLocation getSourceLineAtAddress (ADDRESS_64 address, bool isExact, bool isAbsolutePath)
 Returns the location of source line which generates code at the given address. More...
 
CLineLocation getSourceLocation (isys::CLineDescriptionSPtr tpLocation)
 Return line location which matches the given criteria. More...
 
std::string getSymbolAtAddress (isys::IConnectDebug::ESymbolFlags symbolType, uint8_t memArea, ADDRESS_64 address, isys::IConnectDebug::ESymbolFlags scope=isys::IConnectDebug::sScopeExact)
 Returns the name of the symbol at the specified address, or empty string if there is no symbol at the given address. More...
 
CSymbolInfo getSymbolInfo (uint32_t flags, const std::string &expression)
 Returns information about the symbol. More...
 
CMemAddress getVariableAddress (const std::string &variableName)
 Returns address of a variable. More...
 

Static Public Member Functions

static std::string getTestPointIdPrefix ()
 Returns const prefix used in search for test point location, when matching type is set to E_MATCH_TEST_POINT_ID. More...
 

Constructor & Destructor Documentation

◆ CAddressController()

isys::CAddressController::CAddressController ( std::shared_ptr< ConnectionMgr connectionMgr)

Instantiates object.

Parameters
connectionMgrclass which maintains connection to winIDEA. Connection must be established before this call.

Python example: test_get_code_area.py

Member Function Documentation

◆ getAddressOfSourceLine()

iconnect::AddressVector isys::CAddressController::getAddressOfSourceLine ( const std::string &  fileName,
int  line,
bool  isReportSize = false 
)

Returns vector of addresses used by the given line of source code.

If the line generates no assembly code (empty lines, for example), an empty vector is returned. To get info about memory area, use method getCodeArea(), because executable code is always located in the code memory area.
If source line compiles to a continuous block of code its start address and size are reported. Only when source line generates several blocks of object code (for example 'for' loop), more than one address item is returned.

Parameters
fileNamename of the file, where the source line is located
lineline number
isReportSizeif set, for every object location both address and size are returned

Python example: test_get_address_of_source_line.py

◆ getAnySymbolAtAddress()

std::string isys::CAddressController::getAnySymbolAtAddress ( uint32_t  symbolTypes,
uint8_t  memArea,
ADDRESS_64  address,
isys::IConnectDebug::ESymbolFlags  scope 
)

Returns the name of the symbol at the specified address, or empty string if there is no symbol at the given address.

Parameters
symbolTypesSpecifies symbol classes to consider, must be one of the following IConnectDebug::ESymbolFlags: sVariables, sLabels, sFunctions, sLine, sConstants or ORed value of these constants
memAreamemory area of the object
addressaddress of the object
scopedefines how exact the symbol search should be. Should be one of sScope* flags from IConnectDebug::ESymbolFlags.
See also
getSymbolAtAddress

◆ getCodeArea()

int isys::CAddressController::getCodeArea ( bool  bPhysical)

Returns memory area, where the code is located.

Parameters
bPhysicalused only for PowerPC, see MemoryAreas.cpp, CCPUInfoHelp::GetCodeArea(): return bPhysical ? maPPhysicalPowerPC : maVirtualPowerPC;

Python example: test_get_code_area.py

◆ getExpressionAddress()

CMemAddress isys::CAddressController::getExpressionAddress ( const std::string &  expression)

Returns address of an expression.

Expression can be any item with address, for example function, variable, struct member, ...

Parameters
expressionany expression with address, for example 'myStruct.x'

Python example: test_get_expression_address.py

◆ getFunctionAddress()

CMemAddress isys::CAddressController::getFunctionAddress ( const std::string &  functionName)

Returns address of a function.

If function is located in a default download file, then its name is enough. If function is located in other download file than the default one, a fully qualified name should be specified in the following format:

"<moduleName>"#<funcName>,,<downloadFileName>

where:

  • moduleName - name of the C source file, which contains the function
  • funcName - name of the function
  • downloadFileName - name of the download file, where the function is located

Module name is optional. It is only needed when there is more than one file static function with the same name.

Example:

"main.c"#init,,executable.elf
Parameters
functionNamename of the function

Python example: test_get_function_address.py

◆ getFunctionNames()

void isys::CAddressController::getFunctionNames ( const iconnect::AddressVector addresses,
iconnect::StrVector names,
iconnect::IntVector types 
)

Returns names of functions at given addresses.

If function can not be found for an address, empty string or hex address is returned.

Parameters
addressesinput list of function addresses. Address may be located anywhere inside function.
namesoutput list of function names. On output it has the same number of elements as 'addresses'.
typesoutput list of symbol type at address. Can be IConnectDebug.sFunctions, IConnectDebug.sLabels, or IConnectDebug.sConstants if no function or label is found at the given address.

Python example: test_get_function_names.py

◆ getLabelAddress()

CMemAddress isys::CAddressController::getLabelAddress ( const std::string &  labelName)

Returns address of a label.

Parameters
labelNamename of the label

Python example: test_get_label_address.py

◆ getSourceLineAtAddress() [1/2]

CLineLocation isys::CAddressController::getSourceLineAtAddress ( ADDRESS_64  address)

Returns the location of source line which generates code at the given address.

It is equivalent of getSourceLineAtAddress(address, false, false).

Parameters
addressmemory address, where the code generated by the returned source line is located
Returns
file name and line number if there exits source line for the given address, or empty file name and line number set to 0 if there is no such source line.

Python example: test_get_source_line_at_address.py

◆ getSourceLineAtAddress() [2/2]

CLineLocation isys::CAddressController::getSourceLineAtAddress ( ADDRESS_64  address,
bool  isExact,
bool  isAbsolutePath 
)

Returns the location of source line which generates code at the given address.

Parameters
addressmemory address, where the code generated by the returned source line is located
isExactif true, address must be the the first address occupied by the source line. If it is not, empty file name and line number set to 0 are returned.
isAbsolutePathif true, file name is returned with absolute path
Returns
file name and line number if there exits source line for the given address, or empty file name and line number set to 0 if there is no such source line.

◆ getSourceLocation()

CLineLocation isys::CAddressController::getSourceLocation ( isys::CLineDescriptionSPtr  tpLocation)

Return line location which matches the given criteria.

Use this method when you want to set a breakpoint on a specific line in source code, but line number of this line changes as source code is modified. For example, if you always want the script to set a breakpoint at source line

   numItems = 1234;

in function f(), then use this method to get line number and the source file. This information can then be used to set a breakpoint.

Parameters
tpLocationobject with source line search criteria

Python example: test_get_source_location.py

◆ getSymbolAtAddress()

std::string isys::CAddressController::getSymbolAtAddress ( isys::IConnectDebug::ESymbolFlags  symbolType,
uint8_t  memArea,
ADDRESS_64  address,
isys::IConnectDebug::ESymbolFlags  scope = isys::IConnectDebug::sScopeExact 
)

Returns the name of the symbol at the specified address, or empty string if there is no symbol at the given address.

Parameters
symbolTypeSpecifies symbol classes to consider, must be one of the following IConnectDebug::ESymbolFlags: sVariables, sLabels, sFunctions, sLine, or sConstants.
memAreamemory area of the object
addressaddress of the object
scopedefines how exact the symbol search should be. Should be one of sScope* flags from IConnectDebug::ESymbolFlags.

Python example: test_get_symbol_at_address.py

◆ getSymbolInfo()

CSymbolInfo isys::CAddressController::getSymbolInfo ( uint32_t  flags,
const std::string &  expression 
)

Returns information about the symbol.

It includes:

  • memory area, where it is located (set to 0 for architectures with linear memory space)
  • address or the symbol
  • size of the symbol in memory allocation units
  • type

If you need only address of the symbol, then methods getFunctionAddress(), getVariableAddress(), and getLabelAddress() are more convenient.

Parameters
flags
31 30-24 23-16 15-12 11-8 7-0
Use File File Index Enum Index Enum Source Reserved SBZ EAccessFlags
  • EAccessFlags - used if required to resolve the expression. See IConnectDebug::EAccessFlags.
  • Enum Source - see IConnectDebug::EGetAddressFlags, flags gafExpression, gafVariables, gafLabels, and gafFunctions.
  • Enum Index - Index of the enumerated symbol to return.
  • File index - Index of the symbol (download) file to use. Used only if Use File flag is set.
  • Use File - if this bit set, then download file specified by File Index is used. If it is not set, the default download file is used.
expressionname of the symbol, for example variable or function name

Python example: test_create_config_item.py

◆ getTestPointIdPrefix()

static std::string isys::CAddressController::getTestPointIdPrefix ( )
static

Returns const prefix used in search for test point location, when matching type is set to E_MATCH_TEST_POINT_ID.

Python example: test_get_test_point_id_prefix.py

◆ getVariableAddress()

CMemAddress isys::CAddressController::getVariableAddress ( const std::string &  variableName)

Returns address of a variable.

Use this method to get address of a simple variable. For complex items, for example struct members, use method getExpressionAddress().

Parameters
variableNamename of the variable

Python example: test_get_variable_addresses.py