|
From: Carlo W. <li...@us...> - 2002-02-08 22:29:42
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2002-01-08 22:29:40 UTC
Modified files:
libcwd/Makefile.am libcwd/NEWS libcwd/bfd.cc libcwd/debug.cc
libcwd/include/libcw/Makefile.am libcwd/include/libcw/debug.h
Log message:
Added two environment variables to suppress (or enable) debug output
during initialization. This was requested by a user in order to be
able to suppress *all* debug output.
---------------------- diff included ----------------------
Index: src/libcwd/Makefile.am
diff -u src/libcwd/Makefile.am:1.45 src/libcwd/Makefile.am:1.46
--- src/libcwd/Makefile.am:1.45 Sat Feb 2 20:15:11 2002
+++ src/libcwd/Makefile.am Fri Feb 8 14:29:29 2002
@@ -21,6 +21,7 @@
libcwd_la_SOURCES = \
threading.cc \
elf32.cc \
+ environ.cc \
bfd.cc \
debug.cc \
debugmalloc.cc \
Index: src/libcwd/NEWS
diff -u src/libcwd/NEWS:1.66 src/libcwd/NEWS:1.67
--- src/libcwd/NEWS:1.66 Thu Feb 7 20:03:46 2002
+++ src/libcwd/NEWS Fri Feb 8 14:29:29 2002
@@ -10,6 +10,13 @@
allow the use of the testsuite together with --enable-libcwd-debug.
(You shouldn't use either unless you are hacking libcwd itself).
+ New are environment variables that influence libcwd.
+ At the moment there are two:
+ LIBCWD_NO_STARTUP_MSGS : Don't print anything before main().
+ LIBCWD_ALWAYS_PRINT_LOADING : Print messages about loading
+ the shared libraries, even when this is done before libcw_do
+ is turned on (except when LIBCWD_NO_STARTUP_MSGS is defined).
+
Miscellaneous:
- The configuration option --disable-libcwd-location is fixed.
- Automake-1.5 now works.
Index: src/libcwd/bfd.cc
diff -u src/libcwd/bfd.cc:1.99 src/libcwd/bfd.cc:1.100
--- src/libcwd/bfd.cc:1.99 Sat Feb 2 20:15:11 2002
+++ src/libcwd/bfd.cc Fri Feb 8 14:29:29 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/bfd.cc,v 1.99 2002/02/03 04:15:11 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/bfd.cc,v 1.100 2002/02/08 22:29:29 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -11,7 +11,6 @@
// packaging of this file.
//
-#define ALWAYS_PRINT_LOADING // Define to temporally turn on dc::bfd in order to print the "Loading debug info from ..." lines.
#undef DEBUGDEBUGBFD // Define to add debug code for this file.
#include <libcw/debug_config.h>
@@ -964,13 +963,14 @@
init_debugmalloc();
#endif
-#ifdef ALWAYS_PRINT_LOADING
- // We want debug output to BFD
libcw::debug::debug_ct::OnOffState state;
- Debug( libcw_do.force_on(state) );
libcw::debug::channel_ct::OnOffState state2;
- Debug( dc::bfd.force_on(state2, "BFD") );
-#endif
+ if (_private_::always_print_loading && !_private_::suppress_startup_msgs)
+ {
+ // We want debug output to BFD
+ Debug( libcw_do.force_on(state) );
+ Debug( dc::bfd.force_on(state2, "BFD") );
+ }
// Initialize object files list, we don't really need the
// write lock because this function is Single Threaded.
@@ -1054,10 +1054,11 @@
// We put this outside the 'internal' region because it might call __pthread_do_exit.
LIBCWD_CLEANUP_POP_RESTORE(false)
-#ifdef ALWAYS_PRINT_LOADING
- Debug( dc::bfd.restore(state2) );
- Debug( libcw_do.restore(state) );
-#endif
+ if (_private_::always_print_loading)
+ {
+ Debug( dc::bfd.restore(state2) );
+ Debug( libcw_do.restore(state) );
+ }
WST_initialized = true; // MT: Safe, this function is Single Threaded.
Index: src/libcwd/debug.cc
diff -u src/libcwd/debug.cc:1.63 src/libcwd/debug.cc:1.64
--- src/libcwd/debug.cc:1.63 Thu Feb 7 20:03:46 2002
+++ src/libcwd/debug.cc Fri Feb 8 14:29:29 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/debug.cc,v 1.63 2002/02/08 04:03:46 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/debug.cc,v 1.64 2002/02/08 22:29:29 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -265,6 +265,7 @@
#ifdef LIBCWD_THREAD_SAFE
_private_::initialize_global_mutexes();
#endif
+ _private_::process_environment_variables();
// Fatal channels need to be marked fatal, otherwise we get into an endless loop
// when they are used before they are created.
@@ -292,7 +293,7 @@
if (getrlimit(RLIMIT_CORE, &corelim))
DoutFatal(dc::fatal|error_cf, "getrlimit(RLIMIT_CORE, &corelim)");
corelim.rlim_cur = corelim.rlim_max;
- if (corelim.rlim_max != RLIM_INFINITY)
+ if (corelim.rlim_max != RLIM_INFINITY && !_private_::suppress_startup_msgs)
{
debug_ct::OnOffState state;
libcw_do.force_on(state);
@@ -304,10 +305,13 @@
if (setrlimit(RLIMIT_CORE, &corelim))
DoutFatal(dc::fatal|error_cf, "unlimit core size failed");
#else
- debug_ct::OnOffState state;
- libcw_do.force_on(state);
- Dout(dc::warning, "Please unlimit core size manually");
- libcw_do.restore(state);
+ if (!_private_::suppress_startup_msgs)
+ {
+ debug_ct::OnOffState state;
+ libcw_do.force_on(state);
+ Dout(dc::warning, "Please unlimit core size manually");
+ libcw_do.restore(state);
+ }
#endif
#ifdef DEBUGUSEBFD
Index: src/libcwd/include/libcw/Makefile.am
diff -u src/libcwd/include/libcw/Makefile.am:1.22 src/libcwd/include/libcw/Makefile.am:1.23
--- src/libcwd/include/libcw/Makefile.am:1.22 Thu Jan 24 13:16:09 2002
+++ src/libcwd/include/libcw/Makefile.am Fri Feb 8 14:29:29 2002
@@ -39,6 +39,7 @@
private_allocator.h \
private_assert.h \
private_debug_stack.h \
+ private_environ.h \
private_internal_string.h \
private_internal_stringstream.h \
private_internal_vector.h \
Index: src/libcwd/include/libcw/debug.h
diff -u src/libcwd/include/libcw/debug.h:1.40 src/libcwd/include/libcw/debug.h:1.41
--- src/libcwd/include/libcw/debug.h:1.40 Fri Jan 18 21:08:54 2002
+++ src/libcwd/include/libcw/debug.h Fri Feb 8 14:29:29 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/debug.h,v 1.40 2002/01/19 05:08:54 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/debug.h,v 1.41 2002/02/08 22:29:29 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -226,6 +226,7 @@
#include <libcw/macro_ForAllDebugChannels.h>
#include <libcw/macro_ForAllDebugObjects.h>
+#include <libcw/private_environ.h>
// Include the inline functions.
#include <libcw/class_channel.inl> // Debug channels.
----------------------- End of diff -----------------------
|