API Documentation
Loading...
Searching...
No Matches
StackTracer.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Base
28File: LogMessage
29Included in API: False
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/String.h>
34#ifdef _WIN32
35 #include <vector>
36 #include <map>
37 #include <Windows.h>
38 #include <string>
39
40#endif
41namespace NDEVR
42{
43 /**--------------------------------------------------------------------------------------------------
44 \brief Used with StackTracer to track a specific function call in a stack trace.
45 **/
52 /**--------------------------------------------------------------------------------------------------
53 \brief Traces the stack to give the call-stack of a thrown exception.
54 **/
56 {
57 public:
58#ifdef _WIN32
59 static LONG ExceptionFilter(LPEXCEPTION_POINTERS e);
60 static DWORD GetExceptionCode();
61#endif
62 // return the exception message along with call stacks
65
66 // Return exception code and call stack data structure so that
67 // user could customize their own message format
70
71 private:
72 static StackTracer s_StackTracer;
73
74 private:
75 StackTracer(void);
76 ~StackTracer(void);
77#ifdef _WIN32
78 // The main function to handle exception
79 LONG __stdcall HandleException(LPEXCEPTION_POINTERS e);
80
81 // Work through the stack upwards to get the entire call stack
82 void traceCallStack(CONTEXT* pContext);
83#endif
84 private:
85#ifdef _WIN32
86 DWORD m_dwExceptionCode = 0;
87 typedef std::map<DWORD, const char*> CodeDescMap;
88 CodeDescMap m_mapCodeDesc;
89 DWORD m_dwMachineType = 0; // Machine type matters when trace the call stack (StackWalk64)
90#endif
91 Buffer<FunctionCall> m_call_stack;
92
93 };
94}
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
Traces the stack to give the call-stack of a thrown exception.
Definition StackTracer.h:56
static String GetExceptionMessage()
static Buffer< FunctionCall > GetExceptionCallStack()
String callStack() const
static DWORD GetExceptionCode()
static String GetCallStack()
static LONG ExceptionFilter(LPEXCEPTION_POINTERS e)
The core String class for the NDEVR API.
Definition String.h:69
Definition ACIColor.h:37
Used with StackTracer to track a specific function call in a stack trace.
Definition StackTracer.h:47
String FileName
Definition StackTracer.h:49
String FunctionName
Definition StackTracer.h:48
int LineNumber
Definition StackTracer.h:50