sdl: integrate backward-cpp (https://github.com/bombela/backward-cpp) to generate more helpful debugging output

This commit is contained in:
punkrockguy318 2013-03-15 18:22:38 +00:00
parent e8f48b583d
commit 0d1d24e153
3 changed files with 43 additions and 1 deletions

View File

@ -27,7 +27,7 @@ opts.AddVariables(
BoolVariable('SYSTEM_LUA','Use system lua instead of static lua provided with fceux', 1),
BoolVariable('SYSTEM_MINIZIP', 'Use system minizip instead of static minizip provided with fceux', 0),
BoolVariable('LSB_FIRST', 'Least signficant byte first (non-PPC)', 1),
BoolVariable('CLANG', 'Compile with llvm-clang instead of gcc', 1),
BoolVariable('CLANG', 'Compile with llvm-clang instead of gcc', 0),
BoolVariable('SDL2', 'Compile using SDL2 instead of SDL 1.2 (experimental/non-functional)', 0)
)
AddOption('--prefix', dest='prefix', type='string', nargs=1, action='store', metavar='DIR', help='installation prefix')
@ -83,6 +83,13 @@ if env['PLATFORM'] == 'win32':
env.Append(LIBS = ["rpcrt4", "comctl32", "vfw32", "winmm", "ws2_32", "comdlg32", "ole32", "gdi32", "htmlhelp"])
else:
conf = Configure(env)
# If libdw is available, compile in backward-cpp support
if conf.CheckLib('dw'):
conf.env.Append(CCFLAGS = "-DBACKWARD_HAS_DW=1")
conf.env.Append(LINKFLAGS = "-ldw")
# workaround for upstream backward-cpp issue (https://github.com/bombela/backward-cpp/issues/2)
if env['CLANG']:
conf.env.Append(CCFLAGS = "-DBACKWARD_HAS_BACKTRACE=1")
if conf.CheckFunc('asprintf'):
conf.env.Append(CCFLAGS = "-DHAVE_ASPRINTF")
if env['SYSTEM_MINIZIP']:

View File

@ -2,6 +2,7 @@ import glob
#source_list = glob.glob('*.cpp')
source_list = Split(
"""
backward.cpp
ConvertUTF.c
xstring.cpp
crc32.cpp
@ -14,6 +15,7 @@ memory.cpp
Import('env')
if env['SYSTEM_MINIZIP'] == 0:
source_list.append('unzip.cpp')
source_list.append('ioapi.cpp')

33
src/utils/backward.cpp Normal file
View File

@ -0,0 +1,33 @@
// Pick your poison.
//
// On GNU/Linux, you have few choices to get the most out of your stack trace.
//
// By default you get:
// - object filename
// - function name
//
// In order to add:
// - source filename
// - line and column numbers
// - source code snippet (assuming the file is accessible)
// Install one of the following library then uncomment one of the macro (or
// better, add the detection of the lib and the macro definition in your build
// system)
// - apt-get install libdw-dev ...
// - g++/clang++ -ldw ...
// #define BACKWARD_HAS_DW 1
// - apt-get install binutils-dev ...
// - g++/clang++ -lbfd ...
// #define BACKWARD_HAS_BFD 1
#if BACKWARD_HAS_DW==1
#include "backward.hpp"
namespace backward {
backward::SignalHandling sh;
} // namespace backward
#endif