2 * (C) 2008 by Daniel Willmann <daniel@totalueberwachung.de>
3 * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
4 * (C) 2009-2010 by Harald Welte <laforge@gnumonks.org>
5 * (C) 2010 by Nico Golde <nico@ngolde.de>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * \brief Routines realted to generating call back traces
31 #include <osmocom/core/utils.h>
34 #ifdef HAVE_EXECINFO_H
37 /*! \brief Generate and print a call back-trace
39 * This function will generate a function call back-trace of the
40 * current process and print it to stdout
42 void osmo_generate_backtrace(void)
48 nptrs
= backtrace(buffer
, ARRAY_SIZE(buffer
));
49 printf("backtrace() returned %d addresses\n", nptrs
);
51 strings
= backtrace_symbols(buffer
, nptrs
);
55 for (i
= 1; i
< nptrs
; i
++)
56 printf("%s\n", strings
[i
]);
61 void osmo_generate_backtrace(void)