diff --git a/src/kits/debug/SymbolLookup.cpp b/src/kits/debug/SymbolLookup.cpp index ec08a55378..63def60fe4 100644 --- a/src/kits/debug/SymbolLookup.cpp +++ b/src/kits/debug/SymbolLookup.cpp @@ -65,6 +65,18 @@ RemoteMemoryAccessor::~RemoteMemoryAccessor() } +status_t +RemoteMemoryAccessor::InitCheck() const +{ + // If we don't have a debug context, then there's nothing we can do. + // SymbolLookup's image file functionality will still be available, though. + if (fDebugContext == NULL || fDebugContext->nub_port < 0) + return B_NO_INIT; + + return B_OK; +} + + const void * RemoteMemoryAccessor::PrepareAddress(const void *remoteAddress, int32 size) @@ -97,7 +109,6 @@ RemoteMemoryAccessor::PrepareAddressNoThrow(const void *remoteAddress, } - Area* RemoteMemoryAccessor::AreaForLocalAddress(const void* address) const { @@ -143,9 +154,7 @@ RemoteMemoryAccessor::_GetAreaNoThrow(const void *address, int32 size, Area *&_a } } - // If we don't have a debug context, then there's nothing we can do. - // SymbolLookup's image file functionality will still be available, though. - if (fDebugContext == NULL || fDebugContext->nub_port < 0) + if (InitCheck() != B_OK) return B_NO_INIT; // we need to clone a new area @@ -221,7 +230,6 @@ private: // #pragma mark - -// constructor SymbolLookup::SymbolLookup(debug_context* debugContext, image_id image) : RemoteMemoryAccessor(debugContext), @@ -232,7 +240,6 @@ SymbolLookup::SymbolLookup(debug_context* debugContext, image_id image) } -// destructor SymbolLookup::~SymbolLookup() { while (Image* image = fImages.RemoveHead()) @@ -240,7 +247,6 @@ SymbolLookup::~SymbolLookup() } -// Init status_t SymbolLookup::Init() { @@ -248,7 +254,7 @@ SymbolLookup::Init() status_t error = 0; - if (fDebugContext->team != B_SYSTEM_TEAM) { + if (RemoteMemoryAccessor::InitCheck() == B_OK) { TRACE(("SymbolLookup::Init(): searching debug area...\n")); // find the runtime loader debug area @@ -305,7 +311,6 @@ SymbolLookup::Init() } -// LookupSymbolAddress status_t SymbolLookup::LookupSymbolAddress(addr_t address, addr_t *_baseAddress, const char **_symbolName, size_t *_symbolNameLen, const char **_imageName, @@ -350,7 +355,6 @@ SymbolLookup::LookupSymbolAddress(addr_t address, addr_t *_baseAddress, } -// InitSymbolIterator status_t SymbolLookup::InitSymbolIterator(image_id imageID, SymbolIterator& iterator) const @@ -374,7 +378,6 @@ SymbolLookup::InitSymbolIterator(image_id imageID, } -// InitSymbolIterator status_t SymbolLookup::InitSymbolIteratorByAddress(addr_t address, SymbolIterator& iterator) const @@ -396,7 +399,6 @@ SymbolLookup::InitSymbolIteratorByAddress(addr_t address, } -// NextSymbol status_t SymbolLookup::NextSymbol(SymbolIterator& iterator, const char** _symbolName, size_t* _symbolNameLen, addr_t* _symbolAddress, size_t* _symbolSize, @@ -407,7 +409,6 @@ SymbolLookup::NextSymbol(SymbolIterator& iterator, const char** _symbolName, } -// GetSymbol status_t SymbolLookup::GetSymbol(image_id imageID, const char* name, int32 symbolType, void** _symbolLocation, size_t* _symbolSize, int32* _symbolType) const @@ -421,7 +422,6 @@ SymbolLookup::GetSymbol(image_id imageID, const char* name, int32 symbolType, } -// _FindLoadedImageAtAddress const image_t * SymbolLookup::_FindLoadedImageAtAddress(addr_t address) { @@ -446,7 +446,6 @@ SymbolLookup::_FindLoadedImageAtAddress(addr_t address) } -// _FindLoadedImageByID const image_t* SymbolLookup::_FindLoadedImageByID(image_id id) { @@ -469,7 +468,6 @@ SymbolLookup::_FindLoadedImageByID(image_id id) } -// _FindImageAtAddress Image* SymbolLookup::_FindImageAtAddress(addr_t address) const { @@ -484,7 +482,6 @@ SymbolLookup::_FindImageAtAddress(addr_t address) const } -// _FindImageByID Image* SymbolLookup::_FindImageByID(image_id id) const { @@ -498,7 +495,6 @@ SymbolLookup::_FindImageByID(image_id id) const } -// _SymbolNameLen size_t SymbolLookup::_SymbolNameLen(const char* address) const { diff --git a/src/kits/debug/SymbolLookup.h b/src/kits/debug/SymbolLookup.h index c57fb57e7b..7f9214429d 100644 --- a/src/kits/debug/SymbolLookup.h +++ b/src/kits/debug/SymbolLookup.h @@ -95,6 +95,8 @@ public: RemoteMemoryAccessor(debug_context* debugContext); ~RemoteMemoryAccessor(); + status_t InitCheck() const; + const void *PrepareAddress(const void *remoteAddress, int32 size); const void *PrepareAddressNoThrow(const void *remoteAddress, int32 size); diff --git a/src/system/runtime_loader/elf.cpp b/src/system/runtime_loader/elf.cpp index d2d4ec5a0d..589a56a215 100644 --- a/src/system/runtime_loader/elf.cpp +++ b/src/system/runtime_loader/elf.cpp @@ -1210,7 +1210,7 @@ rldelf_init(void) runtime_loader_debug_area *area; area_id areaID = _kern_create_area(RUNTIME_LOADER_DEBUG_AREA_NAME, (void **)&area, B_RANDOMIZED_ANY_ADDRESS, size, B_NO_LOCK, - B_READ_AREA | B_WRITE_AREA | B_CLONEABLE_AREA); + B_READ_AREA | B_WRITE_AREA); if (areaID < B_OK) { FATAL("Failed to create debug area.\n"); _kern_loading_app_failed(areaID);