Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
2842aef7
Commit
2842aef7
authored
Oct 08, 2009
by
Sebastian Eichelbaum
Browse files
[CHANGE] - added possibility to disable the backtrace
parent
18d0e510
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
src/common/WException.cpp
src/common/WException.cpp
+10
-1
src/common/WException.h
src/common/WException.h
+13
-0
No files found.
src/common/WException.cpp
View file @
2842aef7
...
...
@@ -38,13 +38,22 @@
#include "WException.h"
/**
* initialize static member.
*/
bool
WException
::
noBacktrace
=
false
;
WException
::
WException
(
const
std
::
string
&
msg
)
:
exception
()
{
// initialize members
m_msg
=
msg
;
// print stacktrace and message
std
::
cerr
<<
"Exception thrown! Callstack's backtrace:"
<<
std
::
endl
<<
getBacktrace
()
<<
std
::
endl
;
// no backtrace?
if
(
!
noBacktrace
)
{
std
::
cerr
<<
"Exception thrown! Callstack's backtrace:"
<<
std
::
endl
<<
getBacktrace
()
<<
std
::
endl
;
}
}
...
...
src/common/WException.h
View file @
2842aef7
...
...
@@ -72,6 +72,15 @@ public:
*/
std
::
string
getBacktrace
()
const
;
/**
* Function disables backtraces. Please note that the backtrace can not be reactivated to avoid people from dis/enabling them
* at will.
*/
static
void
disableBacktrace
()
{
noBacktrace
=
true
;
}
protected:
/**
* Message given during throw.
...
...
@@ -84,6 +93,10 @@ protected:
*/
std
::
list
<
std
::
string
>
m_trace
;
/**
* True if the backtrace should NOT be printed.
*/
static
bool
noBacktrace
;
private:
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment