Files
UnrealEngineUWP/Engine/Source/Programs/Mac/DsymExporter/Private/DsymExporterApp.cpp
Mark Satterthwaite 88751c6da8 Rewritten debug symbol handling for OS X to allow creation of dSYM bundles & symbol stripping of executables.
- The MacToolChain will emit dSYMs and strip executables when the UBT configuration enables bGeneratedSYMFile, just like iOS.
- Symbol stripping requires generating dSYMs to prevent creation of non-debuggable builds whose crash reports would be unresolvable.
- To avoid a dependency on the Private framework CoreSymbolication all symbols from that framework are loaded dynamically & can only be used within programs, not the game or the editor, as CoreSymbolication is incompatible with non-ANSI malloc implementations.
- Added an initial platform-agnostic API for querying debug symbol info, including a generic database format that can be queried on otherwise incompatible platforms.
- Added UnrealAtoS that emulates Apple's atos to resolve symbols using the generic database or the platform API (CoreSymbolication on OS X) which on OS X is used by the editor to gather symbol info for CodeView.
- Added DSymExporter which will export Apple debug symbol data from Mach-O binaries, including the payload within a .dSYM bundle, to the generic format so that the crash report server may one day read the data without needing a Mac to symbolicate reports.
- Initial SymbolDebugger & MinidumpDiagnostics support on OS X.
#codereview michael.trepka, Jaroslaw.Surowiec, lee.clark, peter.sauerbrei

[CL 2466299 by Mark Satterthwaite in Main branch]
2015-03-02 10:21:50 -05:00

55 lines
1.6 KiB
C++

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "DsymExporterApp.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;
}
}