Changeset 2479


Ignore:
Timestamp:
Feb 24, 2013, 6:29:27 PM (6 years ago)
Author:
sam
Message:

base: on Linux and some other architectures, dump a stack trace before
crashing from an assertion failure.

Location:
trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/build/autotools/m4/lol-misc.m4

    r2395 r2479  
    3131    fi
    3232    AC_LANG_POP(C++)])
     33
     34dnl LOL_TRY_LDFLAGS (LDFLAGS, [ACTION-IF-WORKS], [ACTION-IF-FAILS])
     35dnl check if $CC supports a given set of ldflags
     36AC_DEFUN([LOL_TRY_LDFLAGS],
     37    [AC_MSG_CHECKING([if $CC supports $1 flags])
     38    save_LDFLAGS="$LDFLAGS"
     39    LDFLAGS="$1"
     40    AC_TRY_LINK([],[],[ac_cv_try_ldflags_ok=yes],[ac_cv_try_ldflags_ok=no])
     41    LDFLAGS="$save_LDFLAGS"
     42    AC_MSG_RESULT([$ac_cv_try_ldflags_ok])
     43    if test x"$ac_cv_try_ldflags_ok" = x"yes"; then
     44        ifelse([$2],[],[:],[$2])
     45    else
     46        ifelse([$3],[],[:],[$3])
     47    fi])
  • trunk/configure.ac

    r2451 r2479  
    6262
    6363
    64 AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
    6564dnl conditional builds
    6665AC_ARG_ENABLE(debug,
     
    7372  [  --enable-doc            build documentation (needs doxygen and LaTeX)])
    7473
     74
     75dnl  Common C headers
    7576AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h)
    7677AC_CHECK_HEADERS(fastmath.h pthread.h libutil.h util.h pty.h glob.h unistd.h)
     78AC_CHECK_HEADERS(execinfo.h)
    7779AC_CHECK_HEADERS(sys/ioctl.h sys/ptrace.h sys/stat.h sys/syscall.h sys/user.h)
    7880AC_CHECK_HEADERS(sys/wait.h)
     
    8183AC_CHECK_HEADERS(pam/pam_appl.h pam/pam_misc.h)
    8284
     85dnl  Common C++ headers
     86AC_LANG_PUSH(C++)
     87AC_CHECK_HEADERS(cxxabi.h)
     88AC_LANG_POP(C++)
     89
     90dnl  Common C functions
    8391AC_CHECK_FUNCS(getcwd _getcwd)
     92
    8493
    8594if test "${enable_debug}" = "yes"; then
     
    148157AM_CXXFLAGS="${AM_CXXFLAGS} ${REL} ${OPT}"
    149158
     159dnl  Debug symbols
     160LOL_TRY_LDFLAGS(-rdynamic, [AM_LDFLAGS="${AM_LDFLAGS} -rdynamic"])
     161
    150162dnl  Code qui fait des warnings == code de porc == deux baffes dans ta gueule
    151163LOL_TRY_CXXFLAGS(-Wall, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wall"])
     
    170182AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
    171183
     184
     185dnl  Unix-specific libutil
    172186AC_CHECK_LIB(util, forkpty,
    173187 [UTIL_LIBS="${UTIL_LIBS} -lutil"
     
    176190AC_CHECK_FUNCS(forkpty)
    177191
    178 dnl Are we on the PS3?
     192
     193dnl  GCC-specific symbol demangling
     194AC_LANG_PUSH(C++)
     195AC_TRY_LINK(
     196 [#include <cxxabi.h>],
     197 [abi::__cxa_demangle(NULL, 0, 0, NULL);],
     198 [AC_DEFINE(HAVE_CXA_DEMANGLE, 1, Define to 1 if abi::__cxa_demangle is available)])
     199AC_LANG_POP(C++)
     200
     201
     202dnl  Are we on the PS3?
    179203ac_cv_my_have_ps3="no"
    180204AC_CHECK_LIB(sysmodule_stub, cellSysmoduleLoadModule,
  • trunk/src/Makefile.am

    r2432 r2479  
    6868    generated/easymesh-scanner.cpp \
    6969    \
    70     base/hash.cpp base/log.cpp base/string.cpp \
     70    base/assert.cpp base/hash.cpp base/log.cpp base/string.cpp \
    7171    \
    7272    math/vector.cpp math/real.cpp math/half.cpp math/trig.cpp \
  • trunk/src/lol/base/assert.h

    r2409 r2479  
    3434#endif
    3535}
     36
     37extern void DumpStack();
    3638
    3739#define LOL_CALL(macro, args) macro args
     
    116118                                                  (__VA_ARGS__))), \
    117119                     (__VA_ARGS__)); \
     120            DumpStack(); \
    118121            DebugBreak(); \
    119122            Abort(); \
  • trunk/src/lol/base/map.h

    r2383 r2479  
    3636                    return m_array[i].m3;
    3737        /* XXX: this in an error! */
    38         ASSERT(0, "trying to read a non-existent key in map");
     38        ASSERT(0, "trying to read a nonexistent key in map");
    3939        return V();
    4040    }
  • trunk/src/lolcore.vcxproj

    r2432 r2479  
    9191    <ClCompile Include="audio.cpp" />
    9292    <ClCompile Include="camera.cpp" />
     93    <ClCompile Include="base\assert.cpp" />
    9394    <ClCompile Include="base\hash.cpp" />
    9495    <ClCompile Include="base\log.cpp" />
  • trunk/src/lolcore.vcxproj.filters

    r2432 r2479  
    271271      <Filter>gpu</Filter>
    272272    </ClCompile>
     273    <ClCompile Include="base\assert.cpp">
     274      <Filter>base</Filter>
     275    </ClCompile>
    273276    <ClCompile Include="base\hash.cpp">
    274277      <Filter>base</Filter>
Note: See TracChangeset for help on using the changeset viewer.