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);