status_t ImageDebugInfo::FinishInit(DebuggerInterface* interface) { BObjectList<SymbolInfo> symbols(50, true); status_t error = interface->GetSymbolInfos(fImageInfo.TeamID(), fImageInfo.ImageID(), symbols); if (error != B_OK) return error; symbols.SortItems(&_CompareSymbols); // get functions -- get them from most expressive debug info first and add // missing functions from less expressive debug infos for (int32 i = 0; SpecificImageDebugInfo* specificInfo = fSpecificInfos.ItemAt(i); i++) { BObjectList<FunctionDebugInfo> functions; error = specificInfo->GetFunctions(symbols, functions); if (error != B_OK) return error; for (int32 k = 0; FunctionDebugInfo* function = functions.ItemAt(k); k++) { if (FunctionAtAddress(function->Address()) != NULL) continue; FunctionInstance* instance = new(std::nothrow) FunctionInstance( this, function); if (instance == NULL || !fFunctions.BinaryInsert(instance, &_CompareFunctions)) { delete instance; error = B_NO_MEMORY; break; } if (function->IsMain()) fMainFunction = instance; } // Remove references returned by the specific debug info -- the // FunctionInstance objects have references, now. for (int32 k = 0; FunctionDebugInfo* function = functions.ItemAt(k); k++) { function->ReleaseReference(); } if (error != B_OK) return error; } return B_OK; }
status_t ImageDebugInfo::FinishInit() { // get functions -- get them from most expressive debug info first and add // missing functions from less expressive debug infos for (int32 i = 0; SpecificImageDebugInfo* specificInfo = fSpecificInfos.ItemAt(i); i++) { BObjectList<FunctionDebugInfo> functions; status_t error = specificInfo->GetFunctions(functions); if (error != B_OK) return error; for (int32 k = 0; FunctionDebugInfo* function = functions.ItemAt(k); k++) { if (FunctionAtAddress(function->Address()) != NULL) continue; FunctionInstance* instance = new(std::nothrow) FunctionInstance( this, function); if (instance == NULL || !fFunctions.BinaryInsert(instance, &_CompareFunctions)) { delete instance; error = B_NO_MEMORY; break; } } // Remove references returned by the specific debug info -- the // FunctionInstance objects have references, now. for (int32 k = 0; FunctionDebugInfo* function = functions.ItemAt(k); k++) { function->ReleaseReference(); } if (error != B_OK) return error; } return B_OK; }