Add thread callstacks to android crash reports

- Add per thread stack walk functionality.
 - Add functionality to android crash context to use all thread manager thread's callstacks.
 - Before report upload, add all thread xml data into crash report
 - tidy up signal handler's separate stack behaviour. it is now shared by both fatal signal and thread backtrace signal.
#rb Jack.Porter
[FYI] Chris.Babcock, Brandon.Schaefer
#rnx


#ROBOMERGE-SOURCE: CL 10410010 via CL 10410020 via CL 10410025
#ROBOMERGE-BOT: (v594-10333955)

[CL 10410026 by allan bentham in Main branch]
This commit is contained in:
allan bentham
2019-11-25 06:49:37 -05:00
parent c630e21e95
commit 25284a3627
13 changed files with 563 additions and 176 deletions
@@ -27,4 +27,32 @@ void FAndroidErrorReport::ShutDown()
AndroidErrorReport::CrashHelperModule->ShutdownModule();
}
static void AddThreadContexts(const FString& ReportDirectory)
{
// Try to load the callstacks file.
const FString ThreadContextsFile(ReportDirectory / TEXT("AllThreads.txt"));
IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
if (PlatformFile.FileExists(*ThreadContextsFile))
{
// rename the threads file, if anything goes wrong during processing it will be skipped on the next run.
const FString ThreadContextsFileTemp(ReportDirectory / TEXT("AllThreads.tmp"));
PlatformFile.MoveFile(*ThreadContextsFileTemp, *ThreadContextsFile);
FXmlFile ThreadsNode(ThreadContextsFileTemp);
if (ThreadsNode.IsValid())
{
FPrimaryCrashProperties::Get()->Threads = ThreadsNode.GetRootNode();
// delete the file as it has been added to the primary report.
PlatformFile.DeleteFile(*ThreadContextsFileTemp);
}
}
}
FText FAndroidErrorReport::DiagnoseReport() const
{
AddThreadContexts(ReportDirectory);
return FText();
}
#undef LOCTEXT_NAMESPACE
@@ -93,6 +93,20 @@ int64 FCrashProperty::AsInt64() const
return Value;
}
FCrashPropertyXmlNode::FCrashPropertyXmlNode(const FString& InMainCategory, const FString& InSecondCategory, FPrimaryCrashProperties* InOwner)
: Owner(InOwner)
, MainCategory(InMainCategory)
, SecondCategory(InSecondCategory)
, bSet(false)
{ }
FCrashPropertyXmlNode& FCrashPropertyXmlNode::operator=(const FXmlNode* Node)
{
bSet = true;
Owner->SetCrashProperty(MainCategory, SecondCategory, Node);
return *this;
}
/*-----------------------------------------------------------------------------
FPrimaryCrashProperties
-----------------------------------------------------------------------------*/
@@ -122,6 +136,7 @@ FPrimaryCrashProperties::FPrimaryCrashProperties()
, PlatformCallbackResult(FGenericCrashContext::PlatformPropertiesTag, TEXT("PlatformCallbackResult"), this)
, CrashReportClientVersion(FGenericCrashContext::RuntimePropertiesTag, TEXT("CrashReportClientVersion"), this)
, CPUBrand(FGenericCrashContext::RuntimePropertiesTag, TEXT("CPUBrand"), this)
, Threads(FGenericCrashContext::RuntimePropertiesTag, TEXT("Threads"), this)
, bIsOOM(false)
, bLowMemoryWarning(false)
, bInBackground(false)