From b7012e6c465fe907aef98a53af2c2e73e11524f0 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sat, 13 Aug 2016 21:19:36 -0400 Subject: [PATCH] libdebugger: Fix #12914. DwarfImageDebugInfo: - While computing return value locations, we need to re-evaluate the availability of debug information as we're forced to traverse around images to resolve the location of a function call. Otherwise, we may crash as one of the called functions may belong to an image that wasn't compiled with debug info. --- .../debugger/debug_info/DwarfImageDebugInfo.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/kits/debugger/debug_info/DwarfImageDebugInfo.cpp b/src/kits/debugger/debug_info/DwarfImageDebugInfo.cpp index 69765e3aa8..11e62addb7 100644 --- a/src/kits/debugger/debug_info/DwarfImageDebugInfo.cpp +++ b/src/kits/debugger/debug_info/DwarfImageDebugInfo.cpp @@ -1201,6 +1201,11 @@ DwarfImageDebugInfo::_CreateReturnValues(ReturnValueInfoList* returnValueInfos, status_t result = B_OK; ImageDebugInfo* imageInfo = targetImage->GetImageDebugInfo(); + if (imageInfo == NULL) { + // the subroutine may have resolved to a different image + // that doesn't have debug information available. + continue; + } FunctionInstance* targetFunction; if (imageInfo->GetAddressSectionType(subroutineAddress) @@ -1218,6 +1223,14 @@ DwarfImageDebugInfo::_CreateReturnValues(ReturnValueInfoList* returnValueInfos, if (targetImage == NULL) continue; imageInfo = targetImage->GetImageDebugInfo(); + if (imageInfo == NULL) { + // As above, since the indirection here may have + // landed us in an entirely different image, there is + // no guarantee that debug info is available, + // depending on which image it was. + continue; + } + } }