Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoErrorStack.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2017 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (01 2010)
22**=======================================================================*/
23
24#if !defined(SO_ERROR_STACK_H)
25#define SO_ERROR_STACK_H
26
27#include <Inventor/errors/SoError.h>
28
46class SoErrorStack : public SoError
47{
48public:
49
54 {
55 int frameIndex; // Index of this frame in the callstack, 0 is top one.
56
57 SbString functionName; // Function reached in this frame.
58 int lineNumber; // Line number in the frame.
59
60 SbString moduleName; // Module which contains the function.
61 SbString moduleDescription; // More information about the module (Type, fullpath...)
62 };
63
70 static void setHandlerCallback(SoErrorCB *cb, void *data);
71
79
86 static void* getHandlerData();
87
92
96 virtual SoType getTypeId() const;
97
102 static void post();
103
112 std::vector< SoErrorStack::StackFrame > getStackFrames() const;
113
120
121 private:
122
123 // Initializes SoErrorStack class
124 static void initClass();
125 static void exitClass();
126
127private:
128
129 SoErrorStack();
130 virtual ~SoErrorStack();
131
132 // Signals handler.
133 static void signalHandler(int signo);
134
135 static SoType s_classTypeId; // Type id of SoDebugError class
136 static SoErrorCB* s_handlerCB; // Handler callback for class
137 static void* s_cbData; // User data for callback
138
139 typedef void (*tHandler)(int);
140
141 // We keep the old handlers in case of, if they are not null we'll call them
142 // in the handler.
143 static tHandler s_handlerSIGINT;
144 static tHandler s_handlerSIGILL;
145 static tHandler s_handlerSIGFPE;
146 static tHandler s_handlerSIGSEGV;
147 static tHandler s_handlerSIGTERM;
148 static tHandler s_handlerSIGABRT;
149
150 // Data for the custom callbacks.
151 std::vector< SoErrorStack::StackFrame > m_stack;
152 SbString m_decodedStack;
153};
154
155
156#endif // SO_ERROR_STACK_H
157
Class for smart character strings.
Definition SbString.h:202
Error handling base class.
Definition SoError.h:109
void SoErrorCB(const SoError *error, void *data)
Error handling callbacks are of this type.
Definition SoError.h:69
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Stack debugging ...
static void * getHandlerData()
Returns the handler callback data for the SoErrorStack class.
virtual SoType getTypeId() const
Returns the type identifier for an instance of SoErrorStack.
SbString getStack() const
This function returns a decoded version of the getStackFrames() function.
static SoType getClassTypeId()
Returns the type identifier for the SoErrorStack class.
static void setHandlerCallback(SoErrorCB *cb, void *data)
Sets the handler callback for the SoErrorStack class.
static void post()
Posts the current callstack to the application callback or to SoDebugError if the custom callback was...
static SoErrorCB * getHandlerCallback()
Returns the handler callback for the SoErrorStack class.
std::vector< SoErrorStack::StackFrame > getStackFrames() const
Returns the stack frames of the current callback stack.
Stores runtime type information.
Definition SoType.h:98
This struture contains the description of a stack frame.