Files
UnrealEngineUWP/Engine/Source/Programs/Mac/DsymExporter/Private/DsymExporterApp.cpp
Ben Marsh 20bf0eb6a1 Updating copyright notices to 2017 (copying from //Tasks/UE4/Dev-Copyright-2017).
#rb none
#lockdown Nick.Penwarden

[CL 3226823 by Ben Marsh in Main branch]
2016-12-08 08:52:44 -05:00

56 lines
1.6 KiB
C++

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#include "DsymExporterApp.h"
#include "Misc/Paths.h"
#include "GenericPlatformSymbolication.h"
#if PLATFORM_MAC
#include "ApplePlatformSymbolication.h"
#endif
#include "Serialization/Archive.h"
int32 RunDsymExporter(int32 ArgC, TCHAR* Argv[])
{
// Make sure we have at least a single parameter
if( ArgC < 2 )
{
UE_LOG( LogInit, Error, TEXT( "DsymExporter - not enough parameters." ) );
UE_LOG( LogInit, Error, TEXT( " ... usage: DsymExporter <Mach-O Binary Path> [Output Folder]" ) );
UE_LOG( LogInit, Error, TEXT( "<Mach-O Binary Path>: This is an absolute path to a Mach-O binary containing symbols, which may be the payload binary within an application, framework or dSYM bundle, an executable or dylib." ) );
UE_LOG( LogInit, Error, TEXT( "[Output Folder]: The folder to write the new symbol database to, the database will take the filename of the input plus the .udebugsymbols extension." ) );
return 1;
}
#if PLATFORM_MAC
FApplePlatformSymbolication::EnableCoreSymbolication(true);
#endif
FPlatformSymbolDatabase Symbols;
FString Signature;
bool bOK = FPlatformSymbolication::LoadSymbolDatabaseForBinary(TEXT(""), Argv[1], Signature, Symbols);
if(bOK)
{
FString OutputFolder = FPaths::GetPath(Argv[1]);
if(ArgC == 3)
{
OutputFolder = Argv[2];
}
if(FPlatformSymbolication::SaveSymbolDatabaseForBinary(OutputFolder, FPaths::GetBaseFilename(Argv[1]), Symbols))
{
return 0;
}
else
{
return 1;
}
}
else
{
UE_LOG( LogInit, Error, TEXT( "DsymExporter - unable to parse debug symbols for Mach-O file." ) );
return 1;
}
}