WvStreams
wvcrash.h
1 /* -*- Mode: C++ -*-
2  * Worldvisions Weaver Software:
3  * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4  *
5  * Routines to generate a stack backtrace automatically when a program
6  * crashes.
7  */
8 #ifndef __WVCRASH_H
9 #define __WVCRASH_H
10 
11 #include <sys/types.h>
12 
13 void wvcrash_setup(const char *_argv0, const char *_desc = 0);
14 void wvcrash(int sig);
15 void wvcrash_add_signal(int sig);
16 
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();
23 
24 
25 class IWvStream;
26 
28 {
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;
40 };
41 
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();
47 
48 #if defined(_WIN32)
49 extern void setup_console_crash();
50 #endif
51 
52 #endif // __WVCRASH_H
IWvStream
Definition: iwvstream.h:24
WvCrashInfo
Definition: wvcrash.h:27