std::string SymbolMap::GetDescription(unsigned int address) { std::lock_guard<std::recursive_mutex> guard(lock_); const char* labelName = NULL; u32 funcStart = GetFunctionStart(address); if (funcStart != INVALID_ADDRESS) { labelName = GetLabelName(funcStart); } else { u32 dataStart = GetDataStart(address); if (dataStart != INVALID_ADDRESS) labelName = GetLabelName(dataStart); } if (labelName != NULL) return labelName; char descriptionTemp[256]; sprintf(descriptionTemp, "(%08x)", address); return descriptionTemp; }
bool SymbolMap::GetSymbolInfo(SymbolInfo *info, u32 address, SymbolType symmask) const { u32 functionAddress = INVALID_ADDRESS; u32 dataAddress = INVALID_ADDRESS; if (symmask & ST_FUNCTION) { functionAddress = GetFunctionStart(address); // If both are found, we always return the function, so just do that early. if (functionAddress != INVALID_ADDRESS) { if (info != NULL) { info->type = ST_FUNCTION; info->address = functionAddress; info->size = GetFunctionSize(functionAddress); info->moduleAddress = GetFunctionModuleAddress(functionAddress); } return true; } } if (symmask & ST_DATA) { dataAddress = GetDataStart(address); if (dataAddress != INVALID_ADDRESS) { if (info != NULL) { info->type = ST_DATA; info->address = dataAddress; info->size = GetDataSize(dataAddress); info->moduleAddress = GetDataModuleAddress(dataAddress); } return true; } } return false; }