Debugger: Fix #12693.

DwarfImageDebugInfo:
- When resolving the address of a PIC function that a value was
  returned by, check if the resulting address actually belongs to
  the same image as the caller. If not, find the appropriate image
  for the new address. Combined with the previous commits, this fixes
  the issue that functions called indirectly by PLT entry that jumped
  to another image entirely wouldn't be mapped back to their
  corresponding FunctionDebugInfo instance, and thus would be skipped
  since we  couldn't determine a type to associate the return value with.
This commit is contained in:
Rene Gollent 2016-03-19 16:21:45 -04:00
parent 4f21e03d09
commit b679d8afa0
1 changed files with 11 additions and 1 deletions

View File

@ -1,6 +1,6 @@
/*
* Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2012-2014, Rene Gollent, rene@gollent.com.
* Copyright 2012-2016, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
@ -1209,6 +1209,16 @@ DwarfImageDebugInfo::_CreateReturnValues(ReturnValueInfoList* returnValueInfos,
subroutineAddress, subroutineState, subroutineAddress);
if (result != B_OK)
continue;
if (!targetImage->ContainsAddress(subroutineAddress)) {
// the PLT entry doesn't necessarily point to a function
// in the same image; as such we may need to try to
// resolve the target address again.
targetImage = image->GetTeam()->ImageByAddress(
subroutineAddress);
if (targetImage == NULL)
continue;
imageInfo = targetImage->GetImageDebugInfo();
}
}
targetFunction = imageInfo->FunctionAtAddress(subroutineAddress);