CACAO
Debug.cpp
Go to the documentation of this file.
1 /* src/toolbox/Debug.cpp - core debugging facilities
2 
3  Copyright (C) 1996-2013
4  CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5 
6  This file is part of CACAO.
7 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2, or (at
11  your option) any later version.
12 
13  This program is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  02110-1301, USA.
22 
23 */
24 
25 #include "toolbox/Debug.hpp"
26 
27 // TODO conditional Makefile.am
28 #ifdef ENABLE_LOGGING
29 
30 namespace cacao {
31 
32 Option<const char*> Debug::debugname("DebugName","Name of the subsystem to debug", NULL, option::xx_root());
33 
34 Option<bool> Debug::prefix_enabled("DebugPrefix","print debug prefix",false,option::xx_root());
35 
36 Option<unsigned int> Debug::verbose("DebugVerbose", "verbosity level for debugging (default=0)", 0 , option::xx_root());
37 
38 Option<bool> Debug::thread_enabled("DebugPrintThread","print thread id",false,option::xx_root());
39 
40 bool Debug::is_debugging_enabled(const char *name, size_t sz) {
41  const char* current_system_name = debugname.get();
42  if (!current_system_name) {
43  return false;
44  }
45  size_t current_system_name_size = std::strlen(current_system_name);
46  return (current_system_name_size <= sz) &&
47  (std::strncmp(name, current_system_name, current_system_name_size) == 0);
48 }
49 
50 } // end namespace cacao
51 
52 #endif
53 
54 /*
55  * These are local overrides for various environment variables in Emacs.
56  * Please do not remove this and leave it at the end of the file, where
57  * Emacs will automagically detect them.
58  * ---------------------------------------------------------------------
59  * Local variables:
60  * mode: c++
61  * indent-tabs-mode: t
62  * c-basic-offset: 4
63  * tab-width: 4
64  * End:
65  * vim:noexpandtab:sw=4:ts=4:
66 */
JNIEnv jclass jobject const char * name
Definition: jvmti.h:312
bool verbose
OptionPrefix & xx_root()
Definition: Option.cpp:39