Class system and tools for the taskrambler framework.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

60 lines
1.3 KiB

/**
* \file
*
* \author The GNU Software Foundation.
*
* \copyright
* Copyright © 2014 The GNU Softare Foundation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
/* Obtain a backtrace and print it to stdout. */
#ifdef _WIN32
void
print_trace (void)
{
printf ("sorry, bo backtrace under Windows now!\n");
}
#else
#include <execinfo.h>
void
print_trace (void)
{
void * array[10];
size_t size;
char ** strings;
size_t i;
size = backtrace (array, 10);
strings = backtrace_symbols (array, size);
printf ("Obtained %zd stack frames.\n", size);
for (i = 0; i < size; i++)
printf ("%s\n", strings[i]);
free (strings);
}
#endif
// vim: set ts=4 sw=4: