Files
UnrealEngineUWP/Engine/Source/Programs/CrashReportClient/Private/Linux/CrashReportClientMainLinux.cpp
Joe Conley c12a880a0c Unshelved from pending changelist '4791207':
Source=CL 4772220 in //UE4/Main/...
Acknowledger=joe.conley (Thu Jan 24 2019 00:26:59 GMT+0000 (Coordinated Universal Time))
ShelfCl=4791207
Target=Dev-VR
Merge conflict:
/src/ROBOMERGE_DEVVR_Dev_VR/Engine/Plugins/Lumin/MagicLeap/Source/MagicLeapController/Private/MagicLeapController.cpp - merging //UE4/Main/Engine/Plugins/Lumin/MagicLeap/Source/MagicLeapController/Private/MagicLeapController.cpp#5

#rb Ryan.Vance

[CL 4792243 by Joe Conley in Dev-VR branch]
2019-01-23 19:56:41 -05:00

71 lines
1.7 KiB
C++

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#include "CoreMinimal.h"
#include "Containers/StringConv.h"
#include "Containers/UnrealString.h"
#include "CoreGlobals.h"
#include "Misc/OutputDeviceRedirector.h"
#include "Misc/OutputDeviceError.h"
#include "Misc/FeedbackContext.h"
#include "CrashReportClientApp.h"
#include "Unix/UnixPlatformCrashContext.h"
#include <locale.h>
extern int32 ReportCrash(const FUnixCrashContext& Context); // FIXME: handle expose it someplace else?
/**
* Because crash reporters can crash, too
*/
void CrashReporterCrashHandler(const FGenericCrashContext& GenericContext)
{
// at this point we should already be using malloc crash handler (see PlatformCrashHandler)
const FUnixCrashContext& Context = static_cast< const FUnixCrashContext& >( GenericContext );
printf("CrashHandler: Signal=%d\n", Context.Signal);
const_cast< FUnixCrashContext& >(Context).CaptureStackTrace();
if (GLog)
{
GLog->Flush();
}
if (GWarn)
{
GWarn->Flush();
}
if (GError)
{
GError->Flush();
GError->HandleError();
}
FPlatformMisc::RequestExit(true);
}
/**
* main(), called when the application is started
*/
int main(int argc, const char *argv[])
{
FPlatformMisc::SetGracefulTerminationHandler();
FPlatformMisc::SetCrashHandler(CrashReporterCrashHandler);
FString SavedCommandLine;
for (int32 Option = 1; Option < argc; Option++)
{
SavedCommandLine += TEXT(" ");
SavedCommandLine += UTF8_TO_TCHAR(argv[Option]); // note: technically it depends on locale
}
// assume unattended if we don't have X11 display
if (getenv("DISPLAY") == nullptr)
{
SavedCommandLine += TEXT(" -unattended");
}
// Run the app
RunCrashReportClient(*SavedCommandLine);
return 0;
}