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:
@@ -1097,14 +1097,15 @@ DwarfImageDebugInfo::_CreateReturnValues(ReturnValueInfoList* returnValueInfos,
|
|||||||
Image* image, StackFrame* frame, DwarfStackFrameDebugInfo& factory)
|
Image* image, StackFrame* frame, DwarfStackFrameDebugInfo& factory)
|
||||||
{
|
{
|
||||||
for (int32 i = 0; i < returnValueInfos->CountItems(); i++) {
|
for (int32 i = 0; i < returnValueInfos->CountItems(); i++) {
|
||||||
|
Image* targetImage = image;
|
||||||
ReturnValueInfo* valueInfo = returnValueInfos->ItemAt(i);
|
ReturnValueInfo* valueInfo = returnValueInfos->ItemAt(i);
|
||||||
target_addr_t subroutineAddress = valueInfo->SubroutineAddress();
|
target_addr_t subroutineAddress = valueInfo->SubroutineAddress();
|
||||||
CpuState* subroutineState = valueInfo->State();
|
CpuState* subroutineState = valueInfo->State();
|
||||||
if (!image->ContainsAddress(subroutineAddress)) {
|
if (!targetImage->ContainsAddress(subroutineAddress)) {
|
||||||
// our current image doesn't contain the target function,
|
// our current image doesn't contain the target function,
|
||||||
// locate the one which does.
|
// locate the one which does.
|
||||||
image = image->GetTeam()->ImageByAddress(subroutineAddress);
|
targetImage = image->GetTeam()->ImageByAddress(subroutineAddress);
|
||||||
if (image == NULL) {
|
if (targetImage == NULL) {
|
||||||
// nothing we can do, try the next entry (if any)
|
// nothing we can do, try the next entry (if any)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user