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.
This commit is contained in:
Rene Gollent 2013-04-27 18:15:31 -04:00
parent 274ca38fd1
commit a10aec9c5c
1 changed files with 7 additions and 2 deletions

View File

@ -1106,6 +1106,8 @@ DwarfImageDebugInfo::_CreateReturnValues(ReturnValueInfoList* returnValueInfos,
status_t result = B_OK; status_t result = B_OK;
ImageDebugInfo* imageInfo = image->GetImageDebugInfo(); ImageDebugInfo* imageInfo = image->GetImageDebugInfo();
FunctionInstance* targetFunction; FunctionInstance* targetFunction;
target_size_t addressSize = fDebuggerInterface->GetArchitecture()
->AddressSize();
if (subroutineAddress >= fPLTSectionStart if (subroutineAddress >= fPLTSectionStart
&& subroutineAddress < fPLTSectionEnd) { && subroutineAddress < fPLTSectionEnd) {
// if the function in question is position-independent, the call // if the function in question is position-independent, the call
@ -1118,8 +1120,6 @@ DwarfImageDebugInfo::_CreateReturnValues(ReturnValueInfoList* returnValueInfos,
return B_BAD_VALUE; return B_BAD_VALUE;
} }
target_size_t addressSize = fDebuggerInterface->GetArchitecture()
->AddressSize();
ssize_t bytesRead = fDebuggerInterface->ReadMemory( ssize_t bytesRead = fDebuggerInterface->ReadMemory(
info.TargetAddress(), &subroutineAddress, addressSize); info.TargetAddress(), &subroutineAddress, addressSize);
@ -1155,6 +1155,11 @@ DwarfImageDebugInfo::_CreateReturnValues(ReturnValueInfoList* returnValueInfos,
} else } else
byteSize = returnType->ByteSize()->constant; 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; ValueLocation* location;
result = fArchitecture->GetReturnAddressLocation(frame, result = fArchitecture->GetReturnAddressLocation(frame,
byteSize, location); byteSize, location);