From 33d2575a6b5a97a1c05014f2f3b48e3633d4b005 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Mon, 16 Nov 2015 20:21:37 +0100 Subject: [PATCH 3/4] Add backtrace test app on windows. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721 --- cmake/test/CMakeLists.txt | 1 + dbus/dbus-sysdeps.h | 2 ++ test/manual-backtrace.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 test/manual-backtrace.c diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt index eb4b1f1..048d7f8 100644 --- a/cmake/test/CMakeLists.txt +++ b/cmake/test/CMakeLists.txt @@ -74,6 +74,7 @@ add_helper_executable(test-segfault ${test-segfault_SOURCES} ${DBUS_INTERNAL_LIB add_helper_executable(test-sleep-forever ${test-sleep-forever_SOURCES} ${DBUS_INTERNAL_LIBRARIES}) add_test_executable(manual-tcp ${manual-tcp_SOURCES} ${DBUS_INTERNAL_LIBRARIES}) if(WIN32) + add_helper_executable(manual-backtrace ${CMAKE_SOURCE_DIR}/../test/manual-backtrace.c ${DBUS_INTERNAL_LIBRARIES} dbus-1) add_helper_executable(manual-paths ${manual-paths_SOURCES} ${DBUS_INTERNAL_LIBRARIES}) endif() diff --git a/dbus/dbus-sysdeps.h b/dbus/dbus-sysdeps.h index 79a6cc7..67854e3 100644 --- a/dbus/dbus-sysdeps.h +++ b/dbus/dbus-sysdeps.h @@ -92,6 +92,7 @@ typedef struct DBusPipe DBusPipe; * @{ */ +DBUS_PRIVATE_EXPORT void _dbus_abort (void) _DBUS_GNUC_NORETURN; dbus_bool_t _dbus_check_setuid (void); @@ -516,6 +517,7 @@ dbus_bool_t _dbus_socketpair (DBusSocket *fd1, dbus_bool_t blocking, DBusError *error); +DBUS_PRIVATE_EXPORT void _dbus_print_backtrace (void); dbus_bool_t _dbus_become_daemon (const DBusString *pidfile, diff --git a/test/manual-backtrace.c b/test/manual-backtrace.c new file mode 100644 index 0000000..3dc1447 --- /dev/null +++ b/test/manual-backtrace.c @@ -0,0 +1,57 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ +/* test-backtrace.c backtrace test app + * + * Copyright (C) 2015 Ralf Habacker + * + * Licensed under the Academic Free License version 2.1 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "config.h" + +#include +#include + +void test2() +{ + _dbus_print_backtrace(); +} + +void test1() +{ + test2(); +} + +void test() +{ + test1(); +} + +int +main (int argc, char **argv) +{ + if (argc == 2) + { + fprintf(stderr, "dbus_abort test\n"); + _dbus_abort (); + } + else + { + test(); + } + return 0; +} -- 1.8.4.5