OpendTect  6.6
debug.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: A.H.Lammertink
8  Date: Jun 2003
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "basicmod.h"
15 #include "gendefs.h"
16 #include "bufstring.h"
17 
18 namespace google_breakpad { class ExceptionHandler; }
19 
32 namespace DBG
33 {
34  mGlobal(Basic) void turnOn( int flag );
36  mGlobal(Basic) bool isOn( int flag=0xffff );
37  mGlobal(Basic) void message(const char*);
38  mGlobal(Basic) void message(const char*, const char* cname,
39  const char* fname, int linrnr);
40  mGlobal(Basic) void message(int flag, const char* msg);
41  mGlobal(Basic) void message(int flag, const char*, const char* cname,
42  const char* fname, int linrnr);
43  mGlobal(Basic) void putProgInfo(int,char**);
45  mGlobal(Basic) void forceCrash(bool withdump);
46  mGlobal(Basic) bool crashOnNaN();
47  mGlobal(Basic) bool setCrashOnProgError(bool yn);
49 };
50 
51 extern "C" {
52 
53  mGlobal(Basic) int od_debug_isOn( int flag );
54  mGlobal(Basic) void od_debug_message( const char* msg );
55  mGlobal(Basic) void od_debug_messagef( int flag, const char* msg );
56  mGlobal(Basic) void od_debug_putProgInfo(int,char**);
57  mGlobal(Basic) void od_putProgInfo(int,char**);
58  mGlobal(Basic) void od_init_test_program(int,char**);
61 }
62 
63 # define pDebugMsg(msg) \
64  DBG::message(msg,::className(*this),__FILE__,__LINE__)
65 # define pFreeDebugMsg(msg) \
66  DBG::message(msg,__func__,__FILE__,__LINE__)
67 # define pFDebugMsg(flag,msg) \
68  DBG::message(flag,msg,::className(*this),__FILE__,__LINE__)
69 # define pFreeFDebugMsg(flag,msg) \
70  DBG::message(flag,msg,__func__,__FILE__,__LINE__)
71 
72 
73 namespace System
74 {
75 
79 {
80 public:
83 
84  bool isOK() const { return handler_; }
85 
86  void sendDump(const char* filename);
87 
88  void setSendAppl( const char* a ) { sendappl_ = a; }
89 
90  static FixedString sSenderAppl(); //None
91  static FixedString sUiSenderAppl(); //od_uiReportIssue
92 
93 private:
95 
96  void init();
97 
99 
101  google_breakpad::ExceptionHandler* handler_ = nullptr;
102 };
103 
104 } // namespace System
105 
106 
107 
108 /*
109  This is a list of reserved debug masks, in order to avoid conflicts.
110  Don't just throw any of these away or change a value, adding new masks
111  should be OK.
112 */
113 
114 #define DBG_DBG 0x0001 // general, low frequency stuff
115 #define DBG_MT 0x0002 // multi-threaded stuff
116 #define DBG_UI 0x0004 // ui-related stuff
117 #define DBG_IO 0x0008 // general I/O stuff
118 #define DBG_SOCKIO 0x0010 // socket I/O
119 #define DBG_MM 0x0020 // Multi-machine batch processing
120 #define DBG_SETTINGS 0x0040 // User settings
121 #define DBG_PROGSTART 0x0080 // Program start and stop
122 #define DBG_FILEPATH 0x0100 // File name handling, conversion, etc.
123 #define DGB_SERVICES 0x0200 // Network service managers
System::CrashDumper::sendappl_
BufferString sendappl_
Definition: debug.h:100
od_debug_putProgInfo
void od_debug_putProgInfo(int, char **)
mGlobal
#define mGlobal(module)
Definition: commondefs.h:180
google_breakpad
Definition: debug.h:18
System
Definition: debug.h:74
System::CrashDumper::isOK
bool isOK() const
Creates and installs at first run.
Definition: debug.h:84
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
System::CrashDumper::CrashDumper
CrashDumper()
System::CrashDumper::init
void init()
bufstring.h
DBG::message
void message(const char *)
default: to stderr
System::CrashDumper::theinst_
static CrashDumper * theinst_
Definition: debug.h:98
od_debug_isOn
int od_debug_isOn(int flag)
System::CrashDumper::sUiSenderAppl
static FixedString sUiSenderAppl()
System::CrashDumper::getInstance
static CrashDumper & getInstance()
DBG::setCrashOnProgError
bool setCrashOnProgError(bool yn)
Returns old status.
od_init_test_program
void od_init_test_program(int, char **)
gendefs.h
System::CrashDumper::sendDump
void sendDump(const char *filename)
FixedString
OD::String that holds an existing text string.
Definition: fixedstring.h:29
DBG::turnOn
void turnOn(int flag)
Overrides the envirnonment variable.
DBG::isOn
bool isOn(int flag=0xffff)
BufferString
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size.
Definition: bufstring.h:40
System::CrashDumper
Definition: debug.h:79
System::CrashDumper::setSendAppl
void setSendAppl(const char *a)
Definition: debug.h:88
od_debug_messagef
void od_debug_messagef(int flag, const char *msg)
DBG::putProgInfo
void putProgInfo(int, char **)
one line; more if isOn()
od_putProgInfo
void od_putProgInfo(int, char **)
System::CrashDumper::sSenderAppl
static FixedString sSenderAppl()
DBG::forceCrash
void forceCrash(bool withdump)
DBG
Defines a generic interface for supplying debug/runtime info.
Definition: debug.h:33
DBG::crashOnNaN
bool crashOnNaN()
od_debug_message
void od_debug_message(const char *msg)

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2021