Files
UnrealEngineUWP/Engine/Source/Developer/CrashDebugHelper/Private/Windows/MinidumpParser.cpp
Jaroslaw Surowiec f0b9bf883b CrashDebugHelper
- Minidump diagnostics run from the crash processor will always use the PDB cache and the MDD from the main branch
- Reimplemented PDB cache to support UE4 releases that are stored on the network drive
- Cleaned up a bit code, removed old or obsolete functionality
- PDB Cache is disabled by default, can be only enabled through the command line (should fix issues related to "\\Device\\Harddisk3\\DR3", somehow caused by the bad flash device driver when F:\\ is a generic flash reader?)

#codereview Bob.Tellez, James.Hopkin, Robert.Manuszewski

[CL 2212226 by Jaroslaw Surowiec in Main branch]
2014-07-14 06:53:12 -04:00

110 lines
3.6 KiB
C++

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#include "CrashDebugHelperPrivatePCH.h"
#include "EngineVersion.h"
#include "Windows/WindowsPlatformStackWalkExt.h"
#include "ISourceControlModule.h"
#include "AllowWindowsPlatformTypes.h"
bool FCrashDebugHelperWindows::CreateMinidumpDiagnosticReport( const FString& InCrashDumpFilename )
{
const bool bSyncSymbols = FParse::Param( FCommandLine::Get(), TEXT( "SyncSymbols" ) );
const bool bAnnotate = FParse::Param( FCommandLine::Get(), TEXT( "Annotate" ) );
const bool bSyncMicrosoftSymbols = FParse::Param( FCommandLine::Get(), TEXT( "SyncMicrosoftSymbols" ) );
const bool bUseSCC = bSyncSymbols || bAnnotate || bSyncMicrosoftSymbols;
if( bUseSCC )
{
InitSourceControl(false);
}
FWindowsPlatformStackWalkExt WindowsStackWalkExt( CrashInfo );
const bool bReady = WindowsStackWalkExt.InitStackWalking();
bool bAtLeastOneFunctionNameFoundInCallstack = false;
if( bReady && WindowsStackWalkExt.OpenDumpFile( InCrashDumpFilename ) )
{
if( CrashInfo.ChangelistBuiltFrom != FCrashInfo::INVALID_CHANGELIST )
{
// Get the build version from the crash info.
FCrashModuleInfo ExeFileVersion;
WindowsStackWalkExt.GetExeFileVersionAndModuleList( ExeFileVersion );
// @see AutomationTool.CommandUtils.EscapePath
const FString CleanedDepotName = CrashInfo.DepotName.Replace( TEXT( ":" ), TEXT( "" ) ).Replace( TEXT( "/" ), TEXT( "+" ) ).Replace( TEXT( "\\" ), TEXT( "+" ) ).Replace( TEXT( " " ), TEXT( "+" ) );
const FEngineVersion EngineVersion( ExeFileVersion.Major, ExeFileVersion.Minor, ExeFileVersion.Patch, CrashInfo.ChangelistBuiltFrom, CleanedDepotName );
CrashInfo.ProductVersion = EngineVersion.ToString();
// CrashInfo now contains a changelist to lookup a label for
if( bSyncSymbols )
{
RetrieveBuildLabelAndNetworkPath( CrashInfo.ChangelistBuiltFrom );
SyncModules();
}
// Initialise the symbol options
WindowsStackWalkExt.InitSymbols();
// Set the symbol path based on the loaded modules
WindowsStackWalkExt.SetSymbolPathsFromModules();
// Get all the info we should ever need about the modules
WindowsStackWalkExt.GetModuleInfoDetailed();
// Get info about the system that created the minidump
WindowsStackWalkExt.GetSystemInfo();
// Get all the thread info
WindowsStackWalkExt.GetThreadInfo();
// Get exception info
WindowsStackWalkExt.GetExceptionInfo();
// Get the callstacks for each thread
bAtLeastOneFunctionNameFoundInCallstack = WindowsStackWalkExt.GetCallstacks();
// Sync the source file where the crash occurred
if( CrashInfo.SourceFile.Len() > 0 )
{
if( bSyncSymbols )
{
CrashInfo.Log( FString::Printf( TEXT( " ... using label '%s' to sync crash source file" ), *CrashInfo.LabelName ) );
SyncSourceFile();
}
// Try to annotate the file if requested
bool bAnnotationSuccessful = false;
if( bAnnotate )
{
bAnnotationSuccessful = AddAnnotatedSourceToReport();
}
// If annotation is not requested, or failed, add the standard source context
if( !bAnnotationSuccessful )
{
AddSourceToReport();
}
}
}
else
{
CrashInfo.Log( FString::Printf( TEXT( "CreateMinidumpDiagnosticReport: Failed to find executable image; possibly pathless module names?" ), *InCrashDumpFilename ) );
}
}
else
{
CrashInfo.Log( FString::Printf( TEXT( "CreateMinidumpDiagnosticReport: Failed to open crash dump file: %s" ), *InCrashDumpFilename ) );
}
if( bUseSCC )
{
ShutdownSourceControl();
}
return bAtLeastOneFunctionNameFoundInCallstack;
}
#include "HideWindowsPlatformTypes.h"