summaryrefslogtreecommitdiff
path: root/src/exceptionbase.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2008-03-04 19:26:24 +0000
committerMike Buland <eichlan@xagasoft.com>2008-03-04 19:26:24 +0000
commit57bbb6651bfc10d9f2404164e3303c3376dfc62c (patch)
tree90bac81adc231a92251ac2d540c0c9d75468f7d4 /src/exceptionbase.h
parentb1c614da6f0b248b18e83a014030b5bdfd9c09c6 (diff)
downloadlibbu++-57bbb6651bfc10d9f2404164e3303c3376dfc62c.tar.gz
libbu++-57bbb6651bfc10d9f2404164e3303c3376dfc62c.tar.bz2
libbu++-57bbb6651bfc10d9f2404164e3303c3376dfc62c.tar.xz
libbu++-57bbb6651bfc10d9f2404164e3303c3376dfc62c.zip
Added backtrace support to the Exception system. It's pretty simple, if it's
enabled, and the compiler/libc support it, then you just get backtraces, if not you get a message about it not being supported. It probably shouldn't be enabled in most production environments, since it does happen for every exception, and could be memory and time consuming.
Diffstat (limited to 'src/exceptionbase.h')
-rw-r--r--src/exceptionbase.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/exceptionbase.h b/src/exceptionbase.h
index 391e41d..4d1d2ff 100644
--- a/src/exceptionbase.h
+++ b/src/exceptionbase.h
@@ -12,6 +12,12 @@
12#include <exception> 12#include <exception>
13#include <stdarg.h> 13#include <stdarg.h>
14 14
15// This shouldn't normally be defined here, I don't think it's all that portable
16// and it also changes the class interface, we should find out how much of
17// an issue that is, we could just put in an empty getBacktrace() function for
18// when you don't have support for it...
19#define LIBBU_EXCEPTION_BACKTRACE
20
15namespace Bu 21namespace Bu
16{ 22{
17 /** 23 /**
@@ -83,9 +89,15 @@ namespace Bu
83 */ 89 */
84 void setWhat( const char *lpText ); 90 void setWhat( const char *lpText );
85 91
92 const char *getBacktrace() const throw();
93
86 private: 94 private:
87 int nErrorCode; /**< The code for the error that occured. */ 95 int nErrorCode; /**< The code for the error that occured. */
88 char *sWhat; /**< The text string telling people what went wrong. */ 96 char *sWhat; /**< The text string telling people what went wrong. */
97#ifdef LIBBU_EXCEPTION_BACKTRACE
98 char *sBT; /**< The backtrace text. */
99 void createBacktrace();
100#endif
89 }; 101 };
90} 102}
91 103