Make WvStreams compile with gcc 4.4.
[wvstreams.git] / include / wvcrash.h
blob8dbd81e7fff5faf246e1331a0bf94fb51b4e0828
1 /* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
5 * Routines to generate a stack backtrace automatically when a program
6 * crashes.
7 */
8 #ifndef __WVCRASH_H
9 #define __WVCRASH_H
11 #include <sys/types.h>
13 void wvcrash_setup(const char *_argv0, const char *_desc = 0);
14 void wvcrash(int sig);
15 void wvcrash_add_signal(int sig);
17 // Leave a last will and testament in the WvCrash, if your program dies.
18 void wvcrash_leave_will(const char *will);
19 // Read the will back.
20 const char *wvcrash_read_will();
21 // Read the assertion back.
22 const char *wvcrash_read_assert();
25 class IWvStream;
27 struct WvCrashInfo
29 // This is kind of ugly and used only for the guts of WvStreams,
30 // but it's a significant rather than a premature optimization,
31 // unfortunately.
32 static IWvStream *in_stream;
33 static const char *in_stream_id;
34 static enum InStreamState {
35 UNUSED,
36 PRE_SELECT,
37 POST_SELECT,
38 EXECUTE,
39 } in_stream_state;
42 const int wvcrash_ring_buffer_order = 12;
43 const int wvcrash_ring_buffer_size = 1 << wvcrash_ring_buffer_order;
44 void wvcrash_ring_buffer_put(const char *str);
45 void wvcrash_ring_buffer_put(const char *str, size_t len);
46 const char *wvcrash_ring_buffer_get();
48 #if defined(_WIN32)
49 extern void setup_console_crash();
50 #endif
52 #endif // __WVCRASH_H