mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-14 10:58:03 +02:00
Add backtrace test app.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
This commit is contained in:
parent
ab28e34983
commit
5ce3b93c71
4 changed files with 68 additions and 2 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
59
test/manual-backtrace.c
Normal file
59
test/manual-backtrace.c
Normal file
|
|
@ -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;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue