backtrace_bsd.patch

Small patch for the Linux backtrace() functionality. - Spex, 12/07/2009 08:14 pm

Download (2.2 kB)

nel/src/misc/dynloadlib.cpp (working copy)
215 215
	// MTR: some new error handling. Just logs if it couldn't load the handle.
216 216
	if(_LibHandle == NULL) {
217 217
#ifdef NL_OS_UNIX
218
		char *errormsg=dlerror();
218
		const char *errormsg=dlerror();
219 219
#else
220 220
		const char *errormsg="Verify DLL existence";
221 221
#endif
nel/src/misc/CMakeLists.txt (working copy)
2 2

3 3
IF(NOT WIN32)
4 4
  ADD_LIBRARY(nelmisc SHARED ${SRC})
5
  # check for presence of execinfo.h, which contains the definitions
6
  # of backtrace() and backtrace_symbols()
7
  CHECK_INCLUDE_FILES(execinfo.h NL_HAVE_EXECINFO)
8
  IF(NL_HAVE_EXECINFO)
9
    # *BSD variants don't offer backtrace(), but there is a small
10
    # library containing these functions. Add it to the library
11
    # list for linking, if present
12
    CHECK_LIBRARY_EXISTS(execinfo backtrace "" NL_HAVE_EXECINFO_LIB)
13
    IF(NL_HAVE_EXECINFO_LIB)
14
      TARGET_LINK_LIBRARIES(nelmisc execinfo)
15
    ENDIF(NL_HAVE_EXECINFO_LIB)
16
  ENDIF(NL_HAVE_EXECINFO)
5 17
ELSE(NOT WIN32)
6 18
  ADD_LIBRARY(nelmisc STATIC ${SRC})
7 19
ENDIF(NOT WIN32)
nel/src/misc/debug.cpp (working copy)
55 55
#	include <cstdio>
56 56
#	include <cstdlib>
57 57
#	define IsDebuggerPresent() false
58
#   ifndef NL_OS_MAC
58
#   ifdef NL_HAVE_EXECINFO
59 59
#	    include <execinfo.h>
60 60
#   endif
61 61
//#	include <malloc.h>
......
606 606
		}
607 607
		SymCleanup(getProcessHandle());
608 608
		*/
609
#elif !defined(NL_OS_MAC)
609
#elif defined(NL_HAVE_EXECINFO)
610 610
		// Make place for stack frames and function names
611 611
		const uint MaxFrame=64;
612 612
		void *trace[MaxFrame];
......
1033 1033
	{
1034 1034
		result += e.what();
1035 1035
	}
1036
#elif !defined(NL_OS_MAC)
1036
#elif defined(NL_HAVE_EXECINFO)
1037 1037
	// Make place for stack frames and function names
1038 1038
	const uint MaxFrame=64;
1039 1039
	void *trace[MaxFrame];