From 03ac88ecf7eea84c97e5068f3bf886f113d54091 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Wed, 20 Mar 2013 12:37:31 +0000 Subject: [PATCH] sdl: ensure auto-play save and battery backup save is saved on quit hotkey scons: use g++ by default utils: update to latest upstream backward-cpp --- trunk/SConstruct | 2 +- trunk/src/drivers/sdl/input.cpp | 1 + trunk/src/utils/backward.hpp | 44 ++++++++++++++++++++------------- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/trunk/SConstruct b/trunk/SConstruct index 7b401786..caa4c835 100644 --- a/trunk/SConstruct +++ b/trunk/SConstruct @@ -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') diff --git a/trunk/src/drivers/sdl/input.cpp b/trunk/src/drivers/sdl/input.cpp index e5342c87..fa277360 100644 --- a/trunk/src/drivers/sdl/input.cpp +++ b/trunk/src/drivers/sdl/input.cpp @@ -716,6 +716,7 @@ static void KeyboardCommands () } else { + CloseGame(); FCEUI_Kill(); SDL_Quit(); exit(0); diff --git a/trunk/src/utils/backward.hpp b/trunk/src/utils/backward.hpp index b88e75a5..80a2330f 100644 --- a/trunk/src/utils/backward.hpp +++ b/trunk/src/utils/backward.hpp @@ -1,6 +1,6 @@ /* * backward.hpp - * Copyright © 2013 François-Xavier 'Bombela' Bourlet + * Copyright 2013 Google Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -145,6 +145,7 @@ # if BACKWARD_HAS_UNWIND == 1 + # include // while gcc's unwind.h defines something like that: // extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *); @@ -161,8 +162,10 @@ #ifdef __CLANG_UNWIND_H // In fact, this function still comes from libgcc (on my different linux boxes, // clang links against libgcc). +# include extern "C" uintptr_t _Unwind_GetIPInfo(_Unwind_Context*, int*); #endif + # endif # include @@ -387,8 +390,8 @@ public: /*************** A TRACE ***************/ struct Trace { - void* addr; - size_t idx; + void* addr; + unsigned idx; Trace(): addr(0), idx(0) {} @@ -473,8 +476,8 @@ struct ResolvedTrace: public TraceWithLocals { struct SourceLoc { std::string function; std::string filename; - size_t line; - size_t col; + unsigned line; + unsigned col; SourceLoc(): line(0), col(0) {} @@ -525,7 +528,7 @@ public: Trace operator[](size_t) { return Trace(); } size_t load_here(size_t=0) { return 0; } size_t load_from(void*, size_t=0) { return 0; } - size_t thread_id() const { return 0; } + unsigned thread_id() const { return 0; } }; #ifdef BACKWARD_SYSTEM_LINUX @@ -534,7 +537,7 @@ class StackTraceLinuxImplBase { public: StackTraceLinuxImplBase(): _thread_id(0), _skip(0) {} - size_t thread_id() const { + unsigned thread_id() const { return _thread_id; } @@ -1055,7 +1058,7 @@ private: bfd_symtab_t dynamic_symtab; }; - typedef typename details::hashtable::type + typedef details::hashtable::type fobj_bfd_map_t; fobj_bfd_map_t _fobj_bfd_map; @@ -1068,7 +1071,7 @@ private: _bfd_loaded = true; } - typename fobj_bfd_map_t::iterator it = + fobj_bfd_map_t::iterator it = _fobj_bfd_map.find(filename_object); if (it != _fobj_bfd_map.end()) { return it->second; @@ -1426,16 +1429,23 @@ private: struct inliners_search_cb { void operator()(Dwarf_Die* die) { switch (dwarf_tag(die)) { + const char* name; case DW_TAG_subprogram: - trace.source.function = dwarf_diename(die)?:""; + if ((name = dwarf_diename(die))) { + trace.source.function = name; + } break; case DW_TAG_inlined_subroutine: ResolvedTrace::SourceLoc sloc; Dwarf_Attribute attr_mem; - sloc.function = dwarf_diename(die)?:""; - sloc.filename = die_call_file(die)?:""; + if ((name = dwarf_diename(die))) { + trace.source.function = name; + } + if ((name = die_call_file(die))) { + sloc.filename = name; + } Dwarf_Word line = 0, col = 0; dwarf_formudata(dwarf_attr(die, DW_AT_call_line, @@ -1857,14 +1867,14 @@ public: fprintf(os, "Stack trace (most recent call last)"); if (st.thread_id()) { - fprintf(os, " in thread %zi:\n", st.thread_id()); + fprintf(os, " in thread %u:\n", st.thread_id()); } else { fprintf(os, ":\n"); } _resolver.load_stacktrace(st); - for (size_t trace_idx = st.size(); trace_idx > 0; --trace_idx) { - fprintf(os, "#%-2zi", trace_idx); + for (unsigned trace_idx = st.size(); trace_idx > 0; --trace_idx) { + fprintf(os, "#%-2u", trace_idx); bool already_indented = true; const ResolvedTrace trace = _resolver.resolve(st[trace_idx-1]); @@ -1940,8 +1950,8 @@ private: void print_source_loc(FILE* os, const char* indent, const ResolvedTrace::SourceLoc& source_loc, void* addr=0) { - fprintf(os, "%sSource \"%s\", line %zi, in %s", - indent, source_loc.filename.c_str(), source_loc.line, + fprintf(os, "%sSource \"%s\", line %i, in %s", + indent, source_loc.filename.c_str(), (int)source_loc.line, source_loc.function.c_str()); if (address and addr != 0) {