Debugger: DwarfImageDebugInfo - fix potential crash.

If the subroutine address in question required us to in a different
image, that lookup would overwrite our pointer to the starting image.
If said lookup then also failed, a crash would occur when performing
operations to look up the next return value, since the image pointer
would then be NULL.
This commit is contained in:
Rene Gollent
2013-07-27 22:55:51 -04:00
parent c0a7796007
commit d1189a6c75
@@ -1097,14 +1097,15 @@ DwarfImageDebugInfo::_CreateReturnValues(ReturnValueInfoList* returnValueInfos,
Image* image, StackFrame* frame, DwarfStackFrameDebugInfo& factory)
{
for (int32 i = 0; i < returnValueInfos->CountItems(); i++) {
Image* targetImage = image;
ReturnValueInfo* valueInfo = returnValueInfos->ItemAt(i);
target_addr_t subroutineAddress = valueInfo->SubroutineAddress();
CpuState* subroutineState = valueInfo->State();
if (!image->ContainsAddress(subroutineAddress)) {
if (!targetImage->ContainsAddress(subroutineAddress)) {
// our current image doesn't contain the target function,
// locate the one which does.
image = image->GetTeam()->ImageByAddress(subroutineAddress);
if (image == NULL) {
targetImage = image->GetTeam()->ImageByAddress(subroutineAddress);
if (targetImage == NULL) {
// nothing we can do, try the next entry (if any)
continue;
}