]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
Add backtrace test app.
authorRalf Habacker <ralf.habacker@freenet.de>
Tue, 17 Nov 2015 13:30:54 +0000 (14:30 +0100)
committerRalf Habacker <ralf.habacker@freenet.de>
Tue, 17 Nov 2015 13:30:54 +0000 (14:30 +0100)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
cmake/test/CMakeLists.txt
dbus/dbus-sysdeps.h
test/Makefile.am
test/manual-backtrace.c [new file with mode: 0644]

index eb4b1f10f58b7d77c763060eb37b06821eb552ff..633ad8981dca3cfb7d0db1b9b2f3576a9576e76c 100644 (file)
@@ -73,6 +73,7 @@ add_helper_executable(test-exit ${test-exit_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
 add_helper_executable(test-segfault ${test-segfault_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
 add_helper_executable(test-sleep-forever ${test-sleep-forever_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
 add_test_executable(manual-tcp ${manual-tcp_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
+add_helper_executable(manual-backtrace ${CMAKE_SOURCE_DIR}/../test/manual-backtrace.c dbus-1)
 if(WIN32)
     add_helper_executable(manual-paths ${manual-paths_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
 endif()
index bd0356e3660e0eb02e365e337fd034e95aa0723a..8ffa5deb8f6cd3365e97a57fddaac7b342ba47f1 100644 (file)
@@ -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,
index b7f40bb01dd625a2c07c2abbf4ad0a79c1853692..91224b28b498c7d2f4c5bc4aa9e1f9be80ded0f1 100644 (file)
@@ -110,6 +110,9 @@ test_refs_LDADD = libdbus-testutils.la $(GLIB_LIBS)
 test_syslog_SOURCES = internals/syslog.c
 test_syslog_LDADD = libdbus-testutils.la $(GLIB_LIBS)
 
+manual_backtrace_SOURCES = manual-backtrace.c
+manual_backtrace_LDADD = $(top_builddir)/dbus/libdbus-1.la
+
 manual_dir_iter_SOURCES = manual-dir-iter.c
 manual_dir_iter_LDADD = $(top_builddir)/dbus/libdbus-internal.la
 
@@ -132,9 +135,10 @@ installable_tests = \
        test-printf \
        $(NULL)
 installable_manual_tests = \
+       manual-backtrace \
        manual-dir-iter \
-        manual-tcp \
-        $(NULL)
+       manual-tcp \
+       $(NULL)
 
 if DBUS_WIN
 installable_manual_tests += manual-paths
diff --git a/test/manual-backtrace.c b/test/manual-backtrace.c
new file mode 100644 (file)
index 0000000..3bd470b
--- /dev/null
@@ -0,0 +1,59 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* test-backtrace.c backtrace test app
+ *
+ * Copyright (C) 2015 Ralf Habacker <ralf.habacker@freenet.de>
+ *
+ * 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 <dbus/dbus.h>
+#include <dbus/dbus-sysdeps.h>
+
+#include <stdio.h>
+
+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;
+}