VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vlMiniDumper.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2015 VT MAK
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vlutil/vlMachineTypes.h>
13 
14 // Preprocessor Directive which allows reuse in MAK RTI applications and VR-Link based applications.
15 #ifdef DtUSE_UTILITIES_NAMESPACE
16 #define DtMiniDumper Dt ## MAKRti ## MiniDumper
17 #endif
18 
19 #ifdef WIN32
20 
21 #if _MSC_VER < 1300
22 # define DECLSPEC_DEPRECATED
23 // VC6: change this path to your Platform SDK headers
24 # include "M:\\dev7\\vs\\devtools\\common\\win32sdk\\include\\dbghelp.h" // must be XP version of file
25 #else
26 // VC7: ships with updated headers
27 #define _WINSOCKAPI_
28 #include <windows.h>
29 # include "dbghelp.h"
30 #endif
31 
32 // based on dbghelp.h
33 typedef BOOL (WINAPI* MINIDUMPWRITEDUMP)( HANDLE hProcess, DWORD dwPid, HANDLE hFile,
34  MINIDUMP_TYPE DumpType, CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
35  CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
36  CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam );
37 
43 {
44 public:
45 
47  DtMiniDumper( const char* szAppName );
48 
49 protected:
50 
53  static LONG WINAPI TopLevelFilter( struct _EXCEPTION_POINTERS* pExceptionInfo );
54 
55 protected:
56 
57  static char* m_szAppName;
58 
59 };
60 
61 #define DtINIT_MINIDUMPER( execName ) DtMiniDumper miniDump( execName );
62 
63 #else // WIN32
64 
65 #include <map>
66 #include <string>
67 #include <signal.h>
68 #include <execinfo.h>
69 #include <ucontext.h>
70 
76 {
77 public:
78 
80  static void printCallStack( int sig, siginfo_t* info, void* secret );
81 
82 protected:
83 
86  static void initializeAddressSpace();
87 
89  static void objFileAndNameFromStack( char* stackEntry,
90  std::string& objFile, std::string& objFileName );
91 
93  static std::string lookupFileInfo( const std::string& objFile,
94  unsigned long offset );
95 
96 private:
97 
99  DtMiniDumper();
100 
101 protected:
102 
104  typedef std::map<std::string,unsigned long> AddressSpaceMap;
105 
108 
109 };
110 
112 typedef void (*SigActionCb)( int, siginfo_t*, void* );
113 
114 #define DtINIT_MINIDUMPER( unused ) \
115 { \
116  struct sigaction sa; \
117  sa.sa_sigaction = (SigActionCb) DtMiniDumper::printCallStack; \
118  sa.sa_flags = SA_SIGINFO; \
119  sigemptyset( &sa.sa_mask ); \
120  sigaction( SIGSEGV, &sa, 0 ); \
121 }
122 
123 #endif

Document ID: Generated on Tue Mar 1 02:56:17 EST 2016 from SVN revision 162687
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)