1 |
schoenebeck |
270 |
/************************************************************************* |
2 |
|
|
* |
3 |
|
|
* $Id: stacktrace.h,v 1.1 2004-10-08 20:30:25 schoenebeck Exp $ |
4 |
|
|
* |
5 |
|
|
* Copyright (c) 1998 by Bjorn Reese <breese@mail1.stofanet.dk> |
6 |
|
|
* |
7 |
|
|
* Permission to use, copy, modify, and distribute this software for any |
8 |
|
|
* purpose with or without fee is hereby granted, provided that the above |
9 |
|
|
* copyright notice and this permission notice appear in all copies. |
10 |
|
|
* |
11 |
|
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED |
12 |
|
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
13 |
|
|
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND |
14 |
|
|
* CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. |
15 |
|
|
* |
16 |
|
|
************************************************************************ |
17 |
|
|
* |
18 |
|
|
* Purpose: |
19 |
|
|
* To generate a stacktrace of a program. |
20 |
|
|
* |
21 |
|
|
* Description: |
22 |
|
|
* If a debugger is located on the machine we will try this first, |
23 |
|
|
* as it usually give better information than built-in methods. |
24 |
|
|
* The debugger needs the name of the program to be able to attach |
25 |
|
|
* to it, so this must be passed to StackTraceInit(). The second |
26 |
|
|
* argument is a filedescriptor that StackTrace() writes to. If this |
27 |
|
|
* argument is -1 then standard output will be used. |
28 |
|
|
* |
29 |
|
|
* Compilation: |
30 |
|
|
* Some platforms have a built-in method to generate stacktraces, but |
31 |
|
|
* they are usually located in some non-standard library. The following |
32 |
|
|
* are supported: |
33 |
|
|
* |
34 |
|
|
* IRIX Compile with -DUSE_BUILTIN and -lexc |
35 |
|
|
* HP/UX Compile with -DUSE_BUILTIN and -lcl |
36 |
|
|
* GCC Compile with -DUSE_BUILTIN |
37 |
|
|
* |
38 |
|
|
************************************************************************/ |
39 |
|
|
|
40 |
|
|
#ifndef H_DEBUG_STACKTRACE |
41 |
|
|
#define H_DEBUG_STACKTRACE |
42 |
|
|
|
43 |
|
|
#if defined(__cplusplus) |
44 |
|
|
extern "C" { |
45 |
|
|
#endif // __cplusplus |
46 |
|
|
|
47 |
|
|
void StackTrace(void); |
48 |
|
|
void StackTraceInit(const char *progname, int handle); |
49 |
|
|
|
50 |
|
|
#if defined(__cplusplus) |
51 |
|
|
} |
52 |
|
|
#endif // __cplusplus |
53 |
|
|
|
54 |
|
|
#endif /* H_DEBUG_STACKTRACE */ |