00001 /* GLIB - Library of useful routines for C programming 00002 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the 00016 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 * Boston, MA 02111-1307, USA. 00018 */ 00019 00020 /* 00021 * Modified by the GLib Team and others 1997-2000. See the AUTHORS 00022 * file for a list of people on the GLib Team. See the ChangeLog 00023 * files for a list of changes. These files are distributed with 00024 * GLib at ftp://ftp.gtk.org/pub/gtk/. 00025 */ 00026 00027 #ifndef __G_BACKTRACE_H__ 00028 #define __G_BACKTRACE_H__ 00029 00030 #include <g_types.h> 00031 00032 G_BEGIN_DECLS 00033 00034 /* Fatal error handlers. 00035 * g_on_error_query() will prompt the user to either 00036 * [E]xit, [H]alt, [P]roceed or show [S]tack trace. 00037 * g_on_error_stack_trace() invokes gdb, which attaches to the current 00038 * process and shows a stack trace. 00039 * These function may cause different actions on non-unix platforms. 00040 * The prg_name arg is required by gdb to find the executable, if it is 00041 * passed as NULL, g_on_error_query() will try g_get_prgname(). 00042 */ 00043 void g_on_error_query (const gchar *prg_name); 00044 void g_on_error_stack_trace (const gchar *prg_name); 00045 00046 /* Hacker macro to place breakpoints for elected machines. 00047 * Actual use is strongly deprecated of course ;) 00048 */ 00049 #if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2 00050 # define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("int $03"); }G_STMT_END 00051 #elif defined (_MSC_VER) && defined (_M_IX86) 00052 # define G_BREAKPOINT() G_STMT_START{ __asm int 3h }G_STMT_END 00053 #elif defined (__alpha__) && defined (__GNUC__) && __GNUC__ >= 2 00054 # define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("bpt"); }G_STMT_END 00055 #else /* !__i386__ && !__alpha__ */ 00056 # define G_BREAKPOINT() G_STMT_START{ raise (5 /* SIGTRAP */); }G_STMT_END 00057 #endif /* __i386__ */ 00058 00059 G_END_DECLS 00060 00061 #endif /* __G_BACKTRACE_H__ */