From a10aec9c5c49f10496c5c4728f88ebd7aa69b2c3 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sat, 27 Apr 2013 18:15:31 -0400 Subject: [PATCH] Fix some cases where return values failed to resolve. - Sometimes the return type doesn't appear to have a an associated byte size attribute. If so, simply revert to using the architecture's register width, since at least empirically all such cases appear to be primitive types that fit into one anyways. --- src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp b/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp index b9dad3117d..67b2f5451c 100644 --- a/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp +++ b/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp @@ -1106,6 +1106,8 @@ DwarfImageDebugInfo::_CreateReturnValues(ReturnValueInfoList* returnValueInfos, status_t result = B_OK; ImageDebugInfo* imageInfo = image->GetImageDebugInfo(); FunctionInstance* targetFunction; + target_size_t addressSize = fDebuggerInterface->GetArchitecture() + ->AddressSize(); if (subroutineAddress >= fPLTSectionStart && subroutineAddress < fPLTSectionEnd) { // if the function in question is position-independent, the call @@ -1118,8 +1120,6 @@ DwarfImageDebugInfo::_CreateReturnValues(ReturnValueInfoList* returnValueInfos, return B_BAD_VALUE; } - target_size_t addressSize = fDebuggerInterface->GetArchitecture() - ->AddressSize(); ssize_t bytesRead = fDebuggerInterface->ReadMemory( info.TargetAddress(), &subroutineAddress, addressSize); @@ -1155,6 +1155,11 @@ DwarfImageDebugInfo::_CreateReturnValues(ReturnValueInfoList* returnValueInfos, } else byteSize = returnType->ByteSize()->constant; + // if we were unable to determine a size for the type, + // simply default to the architecture's register width. + if (byteSize == 0) + byteSize = addressSize; + ValueLocation* location; result = fArchitecture->GetReturnAddressLocation(frame, byteSize, location);