Added check the conditions for building backtrace handler

(cherry picked from commit 35748811a4)
v3.5.13-sru
Alexander Golubev 11 years ago committed by Slávek Banko
parent 9d581b3f4c
commit 5bb41966db

@ -196,6 +196,7 @@ check_include_file( "termio.h" HAVE_TERMIO_H )
check_include_file( "unistd.h" HAVE_UNISTD_H ) check_include_file( "unistd.h" HAVE_UNISTD_H )
check_include_file( "util.h" HAVE_UTIL_H ) check_include_file( "util.h" HAVE_UTIL_H )
check_include_file( "values.h" HAVE_VALUES_H ) check_include_file( "values.h" HAVE_VALUES_H )
check_include_file( "demangle.h" HAVE_DEMANGLE_H )
# FIXME I'm not sure if test TIME_WITH_SYS_TIME are correct # FIXME I'm not sure if test TIME_WITH_SYS_TIME are correct
check_include_file( "sys/time.h" HAVE_SYS_TIME_H ) check_include_file( "sys/time.h" HAVE_SYS_TIME_H )

@ -650,6 +650,9 @@
/* Define to 1 if you have the <values.h> header file. */ /* Define to 1 if you have the <values.h> header file. */
#cmakedefine HAVE_VALUES_H 1 #cmakedefine HAVE_VALUES_H 1
/* Define to 1 if you have the <demangle.h> header file from binutils package. */
#cmakedefine HAVE_DEMANGLE_H 1
/* Define, to enable volume management (Solaris 2.x), if you have -lvolmgt */ /* Define, to enable volume management (Solaris 2.x), if you have -lvolmgt */
#undef HAVE_VOLMGT #undef HAVE_VOLMGT

@ -80,13 +80,18 @@ set( ${target}_SRCS
kdirnotify.cpp kdirnotify.skel kdirnotify_stub.cpp kdirnotify.cpp kdirnotify.skel kdirnotify_stub.cpp
observer.cpp ../misc/uiserver.stub observer.skel kemailsettings.cpp observer.cpp ../misc/uiserver.stub observer.skel kemailsettings.cpp
kprotocolinfo.cpp renamedlg.cpp skipdlg.cpp kremoteencoding.cpp kprotocolinfo.cpp renamedlg.cpp skipdlg.cpp kremoteencoding.cpp
kmimetypechooser.cpp backtrace_symbols.c kmimetypechooser.cpp
) )
if( HAVE_BACKTRACE AND HAVE_DEMANGLE_H )
list( APPEND ${target}_SRCS backtrace_symbols.c )
set( BACKTRACE_LIBRARY bfd )
endif( )
tde_add_library( ${target} STATIC_PIC AUTOMOC tde_add_library( ${target} STATIC_PIC AUTOMOC
SOURCES ${${target}_SRCS} SOURCES ${${target}_SRCS}
DEPENDENCIES dcopidl DEPENDENCIES dcopidl
LINK bfd LINK ${BACKTRACE_LIBRARY}
) )

@ -67,9 +67,9 @@
#endif #endif
#ifndef NDEBUG #ifndef NDEBUG
#ifdef HAVE_BACKTRACE
void print_trace() void print_trace()
{ {
#if defined(HAVE_BACKTRACE) && defined(HAVE_DEMANGLE_H)
void *array[10]; void *array[10];
size_t size; size_t size;
char **strings; char **strings;
@ -85,9 +85,9 @@ void print_trace()
} }
free (strings); free (strings);
#endif // defined(HAVE_BACKTRACE) && defined(HAVE_DEMANGLE_H)
} }
#endif #endif // NDEBUG
#endif
using namespace KIO; using namespace KIO;
@ -765,9 +765,7 @@ void SlaveBase::sigsegv_handler(int sig)
snprintf(buffer, sizeof(buffer), "kioslave: ####### CRASH ###### protocol = %s pid = %d signal = %d\n", s_protocol, getpid(), sig); snprintf(buffer, sizeof(buffer), "kioslave: ####### CRASH ###### protocol = %s pid = %d signal = %d\n", s_protocol, getpid(), sig);
write(2, buffer, strlen(buffer)); write(2, buffer, strlen(buffer));
#ifndef NDEBUG #ifndef NDEBUG
#ifdef HAVE_BACKTRACE
print_trace(); print_trace();
#endif
#endif #endif
::exit(1); ::exit(1);
#endif #endif

Loading…
Cancel
Save