Thread: [libcw-cvs] [CVS] Module src (Page 2)
Abandoned project
Status: Beta
Brought to you by:
libcw
|
From: Carlo W. <li...@us...> - 2001-12-27 05:17:46
|
CVSROOT : /cvsroot/libcw
Module : src
Branch tags: branch-threading
Commit time: 2001-11-27 05:17:46 UTC
Modified files:
Tag: branch-threading
libcwd/debug.cc libcwd/debugmalloc.cc libcwd/elf32.cc
Log message:
Fix compilation when configured with --disable-libcwd-location
---------------------- diff included ----------------------
Index: src/libcwd/debug.cc
diff -u src/libcwd/debug.cc:1.46.2.41 src/libcwd/debug.cc:1.46.2.42
--- src/libcwd/debug.cc:1.46.2.41 Fri Dec 7 18:06:22 2001
+++ src/libcwd/debug.cc Wed Dec 26 21:17:35 2001
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/debug.cc,v 1.46.2.41 2001/12/08 02:06:22 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/debug.cc,v 1.46.2.42 2001/12/27 05:17:35 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -899,7 +899,9 @@
channels::dc::malloc.NS_initialize("MALLOC");
channels::dc::continued.NS_initialize(continued_maskbit);
channels::dc::finish.NS_initialize(finish_maskbit);
+#ifdef DEBUGUSEBFD
channels::dc::bfd.NS_initialize("BFD");
+#endif
// What the heck, initialize all other debug channels too
channels::dc::warning.NS_initialize("WARNING");
channels::dc::notice.NS_initialize("NOTICE");
@@ -1292,14 +1294,24 @@
channel_set_st& debug_ct::operator|(fatal_channel_ct const&)
{
+#ifdef DEBUGUSEBFD
DoutFatal(dc::fatal, location_ct((char*)__builtin_return_address(0) + libcw::debug::builtin_return_address_offset) <<
" : Don't use Dout together with dc::core or dc::fatal! Use DoutFatal instead.");
+#else
+ DoutFatal(dc::core,
+ "Don't use Dout together with dc::core or dc::fatal! Use DoutFatal instead.");
+#endif
}
channel_set_st& debug_ct::operator&(channel_ct const&)
{
+#ifdef DEBUGUSEBFD
DoutFatal(dc::fatal, location_ct((char*)__builtin_return_address(0) + libcw::debug::builtin_return_address_offset) <<
- " : Use dc::core or dc::fatal together with DoutFatal.");
+ " : Use dc::core or dc::fatal together with DoutFatal.");
+#else
+ DoutFatal(dc::core,
+ "Use dc::core or dc::fatal together with DoutFatal.");
+#endif
}
namespace _private_ {
Index: src/libcwd/debugmalloc.cc
diff -u src/libcwd/debugmalloc.cc:1.61.2.47 src/libcwd/debugmalloc.cc:1.61.2.48
--- src/libcwd/debugmalloc.cc:1.61.2.47 Fri Dec 7 18:06:22 2001
+++ src/libcwd/debugmalloc.cc Wed Dec 26 21:17:35 2001
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/debugmalloc.cc,v 1.61.2.47 2001/12/08 02:06:22 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/debugmalloc.cc,v 1.61.2.48 2001/12/27 05:17:35 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -839,6 +839,7 @@
extern void demangle_symbol(char const* in, _private_::internal_string& out);
+#ifdef DEBUGUSEBFD
struct dm_location_ct : public location_ct {
void print_on(std::ostream& os) const;
friend _private_::no_alloc_ostream_ct& operator<<(_private_::no_alloc_ostream_ct& os, dm_location_ct const& data);
@@ -846,9 +847,11 @@
friend _private_::non_allocating_fake_ostream_using_write_ct const& operator<<(_private_::non_allocating_fake_ostream_using_write_ct const& os, dm_location_ct const& data);
#endif
};
+#endif // DEBUGUSEBFD
static char const* const twentyfive_spaces_c = " ";
+#ifdef DEBUGUSEBFD
_private_::no_alloc_ostream_ct& operator<<(_private_::no_alloc_ostream_ct& os, dm_location_ct const& data)
{
size_t len = strlen(data.M_filename);
@@ -887,7 +890,8 @@
write(2, twentyfive_spaces_c, cnt);
return raw_write;
}
-#endif
+#endif // DEBUGDEBUGOUTPUT
+#endif // DEBUGUSEBFD
void dm_alloc_ct::print_description(LIBCWD_TSD_PARAM) const
{
Index: src/libcwd/elf32.cc
diff -u src/libcwd/elf32.cc:1.20.2.21 src/libcwd/elf32.cc:1.20.2.22
--- src/libcwd/elf32.cc:1.20.2.21 Wed Dec 5 22:01:15 2001
+++ src/libcwd/elf32.cc Wed Dec 26 21:17:35 2001
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/elf32.cc,v 1.20.2.21 2001/12/06 06:01:15 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/elf32.cc,v 1.20.2.22 2001/12/27 05:17:35 libcw Exp $
//
// Copyright (C) 2001, by
//
@@ -18,7 +18,7 @@
#include <libcw/debug_config.h>
-#ifndef DEBUGUSEGNULIBBFD
+#if defined(DEBUGUSEBFD) && !defined(DEBUGUSEGNULIBBFD)
#include "sys.h"
#include <inttypes.h> // ISO C99 header, needed for int32_t etc.
@@ -1890,4 +1890,4 @@
} // namespace debug
} // namespace libcw
-#endif // !DEBUGUSEGNULIBBFD
+#endif // DEBUGUSEBFD && !DEBUGUSEGNULIBBFD
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-27 05:24:58
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2001-11-27 05:24:57 UTC
Modified files:
libcwd/debug.cc libcwd/elf32.cc
Log message:
Fix compilation when configured with --disable-libcwd-location
---------------------- diff included ----------------------
Index: src/libcwd/debug.cc
diff -u src/libcwd/debug.cc:1.47 src/libcwd/debug.cc:1.48
--- src/libcwd/debug.cc:1.47 Sat Sep 22 21:13:50 2001
+++ src/libcwd/debug.cc Wed Dec 26 21:24:47 2001
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/debug.cc,v 1.47 2001/09/23 04:13:50 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/debug.cc,v 1.48 2001/12/27 05:24:47 libcw Exp $
//
// Copyright (C) 2000, by
//
@@ -29,7 +29,7 @@
#endif
#endif // CWDEBUG
-RCSTAG_CC("$Id: debug.cc,v 1.47 2001/09/23 04:13:50 libcw Exp $")
+RCSTAG_CC("$Id: debug.cc,v 1.48 2001/12/27 05:24:47 libcw Exp $")
using namespace std;
@@ -500,7 +500,9 @@
channels::dc::malloc.initialize("MALLOC");
channels::dc::continued.initialize(continued_maskbit);
channels::dc::finish.initialize(finish_maskbit);
+#ifdef DEBUGUSEBFD
channels::dc::bfd.initialize("BFD");
+#endif
// What the heck, initialize all other debug channels too
channels::dc::warning.initialize("WARNING");
channels::dc::notice.initialize("NOTICE");
@@ -786,14 +788,24 @@
channel_set_st& debug_ct::operator|(fatal_channel_ct const&)
{
+#ifdef DEBUGUSEBFD
DoutFatal(dc::fatal, location_ct((char*)__builtin_return_address(0) + libcw::debug::builtin_return_address_offset) <<
" : Don't use Dout together with dc::core or dc::fatal! Use DoutFatal instead.");
+#else
+ DoutFatal(dc::core,
+ "Don't use Dout together with dc::core or dc::fatal! Use DoutFatal instead.");
+#endif
}
channel_set_st& debug_ct::operator&(channel_ct const&)
{
+#ifdef DEBUGUSEBFD
DoutFatal(dc::fatal, location_ct((char*)__builtin_return_address(0) + libcw::debug::builtin_return_address_offset) <<
- " : Use dc::core or dc::fatal together with DoutFatal.");
+ " : Use dc::core or dc::fatal together with DoutFatal.");
+#else
+ DoutFatal(dc::core,
+ "Use dc::core or dc::fatal together with DoutFatal.");
+#endif
}
void buf_st::init(char const* s, size_t l, bool first_time)
Index: src/libcwd/elf32.cc
diff -u src/libcwd/elf32.cc:1.26 src/libcwd/elf32.cc:1.27
--- src/libcwd/elf32.cc:1.26 Sat Sep 22 22:01:08 2001
+++ src/libcwd/elf32.cc Wed Dec 26 21:24:47 2001
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/elf32.cc,v 1.26 2001/09/23 05:01:08 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/elf32.cc,v 1.27 2001/12/27 05:24:47 libcw Exp $
//
// Copyright (C) 2001, by
//
@@ -18,7 +18,7 @@
#include <libcw/debug_config.h>
-#ifndef DEBUGUSEGNULIBBFD
+#if defined(DEBUGUSEBFD) && !defined(DEBUGUSEGNULIBBFD)
#include "sys.h"
#include <inttypes.h> // ISO C99 header, needed for int32_t etc.
@@ -33,7 +33,7 @@
#include <libcw/debug.h>
#include <libcw/elf32.h>
-RCSTAG_CC("$Id: elf32.cc,v 1.26 2001/09/23 05:01:08 libcw Exp $")
+RCSTAG_CC("$Id: elf32.cc,v 1.27 2001/12/27 05:24:47 libcw Exp $")
#define DEBUGELF32 0
#define DEBUGSTABS 0
@@ -1845,4 +1845,4 @@
} // namespace debug
} // namespace libcw
-#endif // !DEBUGUSEGNULIBBFD
+#endif // DEBUGUSEBFD && !DEBUGUSEGNULIBBFD
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-28 04:12:11
|
CVSROOT : /cvsroot/libcw
Module : src
Branch tags: branch-threading
Commit time: 2001-11-28 04:12:10 UTC
Modified files:
Tag: branch-threading
libcwd/documentation/Makefile libcwd/documentation/magic.dox
Added files:
Tag: branch-threading
libcwd/documentation/images/libcw_magic.png
libcwd/documentation/images/toc.png
libcwd/documentation/images/wink.gif
libcwd/documentation/images/buttons/lr_index.png
libcwd/documentation/images/buttons/lr_next.png
libcwd/documentation/images/buttons/lr_prev.png
libcwd/documentation/images/lines/cat.png
libcwd/documentation/images/lines/caterpil.png
libcwd/documentation/images/lines/ghost.png
libcwd/documentation/images/lines/hippo.png
libcwd/documentation/images/lines/mouse.png
libcwd/documentation/images/lines/owl.png
libcwd/documentation/images/lines/snail.png
libcwd/documentation/tutorial/.cvsignore
libcwd/documentation/tutorial/Makefile
libcwd/documentation/tutorial/channel.cc
libcwd/documentation/tutorial/faq.m4
libcwd/documentation/tutorial/hello_world.cc
libcwd/documentation/tutorial/index.m4
libcwd/documentation/tutorial/intro.m4
libcwd/documentation/tutorial/log_file.cc
libcwd/documentation/tutorial/tut1.m4
libcwd/documentation/tutorial/tut2.m4
libcwd/documentation/tutorial/tut3.m4
libcwd/documentation/tutorial/tut4.m4
libcwd/documentation/tutorial/tut5.m4
libcwd/documentation/tutorial/tut6.m4
libcwd/documentation/tutorial/tut7.m4
libcwd/documentation/tutorial/examples5/Makedefs.h
libcwd/documentation/tutorial/examples5/Makefile
libcwd/documentation/tutorial/examples5/README
libcwd/documentation/tutorial/examples5/sysinclude/README
libcwd/documentation/tutorial/examples5/sysinclude/libbooster/debug.h
libcwd/documentation/tutorial/examples5/sysinclude/libturbo/debug.h
libcwd/documentation/tutorial/examples5/tut5.1/.cvsignore
libcwd/documentation/tutorial/examples5/tut5.1/Makefile
libcwd/documentation/tutorial/examples5/tut5.2/.cvsignore
libcwd/documentation/tutorial/examples5/tut5.3/.cvsignore
libcwd/documentation/tutorial/examples5/tut5.3/Makefile
libcwd/documentation/tutorial/examples5/tut5.4/.cvsignore
libcwd/documentation/tutorial/examples5/tut5.4/Makefile
libcwd/documentation/tutorial/examples7/Makedefs.h
libcwd/documentation/tutorial/examples7/Makefile
libcwd/documentation/tutorial/examples7/debug.h
libcwd/documentation/tutorial/examples7/sys.h
libcwd/documentation/tutorial/examples7/tut7.1/.cvsignore
libcwd/documentation/tutorial/examples7/tut7.1/Makefile
libcwd/documentation/tutorial/examples7/tut7.2/.cvsignore
libcwd/documentation/tutorial/examples7/tut7.2/Makefile
libcwd/documentation/tutorial/examples7/tut7.3/.cvsignore
libcwd/documentation/tutorial/examples7/tut7.3/Makefile
Log message:
Added tutorial to the cvs. Using .png instead of .gif where possible.
---------------------- diff included ----------------------
Index: src/libcwd/documentation/Makefile
diff -u src/libcwd/documentation/Makefile:1.1.2.3 src/libcwd/documentation/Makefile:1.1.2.4
--- src/libcwd/documentation/Makefile:1.1.2.3 Wed Dec 26 21:13:21 2001
+++ src/libcwd/documentation/Makefile Thu Dec 27 20:11:58 2001
@@ -4,7 +4,9 @@
.PHONY: html external styles tutorial
-html: external styles tutorial
+all: html tutorial
+
+html: styles external
rm -rf html
doxygen doxygen.config
mv html/preparation.html html/preparation.tmp
Index: src/libcwd/documentation/images/buttons/lr_index.png
Index: src/libcwd/documentation/images/buttons/lr_next.png
Index: src/libcwd/documentation/images/buttons/lr_prev.png
Index: src/libcwd/documentation/images/libcw_magic.png
Index: src/libcwd/documentation/images/lines/cat.png
Index: src/libcwd/documentation/images/lines/caterpil.png
Index: src/libcwd/documentation/images/lines/ghost.png
Index: src/libcwd/documentation/images/lines/hippo.png
Index: src/libcwd/documentation/images/lines/mouse.png
Index: src/libcwd/documentation/images/lines/owl.png
Index: src/libcwd/documentation/images/lines/snail.png
Index: src/libcwd/documentation/images/toc.png
Index: src/libcwd/documentation/images/wink.gif
Index: src/libcwd/documentation/magic.dox
diff -u src/libcwd/documentation/magic.dox:1.1.2.3 src/libcwd/documentation/magic.dox:1.1.2.4
--- src/libcwd/documentation/magic.dox:1.1.2.3 Wed Dec 26 21:13:21 2001
+++ src/libcwd/documentation/magic.dox Thu Dec 27 20:11:58 2001
@@ -23,7 +23,7 @@
\htmlonly
<p STYLE="margin-left: 1.27cm"> <br>
-<img width=340 height=165 src="../images/libcw_magic.gif" alt="Memory layout of magic numbers" border=0>
+<img width=340 height=165 src="../images/libcw_magic.png" alt="Memory layout of magic numbers" border=0>
<br CLEAR=ALL> <br>
Figure 1. Memory layout of an allocated memory block with <CODE>DEBUGMAGICMALLOC</CODE> defined.
\endhtmlonly
Index: src/libcwd/documentation/tutorial/.cvsignore
diff -u /dev/null src/libcwd/documentation/tutorial/.cvsignore:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/.cvsignore Thu Dec 27 20:11:59 2001
@@ -0,0 +1,7 @@
+hello_world
+channel
+log_file
+turn_on
+amo.cc
+amo
+*.html
Index: src/libcwd/documentation/tutorial/Makefile
diff -u /dev/null src/libcwd/documentation/tutorial/Makefile:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/Makefile Thu Dec 27 20:11:59 2001
@@ -0,0 +1,40 @@
+.SUFFIXES:
+.PHONY: examples html
+
+FILES5:=$(shell grep 'START CODE' tut5.m4 | cut -d \ -f4)
+FILES7:=$(shell grep 'START CODE' tut7.m4 | cut -d \ -f4)
+
+all: examples html
+
+examples: $(FILES5) $(FILES7)
+html: index.html faq.html intro.html tut1.html tut2.html tut3.html tut4.html tut5.html tut6.html tut7.html
+
+%.html: %.m4 ../definitions.m4
+ m4 -D__TUTORIAL=1 -I.. $< > $@
+
+$(FILES5): tut5.m4 ../../.libs/libcwd.so
+ @$(MAKE) $@-x
+
+$(FILES7): tut7.m4 ../../.libs/libcwd.so
+ @$(MAKE) -s $@-x
+
+%-x:
+ @IN=`echo $* | sed -e 's/examples\([57]\).*/tut\1.m4/'`; \
+ grep -A1000 "START CODE $*" $$IN |\
+ grep -B1000 "END CODE $*" |\
+ egrep -v "(START|END) CODE $*" |\
+ sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' -e 's/"/"/g' -e 's/§/§/g' \
+ -e 's/<SPAN.[^>]*>//g' -e 's/<\/SPAN>//g' > $*.tmp; \
+ if (test ! -f $* || ! cmp -s $* $*.tmp); then \
+ echo "Extracting $* from $$IN."; \
+ mv $*.tmp $*; \
+ else \
+ echo "$* wasn't changed."; \
+ touch $*; \
+ rm $*.tmp; \
+ fi; \
+ OUT=`echo $(*F) | sed -e 's/\.[ch]*$$//'`; \
+ if test "$$OUT" != "debug"; then \
+ $(MAKE) -C $(*D) $$OUT; \
+ fi
+
Index: src/libcwd/documentation/tutorial/channel.cc
diff -u /dev/null src/libcwd/documentation/tutorial/channel.cc:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/channel.cc Thu Dec 27 20:11:59 2001
@@ -0,0 +1,26 @@
+// Compile as: g++ -g -DCWDEBUG channel.cc -lcwd [-lbfd -liberty [-ldl]]
+// Please see the "example-project" in the source distribution of libcwd
+// for a better Real Life example.
+
+#include <libcw/sysd.h>
+#define DEBUGCHANNELS ::example // Where we'll put our namespace dc
+#include <libcw/debug.h>
+
+#ifdef CWDEBUG
+namespace example { // namespace dc cannot be put in ::
+ namespace dc {
+ libcw::debug::channel_ct ghost("GHOST"); // Create our own Debug Channel
+ }
+}
+#endif
+
+int main(void)
+{
+ Debug( dc::ghost.on() ); // Remember: don't forget to turn
+ Debug( libcw_do.on() ); // the debug Channel and Object on!
+
+ for (int i = 0; i < 4; ++i)
+ Dout( dc::ghost, "i = " << i ); // We can write more than just
+ // "Hello World" to the ostream :)
+ return 0;
+}
Index: src/libcwd/documentation/tutorial/examples5/Makedefs.h
diff -u /dev/null src/libcwd/documentation/tutorial/examples5/Makedefs.h:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples5/Makedefs.h Thu Dec 27 20:11:59 2001
@@ -0,0 +1,107 @@
+# This file contains the Project specific variables.
+#
+# Extra parameters can be added to the following variables:
+#
+# CFLAGS, CXXFLAGS, INCLUDEFLAGS, SYSTEMINCLUDEFLAGS, LDFLAGS.
+#
+# Always use a += for these variables to *add* parameters rather
+# than overriding them!
+
+#
+# CFLAGS / CXXFLAGS
+#
+# Project specific compiler flags.
+#
+# Use this when profiling:
+
+##CFLAGS=-pg -O6 -pipe
+##CXXFLAGS=-pg -O6 -pipe -fno-exceptions
+##LDFLAGS=-pg
+
+# Add extra, project specific, defines here, etc.
+
+##CFLAGS+=-D__MYCLIB__
+CXXFLAGS+=-DCWDEBUG
+
+#
+# INCLUDEFLAGS
+#
+# Project specific "include" flags.
+#
+# These directories are searched when you use an #include "foobar.h"
+# in your source code.
+#
+# The given directories will be relative to the directory from which
+# the compiler is started, which is the directory that the source
+# file being compiled is in. Therefore always use -I$(BASEDIR) as
+# a prefix (BASEDIR is the directory this file is in).
+#
+# Note: If you want to add an include directory that is specific for
+# only one executable or library, you might want to add this -I flag
+# to the Makefile for that executable or library respectively instead.
+
+INCLUDEFLAGS+=-I$(BASEDIR)/tut5.2
+
+#
+# SYSTEMINCLUDEFLAGS
+#
+# Project specific system <include> flags.
+#
+# These directories are searched when you use a #include <foobar.h>
+# in your source code.
+#
+# Note: If you are writting a library, then you want to use
+# #include <yourlib/foobar.h> in your headerfiles, because later on
+# these header files are installed in /usr/local/include for instance.
+# In that case you need to add -I$(BASEDIR)/include *here* instead
+# to in INCLUDEFLAGS above.
+#
+
+SYSTEMINCLUDEFLAGS+=-I$(BASEDIR)/sysinclude -I$(BASEDIR)/../../../include
+
+#
+# LDFLAGS
+#
+# Project specific linker flags (Overridden flags: -s or -pg ...)
+#
+# These flags are passed to the compiler at link time, these flags
+# are given a default value in $(PROTODIR)/Makedefs.h. You can
+# override them here.
+#
+
+LIBPATH:=$(shell (cd $(BASEDIR)/../../../.libs; pwd))
+LDFLAGS=-Wl,-rpath,$(LIBPATH)
+
+#
+# LIBFLAGS
+#
+# Project specific linker flags (Persistent flags: -L and -Wl,...)
+#
+# If you want to link your (test) executables with the latest version of
+# your project library instead of the version that was actually installed
+# in /usr/local (for example), then you need to add -L$(BASEDIR)/lib to
+# LIBFLAGS.
+
+LIBFLAGS+=-L$(BASEDIR)/../../../.libs
+
+#
+# DFLAGS
+#
+# Extra flags for generating dependencies.
+# The default is -MM, only including "local" headers.
+# Use this if you need dependencies on <system> headers,
+# (for example when you are writing a library and are using <headers>
+# with angle brackets yourself).
+
+##DFLAGS=-M
+
+#
+# CPPEXT
+#
+# The C++ extension that is used in this project. Correct this!
+
+CPPEXT=.cc
+
+# Speed up
+.SUFFIXES:
+
Index: src/libcwd/documentation/tutorial/examples5/Makefile
diff -u /dev/null src/libcwd/documentation/tutorial/examples5/Makefile:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples5/Makefile Thu Dec 27 20:11:59 2001
@@ -0,0 +1,14 @@
+# List of subdirectories (automatically updated by `makeproto'):
+SUBDIRS=tut5.1 tut5.3 tut5.4
+
+#-----------------------------------------------------------------------------
+
+include $(PROTODIR)/base/PTMakefile
+
+# Add here project specific additions:
+
+#build::
+#depend::
+clean::
+ rm -rf tut5.2/debug.o example-*
+#real-clean::
Index: src/libcwd/documentation/tutorial/examples5/README
diff -u /dev/null src/libcwd/documentation/tutorial/examples5/README:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples5/README Thu Dec 27 20:11:59 2001
@@ -0,0 +1,10 @@
+In order to compile this you will need to have `prototype' installed.
+You can download `prototype' from http://www.xs4all.nl/~carlo17/prototype/
+
+
+Compile by typing:
+
+make
+
+This will create all executables from tutorial 5 in the current directory.
+
Index: src/libcwd/documentation/tutorial/examples5/sysinclude/README
diff -u /dev/null src/libcwd/documentation/tutorial/examples5/sysinclude/README:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples5/sysinclude/README Thu Dec 27 20:11:59 2001
@@ -0,0 +1,3 @@
+The header files in this directory are NOT examples of how
+to write correctly a library headerfile. They are only
+included to be able to test the rest.
Index: src/libcwd/documentation/tutorial/examples5/sysinclude/libbooster/debug.h
diff -u /dev/null src/libcwd/documentation/tutorial/examples5/sysinclude/libbooster/debug.h:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples5/sysinclude/libbooster/debug.h Thu Dec 27 20:11:59 2001
@@ -0,0 +1,14 @@
+#include <libcw/debug.h>
+
+namespace booster {
+ namespace debug {
+ namespace channels {
+ namespace dc {
+ using namespace libcw::debug;
+ using namespace libcw::debug::channels::dc;
+ extern channel_ct booster;
+ extern channel_ct foobar;
+ }
+ }
+ }
+}
Index: src/libcwd/documentation/tutorial/examples5/sysinclude/libturbo/debug.h
diff -u /dev/null src/libcwd/documentation/tutorial/examples5/sysinclude/libturbo/debug.h:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples5/sysinclude/libturbo/debug.h Thu Dec 27 20:11:59 2001
@@ -0,0 +1,20 @@
+#include <libcw/debug.h>
+
+namespace turbo {
+ namespace debug {
+ namespace channels {
+ namespace dc {
+ using namespace libcw::debug;
+ using namespace libcw::debug::channels::dc;
+ extern channel_ct turbo;
+ extern channel_ct foobar;
+ }
+ }
+ }
+}
+
+namespace libcw {
+ namespace debug {
+ using namespace turbo::debug;
+ }
+}
Index: src/libcwd/documentation/tutorial/examples5/tut5.1/.cvsignore
diff -u /dev/null src/libcwd/documentation/tutorial/examples5/tut5.1/.cvsignore:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples5/tut5.1/.cvsignore Thu Dec 27 20:11:59 2001
@@ -0,0 +1,2 @@
+turn_on.cc
+turn_on
Index: src/libcwd/documentation/tutorial/examples5/tut5.1/Makefile
diff -u /dev/null src/libcwd/documentation/tutorial/examples5/tut5.1/Makefile:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples5/tut5.1/Makefile Thu Dec 27 20:11:59 2001
@@ -0,0 +1,30 @@
+# Directory where the base Makefile resides:
+BASEDIR=..
+
+# List of source files (one per executable):
+CSRC=
+CXXSRC=turn_on.cc
+
+# List of subdirectories:
+SUBDIRS=
+
+# Extra static libraries to link with:
+STATICLIBS=
+
+# Extra shared libraries to link with:
+SHAREDLIBS=-lcwd
+
+# Put here extra -L... flags
+LIBFLAGS=
+
+# Extra *.o files that need to be linked:
+EXTRA_OBJS=
+
+#-----------------------------------------------------------------------------
+
+include $(PROTODIR)/test/PTMakefile
+
+build::
+ ln -f turn_on ../example-5.1
+#clean::
+#depend::
Index: src/libcwd/documentation/tutorial/examples5/tut5.2/.cvsignore
diff -u /dev/null src/libcwd/documentation/tutorial/examples5/tut5.2/.cvsignore:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples5/tut5.2/.cvsignore Thu Dec 27 20:11:59 2001
@@ -0,0 +1,3 @@
+debug.h
+debug.cc
+sys.h
Index: src/libcwd/documentation/tutorial/examples5/tut5.3/.cvsignore
diff -u /dev/null src/libcwd/documentation/tutorial/examples5/tut5.3/.cvsignore:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples5/tut5.3/.cvsignore Thu Dec 27 20:11:59 2001
@@ -0,0 +1,4 @@
+test1.cc
+test2.cc
+test1
+test2
Index: src/libcwd/documentation/tutorial/examples5/tut5.3/Makefile
diff -u /dev/null src/libcwd/documentation/tutorial/examples5/tut5.3/Makefile:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples5/tut5.3/Makefile Thu Dec 27 20:11:59 2001
@@ -0,0 +1,31 @@
+# Directory where the base Makefile resides:
+BASEDIR=..
+
+# List of source files (one per executable):
+CSRC=
+CXXSRC=test1.cc test2.cc
+
+# List of subdirectories:
+SUBDIRS=
+
+# Extra static libraries to link with:
+STATICLIBS=
+
+# Extra shared libraries to link with:
+SHAREDLIBS=-lcwd
+
+# Put here extra -L... flags
+LIBFLAGS=
+
+# Extra *.o files that need to be linked:
+EXTRA_OBJS=$(BASEDIR)/tut5.2/debug.o
+
+#-----------------------------------------------------------------------------
+
+include $(PROTODIR)/test/PTMakefile
+
+build::
+ ln -f test1 ../example-5.3.1
+ ln -f test2 ../example-5.3.2
+#clean::
+#depend::
Index: src/libcwd/documentation/tutorial/examples5/tut5.4/.cvsignore
diff -u /dev/null src/libcwd/documentation/tutorial/examples5/tut5.4/.cvsignore:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples5/tut5.4/.cvsignore Thu Dec 27 20:11:59 2001
@@ -0,0 +1,16 @@
+test1.cc
+test2.cc
+test3.cc
+test4.cc
+test5.cc
+test6.cc
+test7.cc
+test8.cc
+test1
+test2
+test3
+test4
+test5
+test6
+test7
+test8
Index: src/libcwd/documentation/tutorial/examples5/tut5.4/Makefile
diff -u /dev/null src/libcwd/documentation/tutorial/examples5/tut5.4/Makefile:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples5/tut5.4/Makefile Thu Dec 27 20:11:59 2001
@@ -0,0 +1,36 @@
+# Directory where the base Makefile resides:
+BASEDIR=..
+
+# List of source files (one per executable):
+CSRC=
+CXXSRC=test3.cc test4.cc test5.cc test6.cc test7.cc test8.cc
+
+# List of sub directories:
+SUBDIRS=
+
+# Extra static libraries to link with:
+STATICLIBS=
+
+# Extra shared libraries to link with:
+SHAREDLIBS=-lcwd
+
+# Put here extra -L... flags
+LIBFLAGS=
+
+# Extra *.o files that need to be linked:
+EXTRA_OBJS=$(BASEDIR)/tut5.2/debug.o
+
+#-----------------------------------------------------------------------------
+
+include $(PROTODIR)/test/PTMakefile
+
+build::
+ ln -f test3 ../example-5.4.1
+ ln -f test4 ../example-5.4.2
+ ln -f test5 ../example-5.4.3
+ ln -f test6 ../example-5.4.4
+ ln -f test7 ../example-5.4.5
+ ln -f test8 ../example-5.4.6
+
+#clean::
+#depend::
Index: src/libcwd/documentation/tutorial/examples7/Makedefs.h
diff -u /dev/null src/libcwd/documentation/tutorial/examples7/Makedefs.h:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples7/Makedefs.h Thu Dec 27 20:12:00 2001
@@ -0,0 +1,103 @@
+# This file contains the Project specific variables.
+#
+# Extra parameters can be added to the following variables:
+#
+# CFLAGS, CXXFLAGS, INCLUDEFLAGS, SYSTEMINCLUDEFLAGS, LDFLAGS.
+#
+# Always use a += for these variables to *add* parameters rather
+# than overriding them!
+
+#
+# CFLAGS / CXXFLAGS
+#
+# Project specific compiler flags.
+#
+# Use this when profiling:
+
+##CFLAGS=-pg -O6 -pipe
+##CXXFLAGS=-pg -O6 -pipe -fno-exceptions
+##LDFLAGS=-pg
+
+# Add extra, project specific, defines here, etc.
+
+##CFLAGS+=-D__MYCLIB__
+CXXFLAGS+=-DCWDEBUG
+
+#
+# INCLUDEFLAGS
+#
+# Project specific "include" flags.
+#
+# These directories are searched when you use an #include "foobar.h"
+# in your source code.
+#
+# The given directories will be relative to the directory from which
+# the compiler is started, which is the directory that the source
+# file being compiled is in. Therefore always use -I$(BASEDIR) as
+# a prefix (BASEDIR is the directory this file is in).
+#
+# Note: If you want to add an include directory that is specific for
+# only one executable or library, you might want to add this -I flag
+# to the Makefile for that executable or library respectively instead.
+
+INCLUDEFLAGS+=-I$(BASEDIR)
+
+#
+# SYSTEMINCLUDEFLAGS
+#
+# Project specific system <include> flags.
+#
+# These directories are searched when you use a #include <foobar.h>
+# in your source code.
+#
+# Note: If you are writting a library, then you want to use
+# #include <yourlib/foobar.h> in your headerfiles, because later on
+# these header files are installed in /usr/local/include for instance.
+# In that case you need to add -I$(BASEDIR)/include *here* instead
+# to in INCLUDEFLAGS above.
+#
+
+SYSTEMINCLUDEFLAGS+=-I$(BASEDIR)/sysinclude -I$(BASEDIR)/../../../include
+
+#
+# LDFLAGS
+#
+# Project specific linker flags (Overridden flags: -s or -pg ...)
+#
+# These flags are passed to the compiler at link time, these flags
+# are given a default value in $(PROTODIR)/Makedefs.h. You can
+# override them here.
+#
+
+LIBPATH:=$(shell (cd $(BASEDIR)/../../../.libs; pwd))
+LDFLAGS=-Wl,-rpath,$(LIBPATH)
+
+#
+# LIBFLAGS
+#
+# Project specific linker flags (Persistent flags: -L and -Wl,...)
+#
+# If you want to link your (test) executables with the latest version of
+# your project library instead of the version that was actually installed
+# in /usr/local (for example), then you need to add -L$(BASEDIR)/lib to
+# LIBFLAGS.
+
+LIBFLAGS+=-L$(BASEDIR)/../../../.libs
+
+#
+# DFLAGS
+#
+# Extra flags for generating dependencies.
+# The default is -MM, only including "local" headers.
+# Use this if you need dependencies on <system> headers,
+# (for example when you are writing a library and are using <headers>
+# with angle brackets yourself).
+
+##DFLAGS=-M
+
+#
+# CPPEXT
+#
+# The C++ extension that is used in this project. Correct this!
+
+CPPEXT=.cc
Index: src/libcwd/documentation/tutorial/examples7/Makefile
diff -u /dev/null src/libcwd/documentation/tutorial/examples7/Makefile:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples7/Makefile Thu Dec 27 20:12:00 2001
@@ -0,0 +1,13 @@
+# List of subdirectories (automatically updated by `makeproto'):
+SUBDIRS=tut7.1 tut7.2 tut7.3
+
+#-----------------------------------------------------------------------------
+
+include $(PROTODIR)/base/PTMakefile
+
+# Add here project specific additions:
+
+#build::
+#depend::
+#clean::
+#real-clean::
Index: src/libcwd/documentation/tutorial/examples7/debug.h
diff -u /dev/null src/libcwd/documentation/tutorial/examples7/debug.h:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples7/debug.h Thu Dec 27 20:12:00 2001
@@ -0,0 +1,25 @@
+#ifndef DEBUG_H
+#define DEBUG_H
+
+#ifndef CWDEBUG
+#define AllocTag1(p)
+#define AllocTag2(p, desc)
+#define AllocTag_dynamic_description(p, x)
+#define AllocTag(p, x)
+#define ASSERT(x)
+#define Debug(x)
+#define Dout(a, b)
+#define DoutFatal(a, b) LibcwDoutFatal(::std, , a, b)
+#define ForAllDebugChannels(STATEMENT)
+#define ForAllDebugObjects(STATEMENT)
+#define LibcwDebug(dc_namespace, x)
+#define LibcwDout(a, b, c, d)
+#define LibcwDoutFatal(a, b, c, d) do { ::std::cerr << d << ::std::endl; exit(-1); } while(1)
+#define NEW(x) new x
+#define set_alloc_checking_off()
+#define set_alloc_checking_on()
+#else
+#include <libcw/debug.h>
+#endif
+
+#endif
Index: src/libcwd/documentation/tutorial/examples7/sys.h
diff -u /dev/null src/libcwd/documentation/tutorial/examples7/sys.h:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples7/sys.h Thu Dec 27 20:12:00 2001
@@ -0,0 +1,13 @@
+// Bug workaround for libstdc++, avoid warnings like
+// /usr/include/g++-3/iostream.h:253:5: "_G_CLOG_CONFLICT" is not defined
+#include <_G_config.h>
+#ifndef _G_CLOG_CONFLICT
+#define _G_CLOG_CONFLICT 0
+#endif
+#ifndef _G_HAS_LABS
+#define _G_HAS_LABS 1
+#endif
+
+#ifdef CWDEBUG
+#include <libcw/sysd.h>
+#endif
Index: src/libcwd/documentation/tutorial/examples7/tut7.1/.cvsignore
diff -u /dev/null src/libcwd/documentation/tutorial/examples7/tut7.1/.cvsignore:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples7/tut7.1/.cvsignore Thu Dec 27 20:12:00 2001
@@ -0,0 +1,6 @@
+invisible.cc
+test_delete.cc
+coredump.cc
+invisible
+test_delete
+coredump
Index: src/libcwd/documentation/tutorial/examples7/tut7.1/Makefile
diff -u /dev/null src/libcwd/documentation/tutorial/examples7/tut7.1/Makefile:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples7/tut7.1/Makefile Thu Dec 27 20:12:00 2001
@@ -0,0 +1,33 @@
+# Directory where the base Makefile resides:
+BASEDIR=..
+
+# List of source files (one per executable):
+CSRC=
+CXXSRC=invisible.cc coredump.cc test_delete.cc
+
+# List of sub directories:
+SUBDIRS=
+
+# Extra static libraries to link with:
+STATICLIBS=
+
+# Extra shared libraries to link with:
+SHAREDLIBS=-lcwd
+
+# Put here extra -L... flags
+LIBFLAGS=
+
+# Extra *.o files that need to be linked:
+EXTRA_OBJS=
+
+#-----------------------------------------------------------------------------
+
+include $(PROTODIR)/test/PTMakefile
+
+build::
+ ln -f invisible ../example-7.1.1
+ ln -f coredump ../example-7.1.2
+ ln -f test_delete ../example-7.1.3
+
+#clean::
+#depend::
Index: src/libcwd/documentation/tutorial/examples7/tut7.2/.cvsignore
diff -u /dev/null src/libcwd/documentation/tutorial/examples7/tut7.2/.cvsignore:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples7/tut7.2/.cvsignore Thu Dec 27 20:12:00 2001
@@ -0,0 +1,2 @@
+find_alloc.cc
+find_alloc
Index: src/libcwd/documentation/tutorial/examples7/tut7.2/Makefile
diff -u /dev/null src/libcwd/documentation/tutorial/examples7/tut7.2/Makefile:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples7/tut7.2/Makefile Thu Dec 27 20:12:00 2001
@@ -0,0 +1,31 @@
+# Directory where the base Makefile resides:
+BASEDIR=..
+
+# List of source files (one per executable):
+CSRC=
+CXXSRC=find_alloc.cc
+
+# List of sub directories:
+SUBDIRS=
+
+# Extra static libraries to link with:
+STATICLIBS=
+
+# Extra shared libraries to link with:
+SHAREDLIBS=-lcwd
+
+# Put here extra -L... flags
+LIBFLAGS=
+
+# Extra *.o files that need to be linked:
+EXTRA_OBJS=
+
+#-----------------------------------------------------------------------------
+
+include $(PROTODIR)/test/PTMakefile
+
+build::
+ ln -f find_alloc ../example-7.2
+
+#clean::
+#depend::
Index: src/libcwd/documentation/tutorial/examples7/tut7.3/.cvsignore
diff -u /dev/null src/libcwd/documentation/tutorial/examples7/tut7.3/.cvsignore:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples7/tut7.3/.cvsignore Thu Dec 27 20:12:00 2001
@@ -0,0 +1,10 @@
+total_alloc.cc
+memleak.cc
+memleak2.cc
+marker.cc
+marker2.cc
+total_alloc
+memleak
+memleak2
+marker
+marker2
Index: src/libcwd/documentation/tutorial/examples7/tut7.3/Makefile
diff -u /dev/null src/libcwd/documentation/tutorial/examples7/tut7.3/Makefile:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/examples7/tut7.3/Makefile Thu Dec 27 20:12:00 2001
@@ -0,0 +1,35 @@
+# Directory where the base Makefile resides:
+BASEDIR=..
+
+# List of source files (one per executable):
+CSRC=
+CXXSRC=total_alloc.cc marker.cc marker2.cc memleak.cc memleak2.cc
+
+# List of sub directories:
+SUBDIRS=
+
+# Extra static libraries to link with:
+STATICLIBS=
+
+# Extra shared libraries to link with:
+SHAREDLIBS=-lcwd
+
+# Put here extra -L... flags
+LIBFLAGS=
+
+# Extra *.o files that need to be linked:
+EXTRA_OBJS=
+
+#-----------------------------------------------------------------------------
+
+include $(PROTODIR)/test/PTMakefile
+
+build::
+ ln -f total_alloc ../example-7.3.1
+ ln -f marker.cc ../example-7.3.2
+ ln -f marker2.cc ../example-7.3.3
+ ln -f memleak.cc ../example-7.3.4
+ ln -f memleak2.cc ../example-7.3.5
+
+#clean::
+#depend::
Index: src/libcwd/documentation/tutorial/faq.m4
diff -u /dev/null src/libcwd/documentation/tutorial/faq.m4:1.1.2.1
--- /dev/null Thu Dec 27 20:12:10 2001
+++ src/libcwd/documentation/tutorial/faq.m4 Thu Dec 27 20:11:59 2001
@@ -0,0 +1,440 @@
+include(definitions.m4)dnl
+__HTMLHEADER
+__PAGEHEADER
+__PAGESTART
+
+<H1>FAQ</H1>
+
+<P>Warning: The ammount of information included in this FAQ is exhaustive.
+Do NOT read it except as a replacement for self-torture. Instead read the
+<A HREF="index.html">tutorial</A> and skip all the references to
+this FAQ unless you find yourself banging your head into the wall asking yourself
+the same question as is listed in the tutorial. In that case a link will
+bring you here to read just that one question.</P>
+
+<HR SIZE=1 NOSHADE>
+
+<A name="sysd.h"></A>
+<H3>1. Why do I have to include "libcw/sysd.h" as first header file?</H3>
+
+<P>This header file is used to fix operating systems bugs, including bugs
+in the system header files. The only way it can do this is when it
+is included before <EM>any</EM> other header file, including system header
+files.</P>
+
+<P>This header file defines also a few very important operating system
+dependend macros like the ones used for inclusion of the ident string.
+Therefore <EM>nothing</EM> will compile without this header file.
+Because it must be included in <EM>every</EM> source file as very first
+header file, it would make no sense to include it also in another
+header file; so it isn't. As a result, forgetting this header file
+or including any other libcw header file before including libcw/sysd.h,
+will definitely lead to compile errors in that header file. </P>
+
+<A name="libcwd"></A>
+<H3>2. What is this <SPAN class="H3code">libcw</SPAN> talk?
+Aren't you forgetting the <U><SPAN class="H3code">d</SPAN></U> of
+<SPAN class="H3code">libcw<U>d</U></SPAN>?</H3>
+
+<P>Libcwd is a spin off of the larger libcw project.
+The header files of both are put in the same directory,
+called <SPAN class="filename">libcw </SPAN>(for example,
+<SPAN class="filename">/usr/include/libcw</SPAN>).</P>
+
+<P>The <U><SPAN class="code">d</SPAN></U> in
+<SPAN class="code">libcw<U>d</U></SPAN> stands for <U>D</U>ebugging.
+The <U><SPAN class="code">cw</SPAN></U> in
+<SPAN class="code">lib<U>cw</U></SPAN> stand for the initials of
+the designer/developer of this life-span project [but I suppose you already
+guessed that ;) ].</P>
+
+<A name="dir"></A>
+<H3>3. Why do I need to type "<SPAN class="H3code">libcw/sysd.h</SPAN>"
+and not just "<SPAN class="H3code">sysd.h</SPAN>"?</H3>
+
+<P>The header file names of libcw are not unique. In order to uniquely
+identify wh...
[truncated message content] |
|
From: Carlo W. <li...@us...> - 2001-12-28 05:15:29
|
CVSROOT : /cvsroot/libcw
Module : src
Branch tags: branch-threading
Commit time: 2001-11-28 05:15:28 UTC
Modified files:
Tag: branch-threading
libcwd/.cvsignore libcwd/Makefile.am libcwd/NEWS
libcwd/acinclude.m4 libcwd/configure.in
Log message:
Now works with automake-1.5.
A few build bug fixes.
---------------------- diff included ----------------------
Index: src/libcwd/.cvsignore
diff -u src/libcwd/.cvsignore:1.14.2.3 src/libcwd/.cvsignore:1.14.2.4
--- src/libcwd/.cvsignore:1.14.2.3 Sun Oct 21 16:29:28 2001
+++ src/libcwd/.cvsignore Thu Dec 27 21:15:17 2001
@@ -11,6 +11,8 @@
config.sub
ltconfig
ltmain.sh
+depcomp
+stamp-h1
config.h.in
config.h
stamp-h.in
Index: src/libcwd/Makefile.am
diff -u src/libcwd/Makefile.am:1.30.2.14 src/libcwd/Makefile.am:1.30.2.15
--- src/libcwd/Makefile.am:1.30.2.14 Sun Dec 9 15:52:46 2001
+++ src/libcwd/Makefile.am Thu Dec 27 21:15:17 2001
@@ -53,6 +53,7 @@
rm -rf rpm
MAINTAINERCLEANFILES = aclocal.m4 config.h.in configure stamp-h.in Makefile.in \
- install-sh missing mkinstalldirs config.guess config.sub ltmain.sh ltconfig
+ install-sh missing mkinstalldirs config.guess config.sub ltmain.sh ltconfig \
+ config.cache config.log config.status depcomp
@MAINTAINER_MODE_TRUE@include maintMakefile
Index: src/libcwd/NEWS
diff -u src/libcwd/NEWS:1.45.2.9 src/libcwd/NEWS:1.45.2.10
--- src/libcwd/NEWS:1.45.2.9 Sat Dec 1 17:01:30 2001
+++ src/libcwd/NEWS Thu Dec 27 21:15:17 2001
@@ -9,6 +9,10 @@
allow the use of the testsuite together with --enable-libcwd-debug.
(You shouldn't use either unless you are hacking libcwd itself).
+ Miscellaneous:
+ - The configuration option --disable-libcwd-location is fixed.
+ - Automake-1.5 now works.
+
API changes:
IMPORTANT: Debug channels have globally been renamed to Debug
Index: src/libcwd/acinclude.m4
diff -u src/libcwd/acinclude.m4:1.41.2.8 src/libcwd/acinclude.m4:1.41.2.9
--- src/libcwd/acinclude.m4:1.41.2.8 Tue Nov 13 19:01:06 2001
+++ src/libcwd/acinclude.m4 Thu Dec 27 21:15:17 2001
@@ -148,7 +148,7 @@
fi
done
fi]
-dnl `automake' looks for AC_OUTPUT and thinks `$1.in' etc.
+dnl `automake' looks for AC_OUTPUT and thinks `$1' etc.
dnl is a literally required file unless we fool it a bit here:
[AC_OUTPUT]([$1], [$2], [$3]))
@@ -517,9 +517,8 @@
dnl Like AC_PROG_CXX, except that it demands that GNU g++-2.95.1
dnl or higher is available.
AC_DEFUN(CW_PROG_CXX,
-[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
-AC_CHECK_PROGS(CXX, g++ c++)
-AC_PROG_CXX_WORKS
+[AC_BEFORE([$0], [CW_PROG_CXXCPP])
+AC_REQUIRE([AC_PROG_CXX])
AC_CACHE_CHECK(whether we are using GNU C++ version 2.95.1 or later, ac_cv_prog_gxx_version,
[dnl The semicolon is to pacify NeXT's syntax-checking cpp.
cat > conftest.C <<EOF
@@ -555,7 +554,9 @@
dnl
dnl Like AC_PROG_CXXCPP but with bug work around that allows user to override CXXCPP.
AC_DEFUN(CW_PROG_CXXCPP,
-[dnl This triggers the bug:
+[AC_BEFORE([$0], [AC_PROG_CXXCPP])
+AC_REQUIRE([CW_PROG_CXX])
+dnl This triggers the bug:
if test -n "$CXXCPP"; then
dnl Work around:
unset ac_cv_prog_CXXCPP
@@ -572,7 +573,7 @@
dnl
dnl Extract finger prints of C++ compiler and preprocessor and C compiler which is used for linking.
AC_DEFUN(CW_PROG_CXX_FINGER_PRINTS,
-[AC_REQUIRE([CW_PROG_CXX])
+[AC_REQUIRE([AC_PROG_CXX])
AC_REQUIRE([CW_PROG_CXXCPP])
AC_REQUIRE([AC_PROG_CC])
cw_prog_cxx_finger_print="`$CXX -v 2>&1 | grep version | head -n 1`"
@@ -820,9 +821,7 @@
dnl CW_SETUP_RPM_DIRS
dnl Set up rpm directory when on linux and in maintainer-mode
AC_DEFUN(CW_SETUP_RPM_DIRS,
-[SPECCHANGELOG=spec.changelog
-if test "$USE_MAINTAINER_MODE" = yes; then
- AC_SUBST_FILE(SPECCHANGELOG)
+[if test "$USE_MAINTAINER_MODE" = yes; then
LSMFILE="$PACKAGE.lsm"
AC_SUBST(LSMFILE)
SPECFILE="$PACKAGE.spec"
Index: src/libcwd/configure.in
diff -u src/libcwd/configure.in:1.81.2.12 src/libcwd/configure.in:1.81.2.13
--- src/libcwd/configure.in:1.81.2.12 Tue Nov 13 19:01:06 2001
+++ src/libcwd/configure.in Thu Dec 27 21:15:17 2001
@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
-AC_REVISION($Revision: 1.81.2.12 $)dnl
+AC_REVISION($Revision: 1.81.2.13 $)dnl
dnl General intialization of `autoconf' varaibles.
dnl Ensure that the directory specified with --srcdir was correct
@@ -111,6 +111,7 @@
unset ac_cv_prog_CC
fi
AC_PROG_CC
+AC_PROG_CXX
CW_PROG_CXX
CW_PROG_CXXCPP
@@ -138,8 +139,8 @@
dnl We need to use these options for the tests too
CXXFLAGS="$DEBUGOPTS $EXTRAOPTS"
-dnl This block cannot be replaced by a macro because the DISABLE_* and
-dnl PROG_LIBTOOL macros need to be in configure.in itself for some reason.
+dnl This block cannot be replaced by a macro because the DISABLE_* and the
+dnl AM_PROG_LIBTOOL macro need to be in configure.in itself for some reason.
dnl This block is also present in src/libcw/configure.in!
dnl Generate libtool (also checks shared/static prerequisites)
if expr "$host" : ".*openbsd.*" >/dev/null; then
@@ -152,7 +153,7 @@
test -n "$enable_shared" || enable_shared=yes
test -n "$enable_static" || enable_static=yes
dnl Note: due to a bug in libtool-1.3c, the language must be C at this point!
-AC_PROG_LIBTOOL
+AM_PROG_LIBTOOL
dnl Configuration needed by the testsuite, extract this from the generated 'libtool'
enable_shared=`./libtool --config | grep '^build_libtool_libs=' | sed -e 's/build_libtool_libs=//'`
enable_static=`./libtool --config | grep '^build_old_libs=' | sed -e 's/build_old_libs=//'`
@@ -446,8 +447,8 @@
cd ..
])
-CW_OUTPUT(Makefile maintMakefile include/Makefile include/libcw/Makefile utils/Makefile tests/Makefile testsuite/Makefile include/libcw/debug_config.ho include/libcw/sysd.ho include/sys.ho)
+CW_OUTPUT(Makefile maintMakefile include/Makefile include/libcw/Makefile utils/Makefile tests/Makefile testsuite/Makefile include/libcw/debug_config.ho include/libcw/sysd.ho include/sys.ho libcwd.spec)
exit 0
dnl Keep automake happy
-AC_OUTPUT(Makefile maintMakefile include/Makefile include/libcw/Makefile utils/Makefile tests/Makefile testsuite/Makefile include/libcw/debug_config.ho include/libcw/sysd.ho include/sys.ho)
+AC_OUTPUT(Makefile maintMakefile include/Makefile include/libcw/Makefile utils/Makefile tests/Makefile testsuite/Makefile include/libcw/debug_config.ho include/libcw/sysd.ho include/sys.ho libcwd.spec)
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-28 05:25:37
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2001-11-28 05:25:37 UTC
Modified files:
libcwd/.cvsignore libcwd/Makefile.am libcwd/NEWS
libcwd/acinclude.m4 libcwd/configure.in
Log message:
Fix for automake 1.5.
---------------------- diff included ----------------------
Index: src/libcwd/.cvsignore
diff -u src/libcwd/.cvsignore:1.15 src/libcwd/.cvsignore:1.16
--- src/libcwd/.cvsignore:1.15 Mon Aug 27 05:46:26 2001
+++ src/libcwd/.cvsignore Thu Dec 27 21:25:27 2001
@@ -11,6 +11,8 @@
config.sub
ltconfig
ltmain.sh
+depcomp
+stamp-h1
config.h.in
config.h
stamp-h.in
Index: src/libcwd/Makefile.am
diff -u src/libcwd/Makefile.am:1.33 src/libcwd/Makefile.am:1.34
--- src/libcwd/Makefile.am:1.33 Sat Sep 22 22:01:08 2001
+++ src/libcwd/Makefile.am Thu Dec 27 21:25:27 2001
@@ -47,6 +47,7 @@
rm -rf rpm
MAINTAINERCLEANFILES = aclocal.m4 config.h.in configure stamp-h.in Makefile.in \
- install-sh missing mkinstalldirs config.guess config.sub ltmain.sh ltconfig
+ install-sh missing mkinstalldirs config.guess config.sub ltmain.sh ltconfig \
+ config.cache config.log config.status depcomp
@MAINTAINER_MODE_TRUE@include maintMakefile
Index: src/libcwd/NEWS
diff -u src/libcwd/NEWS:1.60 src/libcwd/NEWS:1.61
--- src/libcwd/NEWS:1.60 Sat Sep 22 22:01:08 2001
+++ src/libcwd/NEWS Thu Dec 27 21:25:27 2001
@@ -3,6 +3,10 @@
libcwd now works with (single threaded) qt applications. A few major
bugs have been fixed.
+ Miscellaneous:
+ - The configuration option --disable-libcwd-location is fixed.
+ - Automake-1.5 now works.
+
API changes:
You now MUST use CWDEBUG, defining DEBUG will no longer work; it was
Index: src/libcwd/acinclude.m4
diff -u src/libcwd/acinclude.m4:1.42 src/libcwd/acinclude.m4:1.43
--- src/libcwd/acinclude.m4:1.42 Wed Sep 19 16:34:49 2001
+++ src/libcwd/acinclude.m4 Thu Dec 27 21:25:27 2001
@@ -148,7 +148,7 @@
fi
done
fi]
-dnl `automake' looks for AC_OUTPUT and thinks `$1.in' etc.
+dnl `automake' looks for AC_OUTPUT and thinks `$1' etc.
dnl is a literally required file unless we fool it a bit here:
[AC_OUTPUT]([$1], [$2], [$3]))
@@ -512,9 +512,8 @@
dnl Like AC_PROG_CXX, except that it demands that GNU g++-2.95.1
dnl or higher is available.
AC_DEFUN(CW_PROG_CXX,
-[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
-AC_CHECK_PROGS(CXX, g++ c++)
-AC_PROG_CXX_WORKS
+[AC_BEFORE([$0], [CW_PROG_CXXCPP])
+AC_REQUIRE([AC_PROG_CXX])
AC_CACHE_CHECK(whether we are using GNU C++ version 2.95.1 or later, ac_cv_prog_gxx_version,
[dnl The semicolon is to pacify NeXT's syntax-checking cpp.
cat > conftest.C <<EOF
@@ -550,7 +549,9 @@
dnl
dnl Like AC_PROG_CXXCPP but with bug work around that allows user to override CXXCPP.
AC_DEFUN(CW_PROG_CXXCPP,
-[dnl This triggers the bug:
+[AC_BEFORE([$0], [AC_PROG_CXXCPP])
+AC_REQUIRE([CW_PROG_CXX])
+dnl This triggers the bug:
if test -n "$CXXCPP"; then
dnl Work around:
unset ac_cv_prog_CXXCPP
@@ -567,7 +568,7 @@
dnl
dnl Extract finger prints of C++ compiler and preprocessor and C compiler which is used for linking.
AC_DEFUN(CW_PROG_CXX_FINGER_PRINTS,
-[AC_REQUIRE([CW_PROG_CXX])
+[AC_REQUIRE([AC_PROG_CXX])
AC_REQUIRE([CW_PROG_CXXCPP])
AC_REQUIRE([AC_PROG_CC])
cw_prog_cxx_finger_print="`$CXX -v 2>&1 | grep version | head -n 1`"
Index: src/libcwd/configure.in
diff -u src/libcwd/configure.in:1.84 src/libcwd/configure.in:1.85
--- src/libcwd/configure.in:1.84 Sat Sep 22 22:01:08 2001
+++ src/libcwd/configure.in Thu Dec 27 21:25:27 2001
@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
-AC_REVISION($Revision: 1.84 $)dnl
+AC_REVISION($Revision: 1.85 $)dnl
dnl General intialization of `autoconf' varaibles.
dnl Ensure that the directory specified with --srcdir was correct
@@ -100,12 +100,13 @@
CW_ENVIRONMENT
dnl Check for compiler and preprocessor
+AC_PROG_CC
+AC_PROG_CXX
CW_PROG_CXX
CW_PROG_CXXCPP
if test -n "$CC"; then
unset ac_cv_prog_CC
fi
-AC_PROG_CC
dnl Check if C compiler and C++ compiler versions match.
CW_COMPILER_VERSIONS
@@ -128,8 +129,8 @@
dnl We need to use these options for the tests too
CXXFLAGS="$DEBUGOPTS $EXTRAOPTS"
-dnl This block cannot be replaced by a macro because the DISABLE_* and
-dnl PROG_LIBTOOL macros need to be in configure.in itself for some reason.
+dnl This block cannot be replaced by a macro because the DISABLE_* and the
+dnl AM_PROG_LIBTOOL macro need to be in configure.in itself for some reason.
dnl This block is also present in src/libcw/configure.in!
dnl Generate libtool (also checks shared/static prerequisites)
if expr "$host" : ".*openbsd.*" >/dev/null; then
@@ -142,7 +143,7 @@
test -n "$enable_shared" || enable_shared=yes
test -n "$enable_static" || enable_static=yes
dnl Note: due to a bug in libtool-1.3c, the language must be C at this point!
-AC_PROG_LIBTOOL
+AM_PROG_LIBTOOL
dnl Configuration needed by the testsuite, extract this from the generated 'libtool'
enable_shared=`./libtool --config | grep '^build_libtool_libs=' | sed -e 's/build_libtool_libs=//'`
enable_static=`./libtool --config | grep '^build_old_libs=' | sed -e 's/build_old_libs=//'`
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-29 23:59:26
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2001-11-29 23:59:25 UTC
Added files:
libcwd/documentation/tutorial/examples5/sysinclude/libbooster/debug.h
libcwd/documentation/tutorial/examples5/sysinclude/libturbo/debug.h
Log message:
Work in progress.
---------------------- diff included ----------------------
Index: src/libcwd/documentation/tutorial/examples5/sysinclude/libbooster/debug.h
diff -u /dev/null src/libcwd/documentation/tutorial/examples5/sysinclude/libbooster/debug.h:1.2
--- /dev/null Sat Dec 29 15:59:25 2001
+++ src/libcwd/documentation/tutorial/examples5/sysinclude/libbooster/debug.h Sat Dec 29 15:59:14 2001
@@ -0,0 +1,14 @@
+#include <libcw/debug.h>
+
+namespace booster {
+ namespace debug {
+ namespace channels {
+ namespace dc {
+ using namespace libcw::debug;
+ using namespace libcw::debug::channels::dc;
+ extern channel_ct booster;
+ extern channel_ct foobar;
+ }
+ }
+ }
+}
Index: src/libcwd/documentation/tutorial/examples5/sysinclude/libturbo/debug.h
diff -u /dev/null src/libcwd/documentation/tutorial/examples5/sysinclude/libturbo/debug.h:1.2
--- /dev/null Sat Dec 29 15:59:25 2001
+++ src/libcwd/documentation/tutorial/examples5/sysinclude/libturbo/debug.h Sat Dec 29 15:59:14 2001
@@ -0,0 +1,20 @@
+#include <libcw/debug.h>
+
+namespace turbo {
+ namespace debug {
+ namespace channels {
+ namespace dc {
+ using namespace libcw::debug;
+ using namespace libcw::debug::channels::dc;
+ extern channel_ct turbo;
+ extern channel_ct foobar;
+ }
+ }
+ }
+}
+
+namespace libcw {
+ namespace debug {
+ using namespace turbo::debug;
+ }
+}
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-30 00:53:22
|
CVSROOT : /cvsroot/libcw
Module : src
Branch tags: branch-threading
Commit time: 2001-11-30 00:53:20 UTC
Removed files:
Tag: branch-threading
libcwd/documentation/tutorial/examples7/tut7.1/.cvsignore
libcwd/documentation/tutorial/examples7/tut7.1/Makefile
libcwd/documentation/tutorial/examples7/tut7.2/.cvsignore
libcwd/documentation/tutorial/examples7/tut7.2/Makefile
libcwd/documentation/tutorial/examples7/tut7.3/.cvsignore
libcwd/documentation/tutorial/examples7/tut7.3/Makefile
Log message:
Work in progress.
---------------------- diff included ----------------------
Index: src/libcwd/documentation/tutorial/examples7/tut7.1/.cvsignore
diff -u src/libcwd/documentation/tutorial/examples7/tut7.1/.cvsignore:1.1.2.1 src/libcwd/documentation/tutorial/examples7/tut7.1/.cvsignore:removed
--- src/libcwd/documentation/tutorial/examples7/tut7.1/.cvsignore:1.1.2.1 Thu Dec 27 20:12:00 2001
+++ src/libcwd/documentation/tutorial/examples7/tut7.1/.cvsignore Sat Dec 29 16:53:20 2001
@@ -1,6 +0,0 @@
-invisible.cc
-test_delete.cc
-coredump.cc
-invisible
-test_delete
-coredump
Index: src/libcwd/documentation/tutorial/examples7/tut7.1/Makefile
diff -u src/libcwd/documentation/tutorial/examples7/tut7.1/Makefile:1.1.2.1 src/libcwd/documentation/tutorial/examples7/tut7.1/Makefile:removed
--- src/libcwd/documentation/tutorial/examples7/tut7.1/Makefile:1.1.2.1 Thu Dec 27 20:12:00 2001
+++ src/libcwd/documentation/tutorial/examples7/tut7.1/Makefile Sat Dec 29 16:53:20 2001
@@ -1,33 +0,0 @@
-# Directory where the base Makefile resides:
-BASEDIR=..
-
-# List of source files (one per executable):
-CSRC=
-CXXSRC=invisible.cc coredump.cc test_delete.cc
-
-# List of sub directories:
-SUBDIRS=
-
-# Extra static libraries to link with:
-STATICLIBS=
-
-# Extra shared libraries to link with:
-SHAREDLIBS=-lcwd
-
-# Put here extra -L... flags
-LIBFLAGS=
-
-# Extra *.o files that need to be linked:
-EXTRA_OBJS=
-
-#-----------------------------------------------------------------------------
-
-include $(PROTODIR)/test/PTMakefile
-
-build::
- ln -f invisible ../example-7.1.1
- ln -f coredump ../example-7.1.2
- ln -f test_delete ../example-7.1.3
-
-#clean::
-#depend::
Index: src/libcwd/documentation/tutorial/examples7/tut7.2/.cvsignore
diff -u src/libcwd/documentation/tutorial/examples7/tut7.2/.cvsignore:1.1.2.1 src/libcwd/documentation/tutorial/examples7/tut7.2/.cvsignore:removed
--- src/libcwd/documentation/tutorial/examples7/tut7.2/.cvsignore:1.1.2.1 Thu Dec 27 20:12:00 2001
+++ src/libcwd/documentation/tutorial/examples7/tut7.2/.cvsignore Sat Dec 29 16:53:20 2001
@@ -1,2 +0,0 @@
-find_alloc.cc
-find_alloc
Index: src/libcwd/documentation/tutorial/examples7/tut7.2/Makefile
diff -u src/libcwd/documentation/tutorial/examples7/tut7.2/Makefile:1.1.2.1 src/libcwd/documentation/tutorial/examples7/tut7.2/Makefile:removed
--- src/libcwd/documentation/tutorial/examples7/tut7.2/Makefile:1.1.2.1 Thu Dec 27 20:12:00 2001
+++ src/libcwd/documentation/tutorial/examples7/tut7.2/Makefile Sat Dec 29 16:53:20 2001
@@ -1,31 +0,0 @@
-# Directory where the base Makefile resides:
-BASEDIR=..
-
-# List of source files (one per executable):
-CSRC=
-CXXSRC=find_alloc.cc
-
-# List of sub directories:
-SUBDIRS=
-
-# Extra static libraries to link with:
-STATICLIBS=
-
-# Extra shared libraries to link with:
-SHAREDLIBS=-lcwd
-
-# Put here extra -L... flags
-LIBFLAGS=
-
-# Extra *.o files that need to be linked:
-EXTRA_OBJS=
-
-#-----------------------------------------------------------------------------
-
-include $(PROTODIR)/test/PTMakefile
-
-build::
- ln -f find_alloc ../example-7.2
-
-#clean::
-#depend::
Index: src/libcwd/documentation/tutorial/examples7/tut7.3/.cvsignore
diff -u src/libcwd/documentation/tutorial/examples7/tut7.3/.cvsignore:1.1.2.1 src/libcwd/documentation/tutorial/examples7/tut7.3/.cvsignore:removed
--- src/libcwd/documentation/tutorial/examples7/tut7.3/.cvsignore:1.1.2.1 Thu Dec 27 20:12:00 2001
+++ src/libcwd/documentation/tutorial/examples7/tut7.3/.cvsignore Sat Dec 29 16:53:20 2001
@@ -1,10 +0,0 @@
-total_alloc.cc
-memleak.cc
-memleak2.cc
-marker.cc
-marker2.cc
-total_alloc
-memleak
-memleak2
-marker
-marker2
Index: src/libcwd/documentation/tutorial/examples7/tut7.3/Makefile
diff -u src/libcwd/documentation/tutorial/examples7/tut7.3/Makefile:1.1.2.1 src/libcwd/documentation/tutorial/examples7/tut7.3/Makefile:removed
--- src/libcwd/documentation/tutorial/examples7/tut7.3/Makefile:1.1.2.1 Thu Dec 27 20:12:00 2001
+++ src/libcwd/documentation/tutorial/examples7/tut7.3/Makefile Sat Dec 29 16:53:20 2001
@@ -1,35 +0,0 @@
-# Directory where the base Makefile resides:
-BASEDIR=..
-
-# List of source files (one per executable):
-CSRC=
-CXXSRC=total_alloc.cc marker.cc marker2.cc memleak.cc memleak2.cc
-
-# List of sub directories:
-SUBDIRS=
-
-# Extra static libraries to link with:
-STATICLIBS=
-
-# Extra shared libraries to link with:
-SHAREDLIBS=-lcwd
-
-# Put here extra -L... flags
-LIBFLAGS=
-
-# Extra *.o files that need to be linked:
-EXTRA_OBJS=
-
-#-----------------------------------------------------------------------------
-
-include $(PROTODIR)/test/PTMakefile
-
-build::
- ln -f total_alloc ../example-7.3.1
- ln -f marker.cc ../example-7.3.2
- ln -f marker2.cc ../example-7.3.3
- ln -f memleak.cc ../example-7.3.4
- ln -f memleak2.cc ../example-7.3.5
-
-#clean::
-#depend::
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-30 00:55:15
|
CVSROOT : /cvsroot/libcw
Module : src
Branch tags: branch-threading
Commit time: 2001-11-30 00:55:14 UTC
Removed files:
Tag: branch-threading
libcwd/documentation/tutorial/examples7/Makedefs.h
libcwd/documentation/tutorial/examples7/Makefile
Log message:
Work in progress.
---------------------- diff included ----------------------
Index: src/libcwd/documentation/tutorial/examples7/Makedefs.h
diff -u src/libcwd/documentation/tutorial/examples7/Makedefs.h:1.1.2.1 src/libcwd/documentation/tutorial/examples7/Makedefs.h:removed
--- src/libcwd/documentation/tutorial/examples7/Makedefs.h:1.1.2.1 Thu Dec 27 20:12:00 2001
+++ src/libcwd/documentation/tutorial/examples7/Makedefs.h Sat Dec 29 16:55:14 2001
@@ -1,103 +0,0 @@
-# This file contains the Project specific variables.
-#
-# Extra parameters can be added to the following variables:
-#
-# CFLAGS, CXXFLAGS, INCLUDEFLAGS, SYSTEMINCLUDEFLAGS, LDFLAGS.
-#
-# Always use a += for these variables to *add* parameters rather
-# than overriding them!
-
-#
-# CFLAGS / CXXFLAGS
-#
-# Project specific compiler flags.
-#
-# Use this when profiling:
-
-##CFLAGS=-pg -O6 -pipe
-##CXXFLAGS=-pg -O6 -pipe -fno-exceptions
-##LDFLAGS=-pg
-
-# Add extra, project specific, defines here, etc.
-
-##CFLAGS+=-D__MYCLIB__
-CXXFLAGS+=-DCWDEBUG
-
-#
-# INCLUDEFLAGS
-#
-# Project specific "include" flags.
-#
-# These directories are searched when you use an #include "foobar.h"
-# in your source code.
-#
-# The given directories will be relative to the directory from which
-# the compiler is started, which is the directory that the source
-# file being compiled is in. Therefore always use -I$(BASEDIR) as
-# a prefix (BASEDIR is the directory this file is in).
-#
-# Note: If you want to add an include directory that is specific for
-# only one executable or library, you might want to add this -I flag
-# to the Makefile for that executable or library respectively instead.
-
-INCLUDEFLAGS+=-I$(BASEDIR)
-
-#
-# SYSTEMINCLUDEFLAGS
-#
-# Project specific system <include> flags.
-#
-# These directories are searched when you use a #include <foobar.h>
-# in your source code.
-#
-# Note: If you are writting a library, then you want to use
-# #include <yourlib/foobar.h> in your headerfiles, because later on
-# these header files are installed in /usr/local/include for instance.
-# In that case you need to add -I$(BASEDIR)/include *here* instead
-# to in INCLUDEFLAGS above.
-#
-
-SYSTEMINCLUDEFLAGS+=-I$(BASEDIR)/sysinclude -I$(BASEDIR)/../../../include
-
-#
-# LDFLAGS
-#
-# Project specific linker flags (Overridden flags: -s or -pg ...)
-#
-# These flags are passed to the compiler at link time, these flags
-# are given a default value in $(PROTODIR)/Makedefs.h. You can
-# override them here.
-#
-
-LIBPATH:=$(shell (cd $(BASEDIR)/../../../.libs; pwd))
-LDFLAGS=-Wl,-rpath,$(LIBPATH)
-
-#
-# LIBFLAGS
-#
-# Project specific linker flags (Persistent flags: -L and -Wl,...)
-#
-# If you want to link your (test) executables with the latest version of
-# your project library instead of the version that was actually installed
-# in /usr/local (for example), then you need to add -L$(BASEDIR)/lib to
-# LIBFLAGS.
-
-LIBFLAGS+=-L$(BASEDIR)/../../../.libs
-
-#
-# DFLAGS
-#
-# Extra flags for generating dependencies.
-# The default is -MM, only including "local" headers.
-# Use this if you need dependencies on <system> headers,
-# (for example when you are writing a library and are using <headers>
-# with angle brackets yourself).
-
-##DFLAGS=-M
-
-#
-# CPPEXT
-#
-# The C++ extension that is used in this project. Correct this!
-
-CPPEXT=.cc
Index: src/libcwd/documentation/tutorial/examples7/Makefile
diff -u src/libcwd/documentation/tutorial/examples7/Makefile:1.1.2.1 src/libcwd/documentation/tutorial/examples7/Makefile:removed
--- src/libcwd/documentation/tutorial/examples7/Makefile:1.1.2.1 Thu Dec 27 20:12:00 2001
+++ src/libcwd/documentation/tutorial/examples7/Makefile Sat Dec 29 16:55:14 2001
@@ -1,13 +0,0 @@
-# List of subdirectories (automatically updated by `makeproto'):
-SUBDIRS=tut7.1 tut7.2 tut7.3
-
-#-----------------------------------------------------------------------------
-
-include $(PROTODIR)/base/PTMakefile
-
-# Add here project specific additions:
-
-#build::
-#depend::
-#clean::
-#real-clean::
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-30 01:22:21
|
CVSROOT : /cvsroot/libcw
Module : src
Branch tags: branch-threading
Commit time: 2001-11-30 01:22:19 UTC
Modified files:
Tag: branch-threading
libcwd/documentation/tutorial/Makefile
Added files:
libcwd/documentation/tutorial/examples5/.cvsignore
libcwd/documentation/tutorial/examples5/sys.h
Tag: branch-threading
libcwd/documentation/tutorial/moo.awk
libcwd/documentation/tutorial/tut5.in
libcwd/documentation/tutorial/tut7.in
Removed files:
Tag: branch-threading
libcwd/documentation/tutorial/tut5.m4
libcwd/documentation/tutorial/tut7.m4
Log message:
Improvement of build system for tutorial.
Now it should build only what is necessary, using the Makefile
dependency rules. Got rid of 'prototype'.
Some dependency rules are still missing.
---------------------- diff included ----------------------
Index: src/libcwd/documentation/tutorial/Makefile
diff -u src/libcwd/documentation/tutorial/Makefile:1.1.2.1 src/libcwd/documentation/tutorial/Makefile:1.1.2.2
--- src/libcwd/documentation/tutorial/Makefile:1.1.2.1 Thu Dec 27 20:11:59 2001
+++ src/libcwd/documentation/tutorial/Makefile Sat Dec 29 17:22:09 2001
@@ -1,40 +1,63 @@
.SUFFIXES:
.PHONY: examples html
-FILES5:=$(shell grep 'START CODE' tut5.m4 | cut -d \ -f4)
-FILES7:=$(shell grep 'START CODE' tut7.m4 | cut -d \ -f4)
+SOURCES5:=$(shell grep 'START CODE' tut5.in | cut -d \ -f4)
+SOURCES7:=$(shell grep 'START CODE' tut7.in | cut -d \ -f4)
+AOUT5:=$(shell grep 'START OUTPUT' tut5.in | cut -d \ -f4)
+AOUT7:=$(shell grep 'START OUTPUT' tut7.in | cut -d \ -f4)
all: examples html
-examples: $(FILES5) $(FILES7)
+examples: $(SOURCES5) $(SOURCES7)
html: index.html faq.html intro.html tut1.html tut2.html tut3.html tut4.html tut5.html tut6.html tut7.html
%.html: %.m4 ../definitions.m4
m4 -D__TUTORIAL=1 -I.. $< > $@
-$(FILES5): tut5.m4 ../../.libs/libcwd.so
- @$(MAKE) $@-x
+tut5.m4: tut5.in $(AOUT5)
+ awk -f moo.awk $< > $@
-$(FILES7): tut7.m4 ../../.libs/libcwd.so
- @$(MAKE) -s $@-x
-
-%-x:
- @IN=`echo $* | sed -e 's/examples\([57]\).*/tut\1.m4/'`; \
- grep -A1000 "START CODE $*" $$IN |\
- grep -B1000 "END CODE $*" |\
- egrep -v "(START|END) CODE $*" |\
- sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' -e 's/"/"/g' -e 's/§/§/g' \
- -e 's/<SPAN.[^>]*>//g' -e 's/<\/SPAN>//g' > $*.tmp; \
- if (test ! -f $* || ! cmp -s $* $*.tmp); then \
- echo "Extracting $* from $$IN."; \
- mv $*.tmp $*; \
+tut7.m4: tut7.in $(AOUT7)
+ awk -f moo.awk $< > $@
+
+$(SOURCES5): tut5.in ../../.libs/libcwd.so
+ @$(MAKE) -s $@-cc
+
+$(SOURCES7): tut7.in ../../.libs/libcwd.so
+ @$(MAKE) -s $@-cc
+
+%-cc:
+ @IN=`echo $* | sed -e 's/examples\([57]\).*/tut\1.in/'`; \
+ if grep "END CODE $*" $$IN >/dev/null; then \
+ grep -A1000 "START CODE $*" $$IN |\
+ grep -B1000 "END CODE $*" |\
+ egrep -v "(START|END) CODE $*" |\
+ sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' -e 's/"/"/g' -e 's/§/§/g' \
+ -e 's/<SPAN.[^>]*>//g' -e 's/<\/SPAN>//g' > $*.tmp; \
+ if (test ! -f $* || ! cmp -s $* $*.tmp); then \
+ echo "Extracting $* from $$IN."; \
+ mv $*.tmp $*; \
+ else \
+ echo "$* wasn't changed."; \
+ touch $*; \
+ rm $*.tmp; \
+ fi; \
else \
- echo "$* wasn't changed."; \
- touch $*; \
- rm $*.tmp; \
- fi; \
- OUT=`echo $(*F) | sed -e 's/\.[ch]*$$//'`; \
- if test "$$OUT" != "debug"; then \
- $(MAKE) -C $(*D) $$OUT; \
+ echo "No line with \"END CODE $*\" in $$IN!"; \
+ exit 1; \
fi
+
+examples5/%-bin: %.cc examples5/debug.o examples5/sys.h
+ $(CXX) -g -pipe -DCWDEBUG -Iexamples5 -I- -Iexamples5/sysinclude -I../../include \
+ $< examples5/debug.o -L../../.libs/libcwd.so -Wl,-rpath,$(shell (../../.libs; pwd)) -lcwd -o $@
+
+examples5/debug.o: examples5/debug.cc
+ $(CXX) -g -pipe -DCWDEBUG -Iexamples5 -Iexamples5/sysinclude -I../../include -c $< -o $@
+
+examples7/%-bin: %.cc examples7/sys.h examples7/debug.h
+ $(CXX) -g -pipe -DCWDEBUG -Iexamples7 -I- -I../../include \
+ $< -L../../.libs/libcwd.so -Wl,-rpath,$(shell (../../.libs; pwd)) -lcwd -o $@
+
+maintainer-clean:
+ rm -f examples5/debug.* examples5/test* core examples7/test* tut5.m4 tut7.m4 *.html
Index: src/libcwd/documentation/tutorial/examples5/.cvsignore
diff -u /dev/null src/libcwd/documentation/tutorial/examples5/.cvsignore:1.1
--- /dev/null Sat Dec 29 17:22:20 2001
+++ src/libcwd/documentation/tutorial/examples5/.cvsignore Sat Dec 29 17:22:09 2001
@@ -0,0 +1,5 @@
+debug.cc
+debug.h
+sys.h
+test*
+
Index: src/libcwd/documentation/tutorial/examples5/sys.h
diff -u /dev/null src/libcwd/documentation/tutorial/examples5/sys.h:1.1
--- /dev/null Sat Dec 29 17:22:20 2001
+++ src/libcwd/documentation/tutorial/examples5/sys.h Sat Dec 29 17:22:09 2001
@@ -0,0 +1,6 @@
+#ifdef HAVE_CONFIG_H // This is just an example of what you could do
+#include "config.h" // when using autoconf for your project.
+#endif
+#ifdef CWDEBUG // This is needed so that others can compile
+#include <libcw/sysd.h> // your application without having libcwd installed.
+#endif
Index: src/libcwd/documentation/tutorial/moo.awk
diff -u /dev/null src/libcwd/documentation/tutorial/moo.awk:1.1.2.1
--- /dev/null Sat Dec 29 17:22:20 2001
+++ src/libcwd/documentation/tutorial/moo.awk Sat Dec 29 17:22:09 2001
@@ -0,0 +1,12 @@
+/^<\!-- START OUTPUT .* -->$/ {
+ print;
+ sub(/^<\!-- START OUTPUT /,"",$0);
+ sub(/ -->$/,"",$0);
+ cmd=sprintf("%s 2>&1 | sed -e 's/&/\\&/g' -e 's/</\\</g' -e 's/>/\\>/g' -e 's/\"/\\"/g' -e 's/§/\\§/g'", $0);
+ system(cmd);
+ next;
+}
+
+{
+ print;
+}
Index: src/libcwd/documentation/tutorial/tut5.in
diff -u /dev/null src/libcwd/documentation/tutorial/tut5.in:1.1.2.1
--- /dev/null Sat Dec 29 17:22:20 2001
+++ src/libcwd/documentation/tutorial/tut5.in Sat Dec 29 17:22:09 2001
@@ -0,0 +1,587 @@
+include(definitions.m4)dnl
+__HTMLHEADER
+__PAGEHEADER
+__PAGESTART
+
+<H2>Tutorial 5: Advanced examples</H2>
+
+<P>In this tutorial you will learn how to list all debugging channels
+and how to write a loop that runs over all existing debug channels.
+You will make four debug channels in their own namespace and write debug output to a combination of them.
+You will also learn how to add an error message after a debug message, how to format a debug message,
+how to supress the label and how to supress the newline at the end.
+Finally you will learn how to write interrupted debug output
+in an example that prints the call to a system call and the result of that.</P>
+
+<A NAME="Running"></A>
+<H3>5.1 Running over all Debug Channels</H3>
+
+<P>In <A HREF="tut2.html">tutorial 2</A> you have learned how to create new Debug Channels.
+Each new Debug Channel is stored in an internal list, allowing
+you to loop over all debug channels without knowing exactly which ones exist.
+For example, the following code will <A HREF="tut1.html#turn_on_channel">turn on</A> all
+debug channels. It is not allowed to call <CODE>on()</CODE>
+for a Debug Channel that is already <I>on</I>: that will result in a runtime error.</P>
+
+<P>A special shortcut function is provided to list all debug channels,
+the following code prints a list of all channels after they have been turned on.</P>
+
+<P>Compile as: <SPAN class="shell-command">g++ -g -DCWDEBUG test5.1.1.cc -lcwd -o turn_on</SPAN></P>
+<P class="download">[<A HREF="examples5/test5.1.1.cc">download</A>]</P>
+<PRE>
+<!-- START CODE examples5/test5.1.1.cc -->
+#include "sys.h" // See tutorial 2
+#include <libcw/debug.h>
+
+int main(void)
+{
+ // Turn on debug object `libcw_do'.
+ Debug( libcw_do.on() );
+
+ // Turn on all debug channels that are off.
+ <SPAN class="highlight">ForAllDebugChannels(</SPAN>
+ if (!<SPAN class="highlight">debugChannel</SPAN>.is_on())
+ <SPAN class="highlight">debugChannel</SPAN>.on();
+ <SPAN class="highlight">);</SPAN>
+
+ // Print a listing of all debug channels to debug object `libcw_do'.
+ Debug( <SPAN class="highlight">list_channels_on(</SPAN>libcw_do<SPAN class="highlight">)</SPAN> );
+
+ return 0;
+}
+<!-- END CODE examples5/test5.1.1.cc -->
+</PRE>
+
+<P>This program outputs:</P>
+
+<PRE class="output">
+<!-- START OUTPUT examples5/test5.1.1-bin -->
+</PRE>
+
+<A NAME="Debug"></A>
+<H3>5.2 Debug Channels and name spaces</H3>
+
+<P>The custom debug channel <CODE>dc::ghost</CODE> that you created
+in <A HREF="tut2.html">tutorial 2</A> was put in <CODE>namespace debug_channels</CODE>.
+The debug channels of libcw are put in namespace <CODE>libcw::debug::channels</CODE>.
+Nevertheless, it is not necessary to type</P>
+
+<PRE>Dout( libcw::debug::channels::dc::notice, "Hello World" );</PRE>
+
+<P>By default, the macro <CODE>Dout</CODE> et al. automatically include a<CODE> using namespace libcw::debug::channels</CODE>.
+It is possible to change this default namespace by defining <CODE>DEBUGCHANNELS</CODE>
+<EM>before</EM> including the header file <CODE>libcw/debug.h</CODE>.
+This is will be shown below.</P>
+
+<P>Of course, you can put your own debug channels also in namespace<CODE> libcw::debug::channels</CODE>
+but that wouldn't garantee not to collide with a new debug channel added to libcw in the future, or
+with debug channels of other libraries that would do the same.</P>
+
+<A NAME="debug.h"></A>
+<P>In the following example we will define four new debug channels in their own
+name space<CODE> example::debug::channels </CODE> by creating a project specific header file "debug.h"
+which needs to be included instead of the debug.h from libcw.</P>
+
+<P>The example application below uses the fictitious libraries <SPAN STYLE="font-family: courier">libbooster</SPAN>
+and <SPAN STYLE="font-family: courier">libturbo</SPAN>, both of which use libcwd themselfs and declare their own debug
+channel namespaces <CODE>booster::debug::channels</CODE> and <CODE>turbo::debug::channels</CODE> according to
+the rules as mentioned in the <A HREF="../html/group__chapter__custom__debug__h.html#libraries">reference manual</A>.</P>
+
+<P>The project header file "debug.h":</P>
+<P class="download">[<A HREF="examples5/debug.h">download</A>]</P>
+<PRE>
+<!-- START CODE examples5/debug.h -->
+#ifndef EXAMPLE_DEBUG_H
+#define EXAMPLE_DEBUG_H
+
+#ifdef CWDEBUG
+
+#ifndef DEBUGCHANNELS // This test is only necessary in libraries
+#define DEBUGCHANNELS ::example::debug::channels
+#endif
+#include <libbooster/debug.h> // Note that these will include
+#include <libturbo/debug.h> // libcw/debug.h for us.
+
+namespace example {
+ namespace debug {
+ namespace channels {
+ namespace dc {
+ using namespace libcw::debug; // For class channel_ct
+
+ // The list of debug channel namespaces of the libraries that we use:
+ // (These two already include libcw::debug::channels::dc)
+ using namespace ::booster::debug::channels::dc;
+ using namespace ::turbo::debug::channels::dc;
+
+ // Our own debug channels:
+ extern channel_ct elephant;
+ extern channel_ct cat;
+ extern channel_ct mouse;
+ extern channel_ct owl;
+
+ // When the libraries use the same name for any debug channels,
+ // then here is the place to `hide' these channels by redefining them.
+ // For example, if `libbooster' defined `notice' too (as does libcw)
+ // then we have to redefine it again:
+ static channel_ct& notice(libcw::debug::channels::dc::notice)
+ __attribute__ ((unused));
+
+ } // namespace dc
+ } // namespace channels
+ } // namespace debug
+} // namespace example
+
+// The following is only necessary for libraries.
+// Libraries should not use Dout() et al. in their own header files,
+// instead we define our own macros here for use in those header files:
+#define MyLibHeaderDout(cntrl, data) \
+ LibcwDout(::example::debug::channels, ::libcw::debug::libcw_do, cntrl, data)
+#define MyLibHeaderDoutFatal(cntrl, data) \
+ LibcwDoutFatal(::example::debug::channels, ::libcw::debug::libcw_do, cntrl, data)
+
+#else // !CWDEBUG
+
+// This is needed so people who don't have libcwd installed can still compile it.
+// The file "nodebug.h" is provided in the libcwd and needs to be included in your
+// own package.
+#include "nodebug.h"
+#define MyLibHeaderDout(cntrl, data)
+#define MyLibHeaderDoutFatal(cntrl, data) LibcwDoutFatal(::std, /*nothing*/, cntrl, data)
+
+#endif // !CWDEBUG
+
+#endif // EXAMPLE_DEBUG_H
+<!-- END CODE examples5/debug.h -->
+</PRE>
+
+<P>The source file "debug.cc":</P>
+<P class="download">[<A HREF="examples5/debug.cc">download</A>]</P>
+<PRE>
+<!-- START CODE examples5/debug.cc -->
+#include "sys.h" // See tutorial 2
+#include "debug.h"
+
+#ifdef CWDEBUG
+using namespace libcw::debug;
+
+namespace example {
+ namespace debug {
+ namespace channels {
+ namespace dc {
+ channel_ct elephant("DUMBO");
+ channel_ct cat("FELIX");
+ channel_ct mouse("HILDAGO");
+ channel_ct owl("EINSTEIN");
+ }
+ }
+ }
+}
+#endif
+<!-- END CODE examples5/debug.cc -->
+</PRE>
+
+<A NAME="Combining"></A>
+<H3>5.3 Combining channels</H3>
+
+<P>Debug channels can be on or off and they have a label.
+Sometimes you might want to write certain debug output to a
+debug object when <EM>any</EM> of a given list of debug channels is turned on.
+The syntax to do that is based on the fact that debug channels can be viewed upon as a bit mask:
+using <CODE>operator|</CODE>.
+In the following example we will write debug output to several different combinations
+of the custom debug channels that we defined in the previous paragraph.</P>
+
+<P>The source file "test5.3.1.cc":</P>
+<P class="download">[<A HREF="examples5/test5.3.1.cc">download</A>]</P>
+<PRE>
+<!-- START CODE examples5/test5.3.1.cc -->
+#include "sys.h" // See § 2
+#include "debug.h" // See § 5.2
+
+int main(void)
+{
+ // Start with everything turned on:
+ Debug( libcw_do.on() );
+ ForAllDebugChannels( if (!debugChannel.is_on()) debugChannel.on() );
+
+ Dout( dc::elephant|dc::owl, "The elephant is called Dumbo, the owl is called Einstein." );
+
+ return 0;
+}
+<!-- END CODE examples5/test5.3.1.cc -->
+</PRE>
+
+<P>This program outputs:</P>
+
+<PRE class="output">
+<!-- START OUTPUT examples5/test5.3.1-bin -->
+</PRE>
+
+<P>using the label of the left most channel that is turned on.</P>
+
+<P>If we turn off <CODE>dc::elephant</CODE>:</P>
+
+<P class="download">[<A HREF="examples5/test5.3.2.cc">download</A>]</P>
+<PRE>
+<!-- START CODE examples5/test5.3.2.cc -->
+#include "sys.h"
+#include "debug.h"
+
+int main(void)
+{
+ // Start with everything turned on:
+ Debug( libcw_do.on() );
+ ForAllDebugChannels( if (!debugChannel.is_on()) debugChannel.on() );
+
+ <SPAN class="highlight">Debug( dc::elephant.off() );</SPAN>
+ Dout( dc::elephant|dc::owl, "The elephant is called Dumbo, the owl is called Einstein." );
+
+ return 0;
+}
+<!-- END CODE examples5/test5.3.2.cc -->
+</PRE>
+
+<P>Then the program outputs</P>
+
+<PRE class="output">
+<!-- START OUTPUT examples5/test5.3.2-bin -->
+</PRE>
+
+<A NAME="Formatting"></A>
+<H3>5.4 Formatting debug output</H3>
+
+<P>It is possible to control the format of debug output in two different ways:</P>
+<OL TYPE=1>
+<LI>Per call to Dout, using control flags.
+<LI>Persistantly per debug object, using methods of the debug object.
+</OL>
+
+<A NAME="Control"></A>
+<H4>5.4.1 Control flags</H4>
+
+<P>Control flags are unsigned integer bit-masks and are passed along to
+<CODE>Dout</CODE> together with the debug channel(s).
+For example, in the following code the newline that is normally printed after
+each output is suppressed in the first call:</P>
+
+<P class="download">[<A HREF="examples5/test5.4.1.cc">download</A>]</P>
+<PRE>
+<!-- START CODE examples5/test5.4.1.cc -->
+#include "sys.h"
+#include "debug.h"
+
+int main(void)
+{
+ Debug( libcw_do.on() );
+ Debug( dc::notice.on() );
+
+ Dout( dc::notice|nonewline_cf, "Hello, " );
+ Dout( dc::notice, "World" );
+
+ return 0;
+}
+<!-- END CODE examples5/test5.4.1.cc -->
+</PRE>
+
+<P>This program outputs:</P>
+
+<PRE class="output">
+<!-- START OUTPUT examples5/test5.4.1-bin -->
+</PRE>
+
+<P>In order to supress the <EM>prefix</EM> in the second call we use
+<CODE>noprefix_cf</CODE>:</P>
+
+<P class="download">[<A HREF="examples5/test5.4.2.cc">download</A>]</P>
+<PRE>
+<!-- START CODE examples5/test5.4.2.cc -->
+#include "sys.h"
+#include "debug.h"
+
+int main(void)
+{
+ Debug( libcw_do.on() );
+ Debug( dc::notice.on() );
+
+ Dout( dc::notice|nonewline_cf, "Hello, " );
+ Dout( dc::notice|<SPAN class="highlight">noprefix_cf</SPAN>, "World" );
+
+ return 0;
+}
+<!-- END CODE examples5/test5.4.2.cc -->
+</PRE>
+
+<P>Now the output is</P>
+
+<PRE class="output">
+<!-- START OUTPUT examples5/test5.4.2-bin -->
+</PRE>
+
+<P>There are in total eleven <EM>control flags</EM>,
+see the <A HREF="../html/reference.html">Reference Manual</A>
+for an <A HREF="../html/group__group__control__flags.html">overview</A>.</P>
+
+<P>Lets get a little bit more practical now.
+In the next example we perform a system call and write this fact to <CODE>dc::notice</CODE>
+in the same way as <SPAN class="filename">strace(1)</SPAN> would do; the fact that the call is made
+is printed first. After the call returns we print the results.</P>
+
+<P class="download">[<A HREF="examples5/test5.4.3.cc">download</A>]</P>
+<PRE>
+<!-- START CODE examples5/test5.4.3.cc -->
+#include "sys.h"
+#include "debug.h"
+#include <sys/stat.h>
+#include <unistd.h>
+
+std::ostream& operator<<(std::ostream& os, struct stat const buf)
+{
+ os << "inode:" << buf.st_ino << "; " << "size:" << buf.st_size;
+ return os;
+}
+
+std::ostream& operator<<(std::ostream& os, struct stat const* bufp)
+{
+ os << "{ " << *bufp << " }";
+ return os;
+}
+
+int main(int argc, char* argv[])
+{
+ Debug( libcw_do.on() );
+ Debug( dc::notice.on() );
+
+ if (argc != 2)
+ {
+ std::cerr << "Usage: " << argv[0] << " <file_name>\n";
+ exit(-1);
+ }
+
+ char const* file_name = argv[1];
+ struct stat buf;
+
+ // Warning: this is NOT the correct way to do this (see below)
+ Dout( dc::notice|nonewline_cf,
+ "stat(\"" << file_name << "\", " );
+
+ int ret = stat(file_name, &buf);
+
+ Dout( dc::notice|noprefix_cf|cond_error_cf(ret != 0),
+ &buf << ") = " << ret );
+
+ return 0;
+}
+<!-- END CODE examples5/test5.4.3.cc -->
+</PRE>
+
+<P>Note the use of <CODE>cond_error_cf(<EM>condition</EM>)</CODE> which is equal to
+<CODE>error_cf</CODE> if the condition passed is true, or zero otherwise.
+The result of <CODE>error_cf</CODE> is that an error message is printed
+after the debug output according to the current value of <CODE>errno</CODE>.
+When we run this program with parameter "/bin/ls" we get something like:</P>
+
+<PRE class="output">
+<!-- START OUTPUT examples5/test5.4.3-bin /bin/ls -->
+</PRE>
+
+<P>And when we use a file that doesn't exist, we get something like:</P>
+
+<PRE class="output">
+NOTICE : stat("foobar", { inode:134572072; size:1 }) = -1: ENOENT (No such file or directory)
+</PRE>
+
+<P>As you already might have noticed from the comment in the program, this is not
+the correct way to do this. The reason that it is wrong is because the call
+to <CODE>stat</CODE> could cause debug output itself. Well, it
+couldn't in this case, but in a more general case it could :).</P>
+
+<P>Let us replace the call to <CODE>stat</CODE> by a function of
+ourselfs that allocates memory (as certain system calls could do too!):</P>
+
+<P class="download">[<A HREF="examples5/test5.4.4.cc">download</A>]</P>
+<PRE>
+<!-- START CODE examples5/test5.4.4.cc -->
+#include "sys.h"
+#include "debug.h"
+#include <sys/stat.h>
+#include <unistd.h>
+
+std::ostream& operator<<(std::ostream& os, struct stat const buf)
+{
+ os << "inode:" << buf.st_ino << "; " << "size:" << buf.st_size;
+ return os;
+}
+
+std::ostream& operator<<(std::ostream& os, struct stat const* bufp)
+{
+ os << "{ " << *bufp << " }";
+ return os;
+}
+
+// We only use this function to show what happens with the debug output,
+// you shouldn't do anything like this in a real program.
+int stat_with_buf_alloc(char const* file_name, struct stat*& bufp)
+{
+ bufp = new struct stat;
+ return stat(file_name, bufp);
+}
+
+int main(int argc, char* argv[])
+{
+ Debug( libcw_do.on() );
+ Debug( dc::notice.on() );
+ <SPAN class="highlight">Debug( dc::malloc.on() );</SPAN>
+
+ if (argc != 2)
+ {
+ std::cerr << "Usage: " << argv[0] << " <file_name>\n";
+ exit(-1);
+ }
+
+ char const* file_name = argv[1];
+ struct stat<SPAN class="highlight">*</SPAN> buf<SPAN class="highlight">p</SPAN>;
+
+ // This is NOT the correct way to do this.
+ Dout( dc::notice|nonewline_cf,
+ "stat_with_buf_alloc(\"" << file_name << "\", " );
+
+ int ret = stat<SPAN class="highlight">_with_buf_alloc</SPAN>(file_name, buf<SPAN class="highlight">p</SPAN>);
+
+ Dout( dc::notice|noprefix_cf|cond_error_cf(ret != 0),
+ bufp << ") = " << ret );
+
+ <SPAN class="highlight">
+ Debug( dc::malloc.off() );
+ delete bufp;</SPAN>
+ return 0;
+}
+<!-- END CODE examples5/test5.4.4.cc -->
+</PRE>
+
+<P>Now the call (to <CODE>stat_with_buf_alloc</CODE>) writes debug output
+itself which is completely messing up our beautiful attempt to look like the
+output of <SPAN class="filename">strace(1)</SPAN>:</P>
+
+<PRE class="output">
+<!-- START OUTPUT examples5/test5.4.4-bin /bin/ls -->
+</PRE>
+
+<A NAME="interrupted"></A>
+<P>Therefore it isn't a good idea to use <CODE>nonewline_cf</CODE> and <CODE>noprefix_cf</CODE> like this.
+Use instead <CODE>continued_cf</CODE>, <CODE>dc::continued</CODE> and <CODE>dc::finish</CODE>
+which are designed especially for <EM>interrupted debug output</EM>:</P>
+
+<P class="download">[<A HREF="examples5/test5.4.5.cc">download</A>]</P>
+<PRE>
+<!-- START CODE examples5/test5.4.5.cc -->
+#include "sys.h"
+#include "debug.h"
+#include <sys/stat.h>
+#include <unistd.h>
+
+std::ostream& operator<<(std::ostream& os, struct stat const buf)
+{
+ os << "inode:" << buf.st_ino << "; " << "size:" << buf.st_size;
+ return os;
+}
+
+std::ostream& operator<<(std::ostream& os, struct stat const* bufp)
+{
+ os << "{ " << *bufp << " }";
+ return os;
+}
+
+// We only use this function to show what happens with the debug output,
+// you shouldn't do anything like this in a real program.
+int stat_with_buf_alloc(char const* file_name, struct stat*& bufp)
+{
+ bufp = new struct stat;
+ return stat(file_name, bufp);
+}
+
+int main(int argc, char* argv[])
+{
+ Debug( libcw_do.on() );
+ Debug( dc::notice.on() );
+ Debug( dc::malloc.on() );
+
+ if (argc != 2)
+ {
+ std::cerr << "Usage: " << argv[0] << " <file_name>\n";
+ exit(-1);
+ }
+
+ char const* file_name = argv[1];
+ struct stat* bufp;
+
+ Dout( dc::notice|<SPAN class="highlight">continued_cf</SPAN>,
+ "stat_with_buf_alloc(\"" << file_name << "\", " );
+
+ int ret = stat_with_buf_alloc(file_name, bufp);
+
+ Dout( <SPAN class="highlight">dc::finish</SPAN>|cond_error_cf(ret != 0),
+ bufp << ") = " << ret );
+
+ Debug( dc::malloc.off() );
+ delete bufp;
+ return 0;
+}
+<!-- END CODE examples5/test5.4.5.cc -->
+</PRE>
+
+<P>Now the output looks like</P>
+
+<PRE class="output">
+<!-- START OUTPUT examples5/test5.4.5-bin /bin/ls -->
+</PRE>
+
+<A NAME="Methods"></A>
+<H4>5.4.2 Methods of the debug object</H4>
+
+<P>You can also change the format of debug output by calling methods of the debug object.
+Consider the following example:</P>
+
+<P class="download">[<A HREF="examples5/test5.4.6.cc">download</A>]</P>
+<PRE>
+<!-- START CODE examples5/test5.4.6.cc -->
+#include "sys.h"
+#include "debug.h"
+
+int main(void)
+{
+ Debug( libcw_do.on() );
+ ForAllDebugChannels( if (!debugChannel.is_on()) debugChannel.on() );
+
+ Debug( libcw_do.<SPAN class="highlight">set_margin</SPAN>("<-- margin -->") );
+ Debug( libcw_do.<SPAN class="highlight">set_marker</SPAN>("<-- marker -->") );
+ Dout( dc::cat|dc::mouse, "The cat chases the mouse." );
+ Dout( dc::mouse|dc::elephant, "The mouse chases the elephant." );
+ Dout( dc::notice|<SPAN class="highlight">nolabel_cf</SPAN>, "Setting indentation to 8 spaces:" );
+ Dout( dc::notice|<SPAN class="highlight">blank_label_cf</SPAN>, "<------>" );
+ Debug( libcw_do.<SPAN class="highlight">set_indent(8)</SPAN> );
+ Dout( dc::cat, "The cat sleeps." );
+ Dout( dc::elephant, "The elephant looks around:" );
+ Dout( dc::elephant|<SPAN class="highlight">blank_label_cf|blank_marker_cf</SPAN>, "where did the mouse go?" );
+
+ return 0;
+}
+<!-- END CODE examples5/test5.4.6.cc -->
+</PRE>
+
+<P>This program outputs:</P>
+<PRE class="output">
+<!-- START OUTPUT examples5/test5.4.6-bin -->
+</PRE>
+
+<P>This concludes the first part of this tutorial about debug output.
+The following chapters handle the memory allocation debugging support of libcwd.</P>
+
+__PAGEEND
+<P class="line"><IMG width=870 height=25 src="../images/lines/owl.png"></P>
+<DIV class="buttons">
+<A HREF="tut4.html"><IMG width=64 height=32 src="../images/buttons/lr_prev.png" border="0"></A>
+<A HREF="index.html"><IMG width=64 height=32 src="../images/buttons/lr_index.png" border="0"></A>
+<A HREF="tut6.html"><IMG width=64 height=32 src="../images/buttons/lr_next.png" border="0"></A>
+</DIV>
+__PAGEFOOTER
+__HTMLFOOTER
Index: src/libcwd/documentation/tutorial/tut5.m4
diff -u src/libcwd/documentation/tutorial/tut5.m4:1.1.2.1 src/libcwd/documentation/tutorial/tut5.m4:removed
--- src/libcwd/documentation/tutorial/tut5.m4:1.1.2.1 Thu Dec 27 20:11:59 2001
+++ src/libcwd/documentation/tutorial/tut5.m4 Sat Dec 29 17:22:20 2001
@@ -1,682 +0,0 @@
-include(definitions.m4)dnl
-__HTMLHEADER
-__PAGEHEADER
-__PAGESTART
-
-<H2>Tutorial 5: Advanced examples</H2>
-
-<P>In this tutorial you will learn how to list all debugging channels
-and how to write a loop that runs over all existing debug channels.
-You will make four debug channels in their own namespace and write debug output to a combination of them.
-You will also learn how to add an error message after a debug message, how to format a debug message,
-how to supress the label and how to supress the newline at the end.
-Finally you will learn how to write interrupted debug output
-in an example that prints the call to a system call and the result of that.</P>
-
-<A NAME="Running"></A>
-<H3>5.1 Running over all Debug Channels</H3>
-
-<P>In <A HREF="tut2.html">tutorial 2</A> you have learned how to create new Debug Channels.
-Each new Debug Channel is stored in an internal list, allowing
-you to loop over all debug channels without knowing exactly which ones exist.
-For example, the following code will <A HREF="tut1.html#turn_on_channel">turn on</A> all
-debug channels. It is not allowed to call <CODE>on()</CODE>
-for a Debug Channel that is already <I>on</I>: that will result in a runtime error.</P>
-
-<P>A special shortcut function is provided to list all debug channels,
-the following code prints a list of all channels after they have been turned on.</P>
-
-<P>Compile as: <SPAN class="shell-command">g++ -g -DCWDEBUG turn_on.cc -lcwd -o turn_on</SPAN></P>
-<P class="download">[<A HREF="examples5/tut5.1/turn_on.cc">download</A>]</P>
-<PRE>
-<!-- START CODE examples5/tut5.1/turn_on.cc -->
-#include "sys.h" // See tutorial 2
-#include <libcw/debug.h>
-
-int main(void)
-{
- // Turn on debug object `libcw_do'.
- Debug( libcw_do.on() );
-
- // Turn on all debug channels that are off.
- <SPAN class="highlight">ForAllDebugChannels(</SPAN>
- if (!<SPAN class="highlight">debugChannel</SPAN>.is_on())
- <SPAN class="highlight">debugChannel</SPAN>.on();
- <SPAN class="highlight">);</SPAN>
-
- // Print a listing of all debug channels to debug object `libcw_do'.
- Debug( <SPAN class="highlight">list_channels_on(</SPAN>libcw_do<SPAN class="highlight">)</SPAN> );
-
- return 0;
-}
-<!-- END CODE examples5/tut5.1/turn_on.cc -->
-</PRE>
-
-<P>This program outputs:</P>
-
-<PRE class="output">
-<!-- START OUTPUT examples5/tut5.1/turn_on.cc turn_on -->
-BFD : Loading debug info from /home/carlo/c++/libcw_branch-threading/src/libcwd/documentation/tutorial/examples5/tut5.1/turn_on... done (71 symbols)
-BFD : Loading debug info from /home/carlo/c++/libcw_branch-threading/src/libcwd/.libs/libcwd.so.0 (0x40018000) ... done (854 symbols)
-BFD : Loading debug info from /usr/lib/libstdc++-libc6.2-2.so.3 (0x40069000) ... done (1602 symbols)
-BFD : Loading debug info from /lib/i686/libm.so.6 (0x400ab000) ... done (1430 symbols)
-BFD : Loading debug info from /lib/i686/libc.so.6 (0x400ce000) ... done (4189 symbols)
-BFD : Loading debug info from /lib/libdl.so.2 (0x40208000) ... done (52 symbols)
-BFD : Loading debug info from /lib/ld-linux.so.2 (0x40000000) ... done (281 symbols)
-BFD : Enabled
-DEBUG : Enabled
-MALLOC : Enabled
-NOTICE : Enabled
-SYSTEM : Enabled
-WARNING : Enabled
-<!-- END OUTPUT examples5/tut5.1/turn_on.cc -->
-</PRE>
-
-<A NAME="Debug"></A>
-<H3>5.2 Debug Channels and name spaces</H3>
-
-<P>The custom debug channel <CODE>dc::ghost</CODE> that you created
-in <A HREF="tut2.html">tutorial 2</A> was put in <CODE>namespace debug_channels</CODE>.
-The debug channels of libcw are put in namespace <CODE>libc...
[truncated message content] |
|
From: Carlo W. <li...@us...> - 2001-12-30 02:05:37
|
CVSROOT : /cvsroot/libcw
Module : src
Branch tags: branch-threading
Commit time: 2001-11-30 02:05:36 UTC
Modified files:
Tag: branch-threading
libcwd/documentation/tutorial/Makefile
Log message:
Bug fixes, better dependencies and more bug fixes.
---------------------- diff included ----------------------
Index: src/libcwd/documentation/tutorial/Makefile
diff -u src/libcwd/documentation/tutorial/Makefile:1.1.2.2 src/libcwd/documentation/tutorial/Makefile:1.1.2.3
--- src/libcwd/documentation/tutorial/Makefile:1.1.2.2 Sat Dec 29 17:22:09 2001
+++ src/libcwd/documentation/tutorial/Makefile Sat Dec 29 18:05:26 2001
@@ -20,10 +20,10 @@
tut7.m4: tut7.in $(AOUT7)
awk -f moo.awk $< > $@
-$(SOURCES5): tut5.in ../../.libs/libcwd.so
+$(SOURCES5): tut5.in
@$(MAKE) -s $@-cc
-$(SOURCES7): tut7.in ../../.libs/libcwd.so
+$(SOURCES7): tut7.in
@$(MAKE) -s $@-cc
%-cc:
@@ -47,16 +47,16 @@
exit 1; \
fi
-examples5/%-bin: %.cc examples5/debug.o examples5/sys.h
+examples5/%-bin: examples5/%.cc examples5/debug.o examples5/debug.h examples5/sys.h examples5/sysinclude/libbooster/debug.h examples5/sysinclude/libturbo/debug.h ../../.libs/libcwd.so
$(CXX) -g -pipe -DCWDEBUG -Iexamples5 -I- -Iexamples5/sysinclude -I../../include \
- $< examples5/debug.o -L../../.libs/libcwd.so -Wl,-rpath,$(shell (../../.libs; pwd)) -lcwd -o $@
+ $< examples5/debug.o -L../../.libs -Wl,-rpath,$(shell (cd ../../.libs; pwd)) -lcwd -o $@
-examples5/debug.o: examples5/debug.cc
+examples5/debug.o: examples5/debug.cc examples5/debug.h examples5/sys.h examples5/sysinclude/libbooster/debug.h examples5/sysinclude/libturbo/debug.h
$(CXX) -g -pipe -DCWDEBUG -Iexamples5 -Iexamples5/sysinclude -I../../include -c $< -o $@
-examples7/%-bin: %.cc examples7/sys.h examples7/debug.h
+examples7/%-bin: examples7/%.cc examples7/sys.h examples7/debug.h ../../.libs/libcwd.so
$(CXX) -g -pipe -DCWDEBUG -Iexamples7 -I- -I../../include \
- $< -L../../.libs/libcwd.so -Wl,-rpath,$(shell (../../.libs; pwd)) -lcwd -o $@
+ $< -L../../.libs -Wl,-rpath,$(shell (cd ../../.libs; pwd)) -lcwd -o $@
maintainer-clean:
rm -f examples5/debug.* examples5/test* core examples7/test* tut5.m4 tut7.m4 *.html
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-30 02:07:28
|
CVSROOT : /cvsroot/libcw
Module : src
Branch tags: branch-threading
Commit time: 2001-11-30 02:07:27 UTC
Modified files:
Tag: branch-threading
libcwd/documentation/tutorial/.cvsignore
libcwd/documentation/tutorial/Makefile
Added files:
Tag: branch-threading
libcwd/documentation/tutorial/examples7/.cvsignore
Log message:
Build system now works.
---------------------- diff included ----------------------
Index: src/libcwd/documentation/tutorial/.cvsignore
diff -u src/libcwd/documentation/tutorial/.cvsignore:1.1.2.1 src/libcwd/documentation/tutorial/.cvsignore:1.1.2.2
--- src/libcwd/documentation/tutorial/.cvsignore:1.1.2.1 Thu Dec 27 20:11:59 2001
+++ src/libcwd/documentation/tutorial/.cvsignore Sat Dec 29 18:07:17 2001
@@ -1,7 +1,6 @@
hello_world
channel
log_file
-turn_on
-amo.cc
-amo
*.html
+tut5.m4
+tut7.m4
Index: src/libcwd/documentation/tutorial/Makefile
diff -u src/libcwd/documentation/tutorial/Makefile:1.1.2.3 src/libcwd/documentation/tutorial/Makefile:1.1.2.4
--- src/libcwd/documentation/tutorial/Makefile:1.1.2.3 Sat Dec 29 18:05:26 2001
+++ src/libcwd/documentation/tutorial/Makefile Sat Dec 29 18:07:17 2001
@@ -22,6 +22,7 @@
$(SOURCES5): tut5.in
@$(MAKE) -s $@-cc
+ @rm -f core
$(SOURCES7): tut7.in
@$(MAKE) -s $@-cc
Index: src/libcwd/documentation/tutorial/examples7/.cvsignore
diff -u /dev/null src/libcwd/documentation/tutorial/examples7/.cvsignore:1.1.2.1
--- /dev/null Sat Dec 29 18:07:27 2001
+++ src/libcwd/documentation/tutorial/examples7/.cvsignore Sat Dec 29 18:07:17 2001
@@ -0,0 +1 @@
+test*
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-30 02:18:33
|
CVSROOT : /cvsroot/libcw
Module : src
Branch tags: branch-threading
Commit time: 2001-11-30 02:18:33 UTC
Modified files:
Tag: branch-threading
libcwd/documentation/tutorial/Makefile
libcwd/documentation/tutorial/tut5.in
Log message:
Removed a 'touch'.
---------------------- diff included ----------------------
Index: src/libcwd/documentation/tutorial/Makefile
diff -u src/libcwd/documentation/tutorial/Makefile:1.1.2.4 src/libcwd/documentation/tutorial/Makefile:1.1.2.5
--- src/libcwd/documentation/tutorial/Makefile:1.1.2.4 Sat Dec 29 18:07:17 2001
+++ src/libcwd/documentation/tutorial/Makefile Sat Dec 29 18:18:23 2001
@@ -40,7 +40,6 @@
mv $*.tmp $*; \
else \
echo "$* wasn't changed."; \
- touch $*; \
rm $*.tmp; \
fi; \
else \
Index: src/libcwd/documentation/tutorial/tut5.in
diff -u src/libcwd/documentation/tutorial/tut5.in:1.1.2.1 src/libcwd/documentation/tutorial/tut5.in:1.1.2.2
--- src/libcwd/documentation/tutorial/tut5.in:1.1.2.1 Sat Dec 29 17:22:09 2001
+++ src/libcwd/documentation/tutorial/tut5.in Sat Dec 29 18:18:23 2001
@@ -491,8 +491,8 @@
return os;
}
-// We only use this function to show what happens with the debug output,
-// you shouldn't do anything like this in a real program.
+// We only use this function to show what happens with the debug output.
+// You shouldn't do anything like this in a real program.
int stat_with_buf_alloc(char const* file_name, struct stat*& bufp)
{
bufp = new struct stat;
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-30 02:37:32
|
CVSROOT : /cvsroot/libcw
Module : src
Branch tags: branch-threading
Commit time: 2001-11-30 02:37:30 UTC
Modified files:
Tag: branch-threading
libcwd/documentation/Makefile
libcwd/documentation/styles/tutorial.css
Log message:
Removed TODO file.
---------------------- diff included ----------------------
Index: src/libcwd/documentation/Makefile
diff -u src/libcwd/documentation/Makefile:1.1.2.4 src/libcwd/documentation/Makefile:1.1.2.5
--- src/libcwd/documentation/Makefile:1.1.2.4 Thu Dec 27 20:11:58 2001
+++ src/libcwd/documentation/Makefile Sat Dec 29 18:37:20 2001
@@ -35,5 +35,5 @@
$(MAKE) -C styles
tutorial:
- $(MAKE) -C tutorial
+ $(MAKE) -s -C tutorial
Index: src/libcwd/documentation/styles/tutorial.css
diff -u src/libcwd/documentation/styles/tutorial.css:1.1.2.1 src/libcwd/documentation/styles/tutorial.css:1.1.2.2
--- src/libcwd/documentation/styles/tutorial.css:1.1.2.1 Wed Dec 26 21:12:10 2001
+++ src/libcwd/documentation/styles/tutorial.css Sat Dec 29 18:37:20 2001
@@ -5,7 +5,7 @@
*/
DIV.body {
- margin-left : 2cm;
+ margin-left : 1cm;
margin-right : 0;
}
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-30 04:18:06
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2001-11-30 04:18:01 UTC
Modified files:
libcwd/INSTALL libcwd/Makefile.am libcwd/NEWS libcwd/README
libcwd/acinclude.m4 libcwd/bfd.cc libcwd/configure.in
libcwd/debug.cc libcwd/debugmalloc.cc libcwd/demangle.cc
libcwd/demangle3.cc libcwd/elf32.cc libcwd/libcwd.spec.in
libcwd/maintMakefile.in libcwd/strerrno.cc libcwd/type_info.cc
libcwd/example-project/.cvsignore
libcwd/example-project/Makefile.am
libcwd/example-project/configure.in
libcwd/example-project/debug.cc
libcwd/example-project/macrotest.cc
libcwd/example-project/program.cc libcwd/example-project/sys.h
libcwd/include/Makefile.am libcwd/include/sys.ho.in
libcwd/include/libcw/Makefile.am libcwd/include/libcw/bfd.h
libcwd/include/libcw/buf2str.h libcwd/include/libcw/char2str.h
libcwd/include/libcw/cwprint.h libcwd/include/libcw/debug.h
libcwd/include/libcw/debug_config.ho.in
libcwd/include/libcw/debugmalloc.h
libcwd/include/libcw/demangle.h
libcwd/include/libcw/lockable_auto_ptr.h
libcwd/include/libcw/strerrno.h libcwd/include/libcw/sysd.ho.in
libcwd/include/libcw/type_info.h libcwd/tests/.cvsignore
libcwd/tests/Makefile.am libcwd/tests/dout_alloc.cc
libcwd/tests/hello_world.cc libcwd/tests/hello_world_debug.h
libcwd/tests/initbug.cc libcwd/tests/syslog.cc
libcwd/tests/syslog_debug.h libcwd/testsuite/Makefile.in
libcwd/testsuite/module.cc
libcwd/testsuite/libcwd.tst/alloctag.cc
libcwd/testsuite/libcwd.tst/alloctag.re
libcwd/testsuite/libcwd.tst/bfd.cc
libcwd/testsuite/libcwd.tst/bfd.re
libcwd/testsuite/libcwd.tst/cf.cc
libcwd/testsuite/libcwd.tst/continued.cc
libcwd/testsuite/libcwd.tst/dc.cc
libcwd/testsuite/libcwd.tst/debug.h
libcwd/testsuite/libcwd.tst/demangler.cc
libcwd/testsuite/libcwd.tst/demangler.re
libcwd/testsuite/libcwd.tst/dlopen.cc
libcwd/testsuite/libcwd.tst/dlopen.re
libcwd/testsuite/libcwd.tst/do.cc
libcwd/testsuite/libcwd.tst/do.re
libcwd/testsuite/libcwd.tst/flush.cc
libcwd/testsuite/libcwd.tst/leak.cc
libcwd/testsuite/libcwd.tst/leak.re
libcwd/testsuite/libcwd.tst/lockable_auto_ptr.cc
libcwd/testsuite/libcwd.tst/magic.cc
libcwd/testsuite/libcwd.tst/marker.cc
libcwd/testsuite/libcwd.tst/test.exp
libcwd/testsuite/libcwd.tst/test_delete.cc
libcwd/testsuite/libcwd.tst/test_delete.re
libcwd/testsuite/libcwd.tst/type_info.cc libcwd/utils/Makefile.am
libcwd/utils/buf2str.cc libcwd/utils/char2str.cc
libcwd/utils/exec_prog.cc
Added files:
libcwd/threading.cc libcwd/documentation/.cvsignore
libcwd/documentation/Makefile libcwd/documentation/README
libcwd/documentation/alloc_intro.dox
libcwd/documentation/allocated_memory_overview.dox
libcwd/documentation/control_flags.dox
libcwd/documentation/custom-debug.h.dox
libcwd/documentation/custom_do.dox
libcwd/documentation/deallocation_pointer_validation.dox
libcwd/documentation/debug_channels.dox
libcwd/documentation/debug_object.dox
libcwd/documentation/definitions.m4
libcwd/documentation/destination.dox
libcwd/documentation/downloading.dox
libcwd/documentation/doxygen.config
libcwd/documentation/fatal_output.dox
libcwd/documentation/finding.dox
libcwd/documentation/formatting.dox
libcwd/documentation/html.footer libcwd/documentation/html.header
libcwd/documentation/invisible.dox
libcwd/documentation/location.dox
libcwd/documentation/locations.dox libcwd/documentation/magic.dox
libcwd/documentation/mainpage.dox
libcwd/documentation/memory_leak_checking.dox
libcwd/documentation/modules.dox
libcwd/documentation/namespaces.dox
libcwd/documentation/nested.dox
libcwd/documentation/preparation.dox
libcwd/documentation/reference.dox
libcwd/documentation/special.dox
libcwd/documentation/symbols_intro.dox
libcwd/documentation/type_info.dox
libcwd/documentation/why_macro.dox
libcwd/documentation/writing_intro.dox
libcwd/documentation/doxygen-examples/markers.cc
libcwd/documentation/external/.cvsignore
libcwd/documentation/images/libcw_magic.png
libcwd/documentation/images/libcwd_logo.png
libcwd/documentation/images/toc.png
libcwd/documentation/images/wink.gif
libcwd/documentation/images/buttons/lr_index.png
libcwd/documentation/images/buttons/lr_next.png
libcwd/documentation/images/buttons/lr_prev.png
libcwd/documentation/images/lines/cat.png
libcwd/documentation/images/lines/caterpil.png
libcwd/documentation/images/lines/ghost.png
libcwd/documentation/images/lines/hippo.png
libcwd/documentation/images/lines/mouse.png
libcwd/documentation/images/lines/owl.png
libcwd/documentation/images/lines/snail.png
libcwd/documentation/scripts/break_out_of_frame.js
libcwd/documentation/scripts/detect_browser.js
libcwd/documentation/scripts/load_style_sheets.js
libcwd/documentation/styles/.cvsignore
libcwd/documentation/styles/Makefile
libcwd/documentation/styles/defines.h
libcwd/documentation/styles/doxygen.css
libcwd/documentation/styles/main.css
libcwd/documentation/styles/test.m4
libcwd/documentation/styles/tutorial.css
libcwd/documentation/styles/ie/.cvsignore
libcwd/documentation/styles/konqueror/.cvsignore
libcwd/documentation/styles/mozilla/.cvsignore
libcwd/documentation/styles/netscape4/.cvsignore
libcwd/documentation/styles/netscape6/.cvsignore
libcwd/documentation/tutorial/.cvsignore
libcwd/documentation/tutorial/Makefile
libcwd/documentation/tutorial/channel.cc
libcwd/documentation/tutorial/faq.m4
libcwd/documentation/tutorial/hello_world.cc
libcwd/documentation/tutorial/index.m4
libcwd/documentation/tutorial/intro.m4
libcwd/documentation/tutorial/log_file.cc
libcwd/documentation/tutorial/moo.awk
libcwd/documentation/tutorial/tut1.m4
libcwd/documentation/tutorial/tut2.m4
libcwd/documentation/tutorial/tut3.m4
libcwd/documentation/tutorial/tut4.m4
libcwd/documentation/tutorial/tut5.in
libcwd/documentation/tutorial/tut6.m4
libcwd/documentation/tutorial/tut7.in
libcwd/documentation/tutorial/examples7/.cvsignore
libcwd/documentation/tutorial/examples7/debug.h
libcwd/documentation/tutorial/examples7/sys.h
libcwd/example-project/acconfig.h
libcwd/example-project/debug.h.maintainer
libcwd/include/cwd_debug.h libcwd/include/elf32.h
libcwd/include/exec_prog.h libcwd/include/ios_base_Init.h
libcwd/include/private_debug_stack.inl
libcwd/include/libcw/class_alloc.h
libcwd/include/libcw/class_channel.h
libcwd/include/libcw/class_channel.inl
libcwd/include/libcw/class_channel_set.h
libcwd/include/libcw/class_channel_set.inl
libcwd/include/libcw/class_continued_channel.h
libcwd/include/libcw/class_continued_channel.inl
libcwd/include/libcw/class_debug.h
libcwd/include/libcw/class_debug.inl
libcwd/include/libcw/class_debug_string.h
libcwd/include/libcw/class_debug_string.inl
libcwd/include/libcw/class_fatal_channel.h
libcwd/include/libcw/class_fatal_channel.inl
libcwd/include/libcw/class_location.h
libcwd/include/libcw/class_location.inl
libcwd/include/libcw/class_marker.h
libcwd/include/libcw/control_flag.h
libcwd/include/libcw/core_dump.h
libcwd/include/libcw/enum_memblk_types.h
libcwd/include/libcw/macro_AllocTag.h
libcwd/include/libcw/macro_ForAllDebugChannels.h
libcwd/include/libcw/macro_ForAllDebugObjects.h
libcwd/include/libcw/macro_Libcwd_macros.h
libcwd/include/libcw/max_label_len.h
libcwd/include/libcw/pc_mangled_function_name.h
libcwd/include/libcw/private_TSD.h
libcwd/include/libcw/private_allocator.h
libcwd/include/libcw/private_assert.h
libcwd/include/libcw/private_debug_stack.h
libcwd/include/libcw/private_internal_string.h
libcwd/include/libcw/private_internal_stringstream.h
libcwd/include/libcw/private_internal_vector.h
libcwd/include/libcw/private_set_alloc_checking.h
libcwd/include/libcw/private_threading.h
libcwd/tests/allocator.cc libcwd/tests/stabs.cc
libcwd/tests/threads.cc libcwd/tests/threads2.cc
libcwd/tests/threads3.cc libcwd/tests/threads4.cc
libcwd/tests/threads_debug.h libcwd/testsuite/libcwd.tst/sys.h
Removed files:
libcwd/README.nodebug.h libcwd/cwprint.cc
libcwd/debugdebugcheckpoint.cc
libcwd/no_alloc_checking_stringstream.cc
libcwd/example-project/debug.h
libcwd/example-project/maintMakefile.in
libcwd/include/libcw/bcd2str.h
libcwd/include/libcw/debugdebugcheckpoint.h
libcwd/include/libcw/elf32.h libcwd/include/libcw/exec_prog.h
libcwd/include/libcw/iomanip.h
libcwd/include/libcw/no_alloc_checking_stringstream.h
libcwd/include/libcw/perf.h libcwd/testsuite/libcwd.tst/undef.cc
libcwd/testsuite/libcwd.tst/undef.re libcwd/utils/bcd2str.cc
libcwd/utils/perf.cc
Log message:
Merge from branch-threading.
---------------------- diff included ----------------------
Index: src/libcwd/INSTALL
diff -u src/libcwd/INSTALL:1.21 src/libcwd/INSTALL:1.22
--- src/libcwd/INSTALL:1.21 Sat Sep 22 22:01:08 2001
+++ src/libcwd/INSTALL Sat Dec 29 20:17:46 2001
@@ -3,6 +3,7 @@
./configure --prefix=/usr
make
+su
make install
If that doesn't work, mail me: li...@al...
@@ -14,101 +15,109 @@
Check if you have all GNU tools/libraries/packages that libcwd depends on:
- Primary site:
- ftp://ftp.gnu.org/gnu/
+Primary site:
+ftp://ftp.gnu.org/gnu/
- List of mirrors:
- http://www.gnu.org/order/ftp.html
+List of mirrors:
+http://www.gnu.org/order/ftp.html
- Packages/versions needed
- ------------------------
+Packages/versions needed
+------------------------
- i) The GNU compiler, version 2.95.1 or higher.
-
- Location: gnu/gcc/
- Current version: 3.0
-
- Alternatively you can install only
- ia) gnu/gcc/gcc-core-<version>.tar.gz and
- ib) gnu/gcc/gcc-g++-<version>.tar.gz
-
- Note: It is very unlikely that you want to install
- the source tree of gcc/g++. Please try to upgrade your
- compiler the usual way if needed.
- If you are using rpm's then you will need to
- install/upgrade the following:
- gcc (2.95.1 or higher),
- gcc-c++ (of same version),
- libstdc++ (of same version) and
- cpp (of same version).
- Check your installation on RedHat with:
- rpm -qa | egrep '(gcc|libstdc|cpp)'
-
- Note: If you don't use rpm's but are using tar balls,
- then you do NOT need to download gnu/libstdc++/* because
- gcc-2.95 and higher comes with libstdc++ included.
- The gnu/libstdc++/ directory on GNU ftp sites are
- for older compilers or to be used as source drop-in
- when you compile g++ (replacing the normal stdc++ with
- an alpha version). You also don't need libg++.
- Don't delete those libraries if you have them though
- since existing binaries might need to link with them.
-
- libcwd-0.99.15 was tested with gcc-2.95.x, gcc-2.96-97 (RedHat),
- gcc-3.0 and gcc-3.0.1.
-
- Packages needed to run the testsuite
- ------------------------------------
-
- If you want to run the testsuite then you will have to install
- dejagnu-1.4.1 which can be downloaded from ftp://ftp.gnu.org/gnu/dejagnu/,
- or your local GNU mirror. However, this version still contains a bug
- and you'll have to apply the following patch: edit /usr/share/dejagnu/target.exp
- line 275 and remove the newline at the end (so that the word "text" on line
- 276 is added at the end of line 275:
- regsub -all ".*: warning: -f(pic|PIC) ignored for target .*" $text "" text
-
- Alternatively, you can get dejagnu directly from the cvs repository
- at http://www.gnu.org/software/dejagnu/ where this bug already has been
- fixed (as it will be in any version *after* 1.4.1).
-
- You will also need expect-5.32.2 (and tcl/tk 8.3.3?). At least, expect 5.31.2
- is known to hang.
-
- Packages/versions needed as maintainer or when using CVS
- --------------------------------------------------------
-
- If you want to generate maintainer files (and you need that when
- you get this package via CVS) then you also need to have the
- following tools:
-
- iii) GNU make
- iv) GNU m4
- v) GNU which version 2.x
- vi) autoconf version 2.13 (2.52 seems to have problems)
- vii) automake version 1.4pl1 or higher
- viii) libtool version 1.4 or higher
+i) The GNU compiler, version 2.95.1 or higher.
+
+ Location: gnu/gcc/
+ Current version: 3.0.2
+
+Alternatively you can install only
+ia) gnu/gcc/gcc-core-<version>.tar.gz and
+ib) gnu/gcc/gcc-g++-<version>.tar.gz
+
+Note: It is very unlikely that you want to install
+the source tree of gcc/g++. Please try to upgrade your
+compiler the usual way if needed.
+If you are using rpm's then you will need to
+install/upgrade the following:
+ gcc (2.95.1 or higher),
+ gcc-c++ (of same version),
+ libstdc++ (of same version) and
+ cpp (of same version).
+Check your installation on RedHat with:
+ rpm -qa | egrep '(gcc|libstdc|cpp)'
+
+Note: If you don't use rpm's but are using tar balls,
+then you do NOT need to download gnu/libstdc++/* because
+gcc-2.95 and higher comes with libstdc++ included.
+The gnu/libstdc++/ directory on GNU ftp sites are
+for older compilers or to be used as source drop-in
+when you compile g++ (replacing the normal stdc++ with
+an alpha version). You also don't need libg++.
+Don't delete those libraries if you have them though
+since existing binaries might need to link with them.
+
+libcwd-0.99.16 was tested with gcc-2.95.x, gcc-2.96-97 (RedHat)
+and gcc-3.0.x.
+
+Packages needed to run the testsuite
+------------------------------------
+
+ii) If you want to run the testsuite then you will have to install
+dejagnu-1.4.1 which can be downloaded from ftp://ftp.gnu.org/gnu/dejagnu/,
+or your local GNU mirror. However, this version still contains a bug
+and you'll have to apply the following patch: edit /usr/share/dejagnu/target.exp
+line 275 and remove the newline at the end (so that the word "text" on line
+276 is added at the end of line 275:
+regsub -all ".*: warning: -f(pic|PIC) ignored for target .*" $text "" text
+
+Alternatively, you can get dejagnu directly from the cvs repository
+at http://www.gnu.org/software/dejagnu/ where this bug already has been
+fixed (as it will be in any version *after* 1.4.1).
+
+You will also need expect-5.32.2 (and tcl/tk 8.3.3?). At least, expect 5.31.2
+is known to hang.
+
+Packages/versions needed as maintainer or when using CVS
+--------------------------------------------------------
+
+If you want to generate maintainer files (and you need that when you
+get this package via CVS; in that case you also need to configure using
+--enable-maintainer-mode) then you also need to have the following tools:
+
+iii) GNU make
+iv) GNU m4
+v) GNU which version 2.x
+vi) autoconf version 2.13 (2.52 seems to have problems)
+vii) automake version 1.4pl1 or higher
+viii) libtool version 1.4 or higher
+
+Each of those can be downloaded from your local GNU site.
+
+Moreover, in order to generate the documentation, you need to
+have the following installed:
+
+ix) GNU grep version 2.4.2 is known to work.
+x) doxygen version 1.2.12 or higher (http://www.doxygen.org/)
+xi) graphviz http://www.research.att.com/sw/tools/graphviz/
- Each of those can be downloaded from your local GNU site.
Hackers info
============
-=i=-
-`configure' has a few interesting options. You can list them by issuing:
+'configure' has a few interesting options. You can list them by issuing:
./configure --help
There is no reason to use libcwd's feature options (--disable-libcwd-alloc,
--disable-libcwd-magic, --disable-libcwd-marker and --disable-libcwd-location).
-Actually, I forgot why they are there :). You can read more about what
-they do in Chapter 4 "Debugging compile options" here:
-http://libcw.sourceforge.net/templates/index.html?debugging
-If you want to change Makefile.am files and the-like then you'll need to
+Actually, I forgot why they are there :). You can read more about the
+configuration options and what they do in include/libcw/debug_config.h.
+
+If you want to change Makefile.am files and the like then you'll need to
use --enable-maintainer-mode. If you enable maintainer-mode then you
-will need GNU make, other make won't work (you also need a lot of other
-extra tools installed on your system).
+will need GNU make, other make won't work (you also need a LOT of other
+extra tools installed on your system, only for the brave thus).
-=ii=-
@@ -124,7 +133,7 @@
-=iii=-
If you don't have an ELF32 system and therefore need to link with libbfd, then you
-can configure using --enable-libcwd-bfd. If libiberty.a or libbfd.so are in an
+can configure using --enable-libcwd-libbfd. If libiberty.a or libbfd.so are in an
unusual directory, then you will have to set LDFLAGS prior to running ./configure:
LDFLAGS="-L/usr/gnu/lib" CPPFLAGS="-I/usr/gnu/include" ./configure
@@ -132,15 +141,15 @@
Please note that the libbfd that comes with binutils-2.11.x is not compatible
with the libiberty that comes with with gcc-2.95.x.
--=iii=-
+-=iv=-
-You can install libcwd in a `staging' directory by issuing
+You can install libcwd in a 'staging' directory by issuing
make DESTDIR=/tmp/staging install
this can come in handy when you want to build an rpm for instance.
--=iv=-
+-=v=-
The Makefile has the following targets:
@@ -150,22 +159,29 @@
make clean
make distclean
-If you feel brave you might even want to try
+If you configured with --enable-maintainer-mode then the following
+targets exist as well:
-make dist
-make maintainer-clean
+make dist // Create tar ball
+make maintainer-clean // Erase everything that was generated somehow
+make check // Run test suite
+make tar // Create tar ball
+make rpm // Create rpms
+make ChangeLog // Generate ChangeLog from cvs database
+make CC="gcc-3.0.2" CXX="g++-3.0.2" reconfig // Switch compilers keeping the same configuration
+make full-check // Iterate over all configurations and all compiler versions
-well, ... heh. Look in the Makefile for more targets ;)
+It is not garanteed that these work on another machine than mine however.
--=v=-
+-=vi=-
Finally, you can also build libcwd in a different directory than the source
tree is in:
-tar xzf libcwd-0.99.15.tar.gz
+tar xzf libcwd-0.99.16.tar.gz
mkdir libcwd-objdir
cd libcwd-objdir
-../libcwd-0.99.15/configure --prefix=/usr
+../libcwd-0.99.16/configure --prefix=/usr
make
su
make install
Index: src/libcwd/Makefile.am
diff -u src/libcwd/Makefile.am:1.34 src/libcwd/Makefile.am:1.35
--- src/libcwd/Makefile.am:1.34 Thu Dec 27 21:25:27 2001
+++ src/libcwd/Makefile.am Sat Dec 29 20:17:46 2001
@@ -4,8 +4,8 @@
SUBDIRS = include utils . tests testsuite
-BUILT_SOURCES =@MAINTAINER_MODE_TRUE@ libcwd.lsm libcwd.spec nodebug.h
-EXTRA_DIST = LICENSE.QPL README.FreeBSD README.openbsd README.nodebug.h debian $(BUILT_SOURCES)
+BUILT_SOURCES =@MAINTAINER_MODE_TRUE@ libcwd.lsm libcwd.spec
+EXTRA_DIST = LICENSE.QPL README.FreeBSD README.openbsd nodebug.h $(BUILT_SOURCES)
DISTCLEANFILES = libcwd-@VERSION@.tar.gz
VERSIONINFO=@VERSIONINFO@
@@ -18,17 +18,15 @@
lib_LTLIBRARIES = libcwd.la
libcwd_la_SOURCES = \
+ threading.cc \
elf32.cc \
bfd.cc \
debug.cc \
- debugdebugcheckpoint.cc \
debugmalloc.cc \
demangle.cc \
demangle3.cc \
- cwprint.cc \
strerrno.cc \
- type_info.cc \
- no_alloc_checking_stringstream.cc
+ type_info.cc
libcwd_la_LDFLAGS = -version-info $(VERSIONINFO)
@@ -36,12 +34,20 @@
# --------------- Maintainer's Section
-dist-hook:
+dist-hook: example-project/debug.h documentation
+ cp -pr $(srcdir)/documentation $(distdir)/documentation
+ find $(distdir)/documentation -name CVS -print | xargs rm -rf
mkdir $(distdir)/example-project
for i in `grep '^/' $(srcdir)/example-project/CVS/Entries | cut -d/ -f2`; do \
cp -p $(srcdir)/example-project/$$i $(distdir)/example-project; \
done
+ rm $(distdir)/example-project/debug.h.maintainer $(distdir)/example-project/macrotest.cc
+ cp -p $(srcdir)/example-project/debug.h $(distdir)/example-project
chmod +x $(distdir)/install-sh
+ mkdir $(distdir)/debian
+ for i in `grep '^/' $(srcdir)/debian/CVS/Entries | cut -d/ -f2`; do \
+ cp -p $(srcdir)/debian/$$i $(distdir)/debian; \
+ done
distclean-local:
rm -rf rpm
Index: src/libcwd/NEWS
diff -u src/libcwd/NEWS:1.61 src/libcwd/NEWS:1.62
--- src/libcwd/NEWS:1.61 Thu Dec 27 21:25:27 2001
+++ src/libcwd/NEWS Sat Dec 29 20:17:46 2001
@@ -1,7 +1,13 @@
-libcwd-0.99.15
+libcwd-0.99.16
- libcwd now works with (single threaded) qt applications. A few major
- bugs have been fixed.
+ libcwd is now thread-safe.
+
+ The source file line number lookup was improved for optimized code with
+ inlined functions (-O).
+
+ New configuration option --disable-libcwd-debug-output was added to
+ allow the use of the testsuite together with --enable-libcwd-debug.
+ (You shouldn't use either unless you are hacking libcwd itself).
Miscellaneous:
- The configuration option --disable-libcwd-location is fixed.
@@ -9,6 +15,70 @@
API changes:
+ IMPORTANT: Debug channels have globally been renamed to Debug
+ selectors. The word 'channel' had too much association with output
+ destinations (streams).
+
+ IMPORTANT: 'channel_ct const' -> 'selector_ct'.
+ Debug selectors (previously channels) should no longer be declared
+ constant. Declarations like
+ libcw::debug::channel_ct const my_channel("FOO");
+ will have to be changed to
+ libcw::debug::selector_ct my_channel("FOO");
+
+ `long memblks()' has been renamed to `unsigned long mem_blocks()'.
+
+ In debug_ct, set_margin, get_margin, set_marker and get_marker are
+ a bit slow for heavy swapping of the margin and marker (std::string
+ is 'slow'); therefore (using internal allocations, which is not
+ possible with std::string (see bug fixes below)) public access
+ to members debug_ct::margin and debug_ct::marker is now granted,
+ providing the following methods of the returned object: size(),
+ c_str() (the terminating zero is already there, this just returns
+ an internal pointer), reserve(), capacity(), append(), prepend()
+ and assign() - all with meanings borrowed from std::string.
+ For example, when capacity() returns a value larger or equal to
+ the length of a string that would result from a call to append(),
+ then calling append is garanteed not to invalidate the pointer
+ returned by c_str(). The default capacity can be set with `reserve'.
+ append/prepend/assign accept both a std::string reference or a
+ char*/size_t pair.
+ Finally, the following methods are added to debug_ct directly:
+ `push_margin', `pop_margin', `push_marker' and `pop_marker'.
+ These functions can be used to quickly store and restore the
+ respective formatting strings.
+
+ A debug function for internal use (by the maintainers):
+ `debugdebugcheckpoint()' has been removed. If you need a user
+ function to be called every Dout() then can define your own Dout
+ macro's, that makes more sense then recompiling libcwd.
+
+ CWASSERT was renamed to LIBCWD_ASSERT; Note that all macros that start
+ with LIBCWD_ should NOT be used by the user, they are for internal use
+ by libcwd.
+
+ Bug fixes:
+
+ When using .stabs, each first line of code after a source file scope change
+ as a result of an inlined function resulted in a location lookup failure
+ ("No line number").
+
+ The default std::allocator implementation uses static pointers to keep
+ a private free list, allocating memory with malloc() in large chunks.
+ The sharing of this memory pool with all STL containers, including
+ std::string and std::stringstreams - and even the buffers of std::cout
+ and std::cerr - caused `internal' allocations being mixed with `userspace'
+ allocations and thus an incorrect error detection.
+ Libcwd now uses its own allocators, with their own memory pool, for
+ variables that need internal allocations.
+
+libcwd-0.99.15
+
+ libcwd now works with (single threaded) qt applications. A few major
+ bugs have been fixed.
+
+ API changes:
+
You now MUST use CWDEBUG, defining DEBUG will no longer work; it was
incompatible with qt-2.2.4.
@@ -39,18 +109,10 @@
On systems where a 'char' is unsigned, the line number lookup of DWARF
failed.
-
- Some systems (I had this on a powerpc-unknown-linux-gnu) and/or with
- old binutils produce incorrect .stabs N_FUN entries, causing the line
- number lookup of stabs to fail. Libcwd now detects this and then uses
- an alternative way to determining the start of a function (as a result
- libcwd now succeeds where libbfd fails).
-
- Added a workaround for a bug in libtools so that executables in the
- tests/ directory no longer can accidently link with an old installed
- version of libcwd.
- Several fixes in the build system (all related to the testsuite).
+ Systems with old binutils produce incorrect .stabs entries, causing
+ the line number lookup of stabs to fail. Libcwd now detects this and
+ then aborts.
libcwd-0.99.13
Index: src/libcwd/README
diff -u src/libcwd/README:1.8 src/libcwd/README:1.9
--- src/libcwd/README:1.8 Mon Jul 30 21:10:04 2001
+++ src/libcwd/README Sat Dec 29 20:17:46 2001
@@ -37,44 +37,6 @@
2) Support for memory allocation debugging.
-Documentation
--------------
-
-You can find extensive documentation online at
-http://libcw.sourceforge.net/debugging/. There you will find
-a reference manual, a tutorial and many examples.
-
-It is highly recommended that you download and install the html
-files locally for greater speed. At the moment you can only
-download the documentation by using `cvs':
-
-Install cvs (after all, you are a developer) and issue the
-following command once:
-
-cvs -d:pserver:ano...@cv...:/cvsroot/libcw login
-
-When prompted for a password for anonymous, simply press the
-Enter key. Next download the documentation with the following
-commandline:
-
-cvs -z3 -d:pserver:ano...@cv...:/cvsroot/libcw co www
-
-At any later time you can update the documentation by changing
-directory into the www directory and issuing:
-
-cvs update -d
-
-A European mirror has been setup in Amsterdam (the Netherlands) at
-http://www.alinoe.com/. This is my home PC (cable, 128cps) and
-therefore only contains the front page, using www.xs4all.nl
-(my other provider) for all the rest of the pages and images.
-Feel free to try this when sourceforge is too slow.
-
-Note that the documentation includes documentation of libcw
-(without a `d' at the end), libcw is not released to the public
-yet. You can ignore everything not in the debugging/ directory.
-
-
Anonymous CVS Access
--------------------
Index: src/libcwd/README.nodebug.h
diff -u src/libcwd/README.nodebug.h:1.1 src/libcwd/README.nodebug.h:removed
--- src/libcwd/README.nodebug.h:1.1 Wed Jul 25 19:10:39 2001
+++ src/libcwd/README.nodebug.h Sat Dec 29 20:18:01 2001
@@ -1,7 +0,0 @@
-In order to make it possible that others compile your application without
-having libcwd installed, the file nodebug.h must be part of the distribution
-of your application and should be included instead of <libcw/debug.h>
-when CWDEBUG is not defined.
-
-For an example of how to do this, see the example-project directory.
-
Index: src/libcwd/acinclude.m4
diff -u src/libcwd/acinclude.m4:1.43 src/libcwd/acinclude.m4:1.44
--- src/libcwd/acinclude.m4:1.43 Thu Dec 27 21:25:27 2001
+++ src/libcwd/acinclude.m4 Sat Dec 29 20:17:46 2001
@@ -161,12 +161,11 @@
dnl CW_DEFINE_TYPE(NEWTYPE, OLDTYPE)
dnl
-dnl Add `typedef OLDTYPE NEWTYPE' to the output variable CW_TYPEDEFS
+dnl Add `typedef OLDTYPE NEWTYPE;' to the output variable CW_TYPEDEFS
dnl
AC_DEFUN(CW_DEFINE_TYPE,
[AC_REQUIRE([CW_DEFINE_TYPE_INITIALIZATION])
-CW_TYPEDEFS="$CW_TYPEDEFS\\
-typedef $2 $1;"
+CW_TYPEDEFS="typedef $2 $1; $CW_TYPEDEFS"
])
dnl CW_TYPE_EXTRACT_FROM(FUNCTION, INIT, ARGUMENTS, ARGUMENT)
@@ -334,6 +333,7 @@
AC_DEFUN(CW_MALLOC_OVERHEAD,
[AC_CACHE_CHECK(malloc overhead in bytes, cw_cv_system_mallocoverhead,
[CW_TRY_RUN([#include <cstddef>
+#include <cstdlib>
bool bulk_alloc(size_t malloc_overhead_attempt, size_t size)
{
@@ -377,12 +377,17 @@
AC_DEFUN(CW_NEED_WORD_ALIGNMENT,
[AC_CACHE_CHECK(if machine needs word alignment, cw_cv_system_needwordalignment,
[CW_TRY_RUN([#include <cstddef>
+#include <cstdlib>
int main(void)
{
size_t* p = reinterpret_cast<size_t*>((char*)malloc(5) + 1);
*p = 0x12345678;
+#ifdef __alpha__ // Works, but still should use alignment.
+ exit(-1);
+#else
exit ((((unsigned long)p & 1UL) && *p == 0x12345678) ? 0 : -1);
+#endif
}],
cw_cv_system_needwordalignment=no,
cw_cv_system_needwordalignment=yes,
@@ -816,9 +821,7 @@
dnl CW_SETUP_RPM_DIRS
dnl Set up rpm directory when on linux and in maintainer-mode
AC_DEFUN(CW_SETUP_RPM_DIRS,
-[SPECCHANGELOG=spec.changelog
-if test "$USE_MAINTAINER_MODE" = yes; then
- AC_SUBST_FILE(SPECCHANGELOG)
+[if test "$USE_MAINTAINER_MODE" = yes; then
LSMFILE="$PACKAGE.lsm"
AC_SUBST(LSMFILE)
SPECFILE="$PACKAGE.spec"
@@ -886,7 +889,13 @@
AC_DEFUN(CW_DO_OPTIONS, [dnl
dnl Choose warning options to use
if test "$USE_MAINTAINER_MODE" = yes; then
-WARNOPTS="-Wall -Woverloaded-virtual -Wundef -Wpointer-arith -Winline -Wwrite-strings -Werror"
+AC_EGREP_CPP(Winline-broken,
+[#if __GNUC__ < 3
+Winline-broken
+#endif
+],
+WARNOPTS="-Wall -Woverloaded-virtual -Wundef -Wpointer-arith -Wwrite-strings -Werror",
+WARNOPTS="-Wall -Woverloaded-virtual -Wundef -Wpointer-arith -Wwrite-strings -Werror -Winline")
else
WARNOPTS=
fi
@@ -904,7 +913,11 @@
AC_SUBST(DEBUGOPTS)
dnl Other options
-EXTRAOPTS=""
+if test "$USE_MAINTAINER_MODE" = yes; then
+EXTRAOPTS="-O"
+else
+EXTRAOPTS="-O"
+fi
...
[truncated message content] |
|
From: Carlo W. <li...@us...> - 2001-12-30 20:00:14
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2001-11-30 20:00:12 UTC
Modified files:
libcwd/Makefile.am libcwd/maintMakefile.in
Log message:
Make example-project/debug.h dependant of documentation directly.
---------------------- diff included ----------------------
Index: src/libcwd/Makefile.am
diff -u src/libcwd/Makefile.am:1.35 src/libcwd/Makefile.am:1.36
--- src/libcwd/Makefile.am:1.35 Sat Dec 29 20:17:46 2001
+++ src/libcwd/Makefile.am Sun Dec 30 12:00:01 2001
@@ -34,7 +34,7 @@
# --------------- Maintainer's Section
-dist-hook: example-project/debug.h documentation
+dist-hook: documentation
cp -pr $(srcdir)/documentation $(distdir)/documentation
find $(distdir)/documentation -name CVS -print | xargs rm -rf
mkdir $(distdir)/example-project
Index: src/libcwd/maintMakefile.in
diff -u src/libcwd/maintMakefile.in:1.14 src/libcwd/maintMakefile.in:1.15
--- src/libcwd/maintMakefile.in:1.14 Sat Dec 29 20:17:47 2001
+++ src/libcwd/maintMakefile.in Sun Dec 30 12:00:01 2001
@@ -148,5 +148,5 @@
done; \
)
-documentation:
+documentation: example-project/debug.h
$(MAKE) -C documentation
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-30 20:00:54
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2001-11-30 20:00:54 UTC
Modified files:
libcwd/example-project/.cvsignore
Log message:
Needed ignore for automake 1.5.
---------------------- diff included ----------------------
Index: src/libcwd/example-project/.cvsignore
diff -u src/libcwd/example-project/.cvsignore:1.3 src/libcwd/example-project/.cvsignore:1.4
--- src/libcwd/example-project/.cvsignore:1.3 Sat Dec 29 20:17:49 2001
+++ src/libcwd/example-project/.cvsignore Sun Dec 30 12:00:43 2001
@@ -14,3 +14,4 @@
debug.h
program
confdefs.h
+stamp-h1
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-30 20:05:53
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2001-11-30 20:05:51 UTC
Modified files:
libcwd/README.FreeBSD libcwd/include/sys.ho.in
Log message:
Work in progress on port to FreeBSD.
---------------------- diff included ----------------------
Index: src/libcwd/README.FreeBSD
diff -u src/libcwd/README.FreeBSD:1.7 src/libcwd/README.FreeBSD:1.8
--- src/libcwd/README.FreeBSD:1.7 Mon Jul 30 21:10:04 2001
+++ src/libcwd/README.FreeBSD Sun Dec 30 12:05:41 2001
@@ -1,3 +1,12 @@
+30 December 2001
+
+ FreeBSD now compiles with g++-2.95.3.
+ It doesn't work however because _dl_loaded doesn't exist, which I need
+ to get a list of currently loaded dynamic libraries. All in all,
+ you should use linux as developers platform: _dl_loaded doesn't exist,
+ __libc_malloc et al don't exist... Of course you need to use gmake.
+ No idea why GNU make isn't the default :/
+
31 Juli 2001
FreeBSD fails to compile libcwd when using g++-2.95.3 (internal compiler error).
Index: src/libcwd/include/sys.ho.in
diff -u src/libcwd/include/sys.ho.in:1.3 src/libcwd/include/sys.ho.in:1.4
--- src/libcwd/include/sys.ho.in:1.3 Sat Dec 29 20:17:49 2001
+++ src/libcwd/include/sys.ho.in Sun Dec 30 12:05:41 2001
@@ -1,5 +1,5 @@
// @configure_input@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/sys.ho.in,v 1.3 2001/12/30 04:17:49 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/sys.ho.in,v 1.4 2001/12/30 20:05:41 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -45,6 +45,7 @@
// Word around (if any):
@CW_REDEFINES_FIX@
+#ifdef HAVE__G_CONFIG_H
// This is to avoid warnings like:
// /usr/include/g++-3/iostream.h:253:5: "_G_CLOG_CONFLICT" is not defined
#@CW_CONFIG_G_CONFIG_H_MACROS@ NEED_G_CONFIG_H_MACROS
@@ -56,7 +57,8 @@
#ifndef _G_HAS_LABS
#define _G_HAS_LABS @CW_HAVE_LABS@
#endif
-#endif
+#endif // NEED_G_CONFIG_H_MACROS
+#endif // HAVE__G_CONFIG_H
// Fixes for gcc-2.96 and earlier.
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-30 20:55:53
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2001-11-30 20:55:52 UTC
Modified files:
libcwd/debug.cc
Log message:
FreeBSD bug fix.
---------------------- diff included ----------------------
Index: src/libcwd/debug.cc
diff -u src/libcwd/debug.cc:1.49 src/libcwd/debug.cc:1.50
--- src/libcwd/debug.cc:1.49 Sat Dec 29 20:17:46 2001
+++ src/libcwd/debug.cc Sun Dec 30 12:55:42 2001
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/debug.cc,v 1.49 2001/12/30 04:17:46 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/debug.cc,v 1.50 2001/12/30 20:55:42 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -951,7 +951,9 @@
if (corelim.rlim_max != RLIM_INFINITY)
{
_off = -1;
- Dout(dc::warning, "core size is limited (hard limit: " << (corelim.rlim_max / 1024) << " kb). Core dumps might be truncated!");
+ // The cast is necessary on platforms where corelim.rlim_max is long long
+ // and libstdc++ was not compiled with support for long long.
+ Dout(dc::warning, "core size is limited (hard limit: " << (unsigned long)(corelim.rlim_max / 1024) << " kb). Core dumps might be truncated!");
#ifndef DEBUGDEBUG
_off = 0;
#endif
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-30 21:18:28
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2001-11-30 21:18:26 UTC
Modified files:
libcwd/bfd.cc libcwd/configure.in
Log message:
FreeBSD port: check for _dl_loaded directly instead of just link.h
---------------------- diff included ----------------------
Index: src/libcwd/bfd.cc
diff -u src/libcwd/bfd.cc:1.88 src/libcwd/bfd.cc:1.89
--- src/libcwd/bfd.cc:1.88 Sat Dec 29 20:17:46 2001
+++ src/libcwd/bfd.cc Sun Dec 30 13:18:16 2001
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/bfd.cc,v 1.88 2001/12/30 04:17:46 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/bfd.cc,v 1.89 2001/12/30 21:18:16 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -39,7 +39,7 @@
#include <cstring>
#include <cstdlib>
#endif
-#ifdef HAVE_LINK_H
+#ifdef HAVE__DL_LOADED
#include <link.h>
extern link_map* _dl_loaded;
#endif
@@ -479,7 +479,7 @@
lbase = val - s_end_vma;
}
else
-#ifdef HAVE_LINK_H
+#ifdef HAVE__DL_LOADED
{
__libcwd_tsd.internal = saved_internal;
for(link_map* p = _dl_loaded; p; p = p->l_next)
@@ -1023,7 +1023,7 @@
load_object_file(fullpath.value->data(), 0);
// Load all shared objects
-#ifndef HAVE_LINK_H
+#ifndef HAVE__DL_LOADED
// Path to `ldd'
char const ldd_prog[] = "/usr/bin/ldd";
@@ -1184,7 +1184,7 @@
BFD_ACQUIRE_READ_LOCK;
object_file_ct* object_file = NEEDS_READ_LOCK_find_object_file(addr);
-#ifdef HAVE_LINK_H
+#ifdef HAVE__DL_LOADED
if (!object_file)
{
set_alloc_checking_off(LIBCWD_TSD);
Index: src/libcwd/configure.in
diff -u src/libcwd/configure.in:1.86 src/libcwd/configure.in:1.87
--- src/libcwd/configure.in:1.86 Sat Dec 29 20:17:46 2001
+++ src/libcwd/configure.in Sun Dec 30 13:18:16 2001
@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
-AC_REVISION($Revision: 1.86 $)dnl
+AC_REVISION($Revision: 1.87 $)dnl
dnl General intialization of `autoconf' varaibles.
dnl Ensure that the directory specified with --srcdir was correct
@@ -384,6 +384,11 @@
dnl Checks for header files.
AC_HEADER_STAT
AC_CHECK_HEADERS(_G_config.h link.h)
+
+dnl Check for global variable.
+if test "$ac_cv_header_link_h" = yes; then
+ AC_CHECK_FUNCS(_dl_loaded)
+fi
dnl Check for typedefs.
AC_TYPE_UID_T
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-30 21:26:42
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2001-11-30 21:26:41 UTC
Modified files:
libcwd/testsuite/libcwd.tst/sys.h
Log message:
Also use HAVE__G_CONFIG_H in testsuite
---------------------- diff included ----------------------
Index: src/libcwd/testsuite/libcwd.tst/sys.h
diff -u src/libcwd/testsuite/libcwd.tst/sys.h:1.2 src/libcwd/testsuite/libcwd.tst/sys.h:1.3
--- src/libcwd/testsuite/libcwd.tst/sys.h:1.2 Sat Dec 29 20:17:51 2001
+++ src/libcwd/testsuite/libcwd.tst/sys.h Sun Dec 30 13:26:31 2001
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/testsuite/libcwd.tst/sys.h,v 1.2 2001/12/30 04:17:51 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/testsuite/libcwd.tst/sys.h,v 1.3 2001/12/30 21:26:31 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -14,8 +14,8 @@
#ifndef TESTSUITE_SYS_H
#define TESTSUITE_SYS_H
-#define NEED_G_CONFIG_H_MACROS
-#ifdef NEED_G_CONFIG_H_MACROS
+#include "../../config.h"
+#ifdef HAVE__G_CONFIG_H
#include <_G_config.h>
#ifndef _G_CLOG_CONFLICT
#define _G_CLOG_CONFLICT 0
@@ -23,7 +23,7 @@
#ifndef _G_HAS_LABS
#define _G_HAS_LABS 1
#endif
-#endif
+#endif // HAVE__G_CONFIG_H
#include <libcw/sysd.h>
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-30 21:33:11
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2001-11-30 21:33:11 UTC
Modified files:
libcwd/testsuite/libcwd.tst/dlopen.cc
Log message:
Bug fix
---------------------- diff included ----------------------
Index: src/libcwd/testsuite/libcwd.tst/dlopen.cc
diff -u src/libcwd/testsuite/libcwd.tst/dlopen.cc:1.6 src/libcwd/testsuite/libcwd.tst/dlopen.cc:1.7
--- src/libcwd/testsuite/libcwd.tst/dlopen.cc:1.6 Sat Dec 29 20:17:51 2001
+++ src/libcwd/testsuite/libcwd.tst/dlopen.cc Sun Dec 30 13:33:00 2001
@@ -23,7 +23,7 @@
if (!handle)
{
- char* error_str = dlerror();
+ char const* error_str = dlerror();
DoutFatal(dc::fatal, "Failed to load \"./module.so\": " << error_str);
}
@@ -36,7 +36,7 @@
if (!f)
{
- char* error_str = dlerror();
+ char const* error_str = dlerror();
DoutFatal(dc::fatal, "Failed find function \"" << sym << "\": " << error_str);
}
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-31 01:04:06
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2001-11-31 01:04:04 UTC
Modified files:
libcwd/debugmalloc.cc libcwd/include/libcw/macro_Libcwd_macros.h
Log message:
Bug fixes.
---------------------- diff included ----------------------
Index: src/libcwd/debugmalloc.cc
diff -u src/libcwd/debugmalloc.cc:1.64 src/libcwd/debugmalloc.cc:1.65
--- src/libcwd/debugmalloc.cc:1.64 Sat Dec 29 20:17:46 2001
+++ src/libcwd/debugmalloc.cc Sun Dec 30 17:03:54 2001
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/debugmalloc.cc,v 1.64 2001/12/30 04:17:46 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/debugmalloc.cc,v 1.65 2001/12/31 01:03:54 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -1196,41 +1196,18 @@
{
if (WST_initialization_state <= 0) // Only true prior to initialization of std::ios_base::Init.
{
- // This block is Single Threaded.
- if (WST_initialization_state == 0) // Only true once.
- {
- __libcwd_tsd.internal = 1;
- memblk_map.MT_unsafe = new memblk_map_ct; // MT-safe: There are no threads created yet when we get here.
- WST_initialization_state = -1;
- __libcwd_tsd.internal = 0;
- }
-#ifdef __GLIBCPP__
- // "ios_base" is always initialized for libstdc++ version 2.
- if (!_private_::WST_ios_base_initialized && !_private_::inside_ios_base_Init_Init())
-#endif // __GLIBCPP__
- {
- WST_initialization_state = 1; // ST_initialize_globals() calls malloc again of course.
-#ifdef DEBUGDEBUGMALLOC
- --__libcwd_tsd.recursive; // Allow that.
-#endif
#ifdef DEBUGDEBUG
- bool continued_debug_output = (__libcwd_tsd.library_call == 0 && libcw_do._off < 0);
-#endif
- libcw::debug::ST_initialize_globals(); // This doesn't belong in the malloc department at all, but malloc() happens
- // to be a function that is called _very_ early - and hence this is a good moment
- // to initialize ALL of libcwd.
-#ifdef DEBUGDEBUGMALLOC
- ++__libcwd_tsd.recursive;
+ bool continued_debug_output = (__libcwd_tsd.library_call == 0 && libcw_do._off < 0);
#endif
+ init_debugmalloc();
#ifdef DEBUGDEBUG
- // It is possible that libcwd is not initialized at this point, libcw_do._off == 0 (turned off)
- // and thus no unfinished debug output was printed before entering this function.
- // Initialization of libcwd with DEBUGDEBUG defined turns on libcwd_do. In order to balance the
- // continued stack, we print an unfinished debug message here.
- if (continued_debug_output != (__libcwd_tsd.library_call == 0 && libcw_do._off < 0))
- DoutInternal( dc_malloc|continued_cf, "internal_malloc(" << size << ", " << flag << ") = " );
+ // It is possible that libcwd is not initialized at this point, libcw_do._off == 0 (turned off)
+ // and thus no unfinished debug output was printed before entering this function.
+ // Initialization of libcwd with DEBUGDEBUG defined turns on libcwd_do. In order to balance the
+ // continued stack, we print an unfinished debug message here.
+ if (continued_debug_output != (__libcwd_tsd.library_call == 0 && libcw_do._off < 0))
+ DoutInternal( dc_malloc|continued_cf, "internal_malloc(" << size << ", " << flag << ") = " );
#endif
- }
}
register void* mptr;
@@ -1299,7 +1276,7 @@
++__libcwd_tsd.recursive;
#endif
#if defined(DEBUGDEBUGMALLOC) && defined(__GLIBCPP__) && !defined(DEBUGMALLOCEXTERNALCLINKAGE)
- LIBCWD_ASSERT( _private_::WST_ios_base_initialized );
+ LIBCWD_ASSERT( _private_::WST_ios_base_initialized || __libcwd_tsd.internal );
#endif
if (__libcwd_tsd.internal)
{
@@ -1499,13 +1476,33 @@
void init_debugmalloc(void)
{
- if (WST_initialization_state == 0)
+ if (WST_initialization_state <= 0)
{
LIBCWD_TSD_DECLARATION
- _private_::set_alloc_checking_off(LIBCWD_TSD);
- memblk_map.MT_unsafe = new memblk_map_ct; // MT-safe: `init_debugmalloc' is called before any threads are created.
- WST_initialization_state = -1;
- _private_::set_alloc_checking_on(LIBCWD_TSD);
+ // This block is Single Threaded.
+ if (WST_initialization_state == 0) // Only true once.
+ {
+ _private_::set_alloc_checking_off(LIBCWD_TSD);
+ memblk_map.MT_unsafe = new memblk_map_ct; // MT-safe: There are no threads created yet when we get here.
+ WST_initialization_state = -1;
+ _private_::set_alloc_checking_on(LIBCWD_TSD);
+ }
+#ifdef __GLIBCPP__
+ // "ios_base" is always initialized for libstdc++ version 2.
+ if (!_private_::WST_ios_base_initialized && !_private_::inside_ios_base_Init_Init())
+#endif // __GLIBCPP__
+ {
+ WST_initialization_state = 1; // ST_initialize_globals() calls malloc again of course.
+#ifdef DEBUGDEBUGMALLOC
+ --__libcwd_tsd.recursive; // Allow that.
+#endif
+ libcw::debug::ST_initialize_globals(); // This doesn't belong in the malloc department at all, but malloc() happens
+ // to be a function that is called _very_ early - and hence this is a good moment
+ // to initialize ALL of libcwd.
+#ifdef DEBUGDEBUGMALLOC
+ ++__libcwd_tsd.recursive;
+#endif
+ }
}
}
@@ -2118,7 +2115,7 @@
#endif
#endif
#if defined(DEBUGDEBUGMALLOC) && defined(__GLIBCPP__) && !defined(DEBUGMALLOCEXTERNALCLINKAGE)
- LIBCWD_ASSERT( _private_::WST_ios_base_initialized );
+ LIBCWD_ASSERT( _private_::WST_ios_base_initialized || __libcwd_tsd.internal );
#endif
if (__libcwd_tsd.internal)
{
@@ -2195,7 +2192,7 @@
#endif
#endif
#if defined(DEBUGDEBUGMALLOC) && defined(__GLIBCPP__) && !defined(DEBUGMALLOCEXTERNALCLINKAGE)
- LIBCWD_ASSERT( _private_::WST_ios_base_initialized );
+ LIBCWD_ASSERT( _private_::WST_ios_base_initialized || __libcwd_tsd.internal );
#endif
if (__libcwd_tsd.internal)
{
@@ -2283,7 +2280,7 @@
#endif
#endif
#if defined(DEBUGDEBUGMALLOC) && defined(__GLIBCPP__) && !defined(DEBUGMALLOCEXTERNALCLINKAGE)
- LIBCWD_ASSERT( _private_::WST_ios_base_initialized );
+ LIBCWD_ASSERT( _private_::WST_ios_base_initialized || __libcwd_tsd.internal );
#endif
if (__libcwd_tsd.internal)
{
@@ -2647,7 +2644,7 @@
++__libcwd_tsd.recursive;
#endif
#if defined(DEBUGDEBUGMALLOC) && defined(__GLIBCPP__) && !defined(DEBUGMALLOCEXTERNALCLINKAGE)
- LIBCWD_ASSERT( _private_::WST_ios_base_initialized );
+ LIBCWD_ASSERT( _private_::WST_ios_base_initialized || __libcwd_tsd.internal );
#endif
#ifdef DEBUGDEBUGMALLOC
--__libcwd_tsd.recursive;
@@ -2668,7 +2665,7 @@
++__libcwd_tsd.recursive;
#endif
#if defined(DEBUGDEBUGMALLOC) && defined(__GLIBCPP__) && !defined(DEBUGMALLOCEXTERNALCLINKAGE)
- LIBCWD_ASSERT( _private_::WST_ios_base_initialized );
+ LIBCWD_ASSERT( _private_::WST_ios_base_initialized || __libcwd_tsd.internal );
#endif
#ifdef DEBUGDEBUGMALLOC
--__libcwd_tsd.recursive;
Index: src/libcwd/include/libcw/macro_Libcwd_macros.h
diff -u src/libcwd/include/libcw/macro_Libcwd_macros.h:1.2 src/libcwd/include/libcw/macro_Libcwd_macros.h:1.3
--- src/libcwd/include/libcw/macro_Libcwd_macros.h:1.2 Sat Dec 29 20:17:50 2001
+++ src/libcwd/include/libcw/macro_Libcwd_macros.h Sun Dec 30 17:03:54 2001
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/macro_Libcwd_macros.h,v 1.2 2001/12/30 04:17:50 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/macro_Libcwd_macros.h,v 1.3 2001/12/31 01:03:54 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -57,7 +57,7 @@
#define LIBCWD_STR1(x) #x
#define LIBCWD_STR2(x) LIBCWD_STR1(x)
#define LIBCWD_STR3 "LibcwDout at " __FILE__ ":" LIBCWD_STR2(__LINE__) "\n"
-#define DEBUGDEBUGLIBCWDOUTMARKER ::write(2, LIBCWD_STR3, sizeof(LIBCWD_STR3));
+#define DEBUGDEBUGLIBCWDOUTMARKER ::write(2, LIBCWD_STR3, sizeof(LIBCWD_STR3) - 1);
#else // !DEBUGDEBUGOUTPUT
#define DEBUGDEBUGLIBCWDOUTMARKER
#endif // !DEBUGDEBUGOUTPUT
@@ -100,7 +100,7 @@
#ifndef DEBUGDEBUGLIBCWDOUTFATALMARKER
#ifdef DEBUGDEBUGOUTPUT
#define LIBCWD_STR4 "LibcwDoutFatal at " __FILE__ ":" LIBCWD_STR2(__LINE__) "\n"
-#define DEBUGDEBUGLIBCWDOUTFATALMARKER ::write(2, LIBCWD_STR4, sizeof(LIBCWD_STR4));
+#define DEBUGDEBUGLIBCWDOUTFATALMARKER ::write(2, LIBCWD_STR4, sizeof(LIBCWD_STR4) - 1);
#else
#define DEBUGDEBUGLIBCWDOUTFATALMARKER
#endif
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2001-12-31 05:01:35
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2001-11-31 05:01:34 UTC
Modified files:
libcwd/bfd.cc
Log message:
Don't start ST_exec_prog with 'internal' on.
---------------------- diff included ----------------------
Index: src/libcwd/bfd.cc
diff -u src/libcwd/bfd.cc:1.89 src/libcwd/bfd.cc:1.90
--- src/libcwd/bfd.cc:1.89 Sun Dec 30 13:18:16 2001
+++ src/libcwd/bfd.cc Sun Dec 30 21:01:23 2001
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/bfd.cc,v 1.89 2001/12/30 21:18:16 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/bfd.cc,v 1.90 2001/12/31 05:01:23 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -835,7 +835,7 @@
};
// cwbfd::
- typedef _private_::internal_vector<my_link_map> ST_shared_libs_vector_ct;
+ typedef std::vector<my_link_map> ST_shared_libs_vector_ct;
ST_shared_libs_vector_ct ST_shared_libs; // Written to only in `ST_decode_ldd' which is called from
// `cwbfd::ST_init' and read from in a later part of `cwbfd::ST_init'.
@@ -942,13 +942,7 @@
LIBCWD_TSD_DECLARATION
#if defined(DEBUGDEBUG) && defined(DEBUGMALLOC)
- // First time we get here, this string is intialized - this must be with `internal' off!
- static bool second_time = false;
- if (!second_time)
- {
- second_time = true;
- LIBCWD_ASSERT( !__libcwd_tsd.internal );
- }
+ LIBCWD_ASSERT( !__libcwd_tsd.internal );
#endif
// ****************************************************************************
@@ -1031,13 +1025,15 @@
argv[0] = "ldd";
argv[1] = fullpath.value->data();
argv[2] = NULL;
+ set_alloc_checking_on(LIBCWD_TSD);
ST_exec_prog(ldd_prog, argv, environ, ST_decode_ldd);
+ set_alloc_checking_off(LIBCWD_TSD);
- for(ST_shared_libs_vector_ct::iterator iter = ST_shared_libs.begin(); iter != ST_shared_libs.end(); ++iter)
+ for(ST_shared_libs_vector_ct::const_iterator iter = ST_shared_libs.begin(); iter != ST_shared_libs.end(); ++iter)
{
- my_link_map* l = &(*iter);
+ my_link_map const* l = &(*iter);
#else
- for(link_map* l = _dl_loaded; l; l = l->l_next)
+ for(link_map const* l = _dl_loaded; l; l = l->l_next)
{
#endif
if (l->l_addr)
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2002-01-01 04:43:16
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2002-00-01 04:43:15 UTC
Modified files:
libcwd/testsuite/libcwd.tst/dlopen.re
libcwd/testsuite/libcwd.tst/test.exp
Log message:
On FreeBSD, which doesn't have _dl_loaded, less allocations are done.
As a result, the variations in the debug output of this test vary
too much: just test the relevant part and skip "anything" before it.
---------------------- diff included ----------------------
Index: src/libcwd/testsuite/libcwd.tst/dlopen.re
diff -u src/libcwd/testsuite/libcwd.tst/dlopen.re:1.8 src/libcwd/testsuite/libcwd.tst/dlopen.re:1.9
--- src/libcwd/testsuite/libcwd.tst/dlopen.re:1.8 Sat Dec 29 20:17:51 2001
+++ src/libcwd/testsuite/libcwd.tst/dlopen.re Mon Dec 31 20:43:04 2001
@@ -1,20 +1,11 @@
-// input lines 3
-// output till ^MALLOC
-((WARNING : core size is limited.*
-)*BFD : Loading debug info from.*
+// input lines 2
+// output till Loading debug info from
+(.*
)*
-// input lines 4
-// output till ^BFD : Loading
-(MALLOC : (malloc\([0-9]*\)|calloc\([0-9]*, [0-9]*\)) = <unfinished>
-BFD : address 0x[0-9a-f]* corresponds to (dl-[a-z]*\.c|specific\.c|dlerror\.c):[0-9]*
-MALLOC : <continued> 0x[0-9a-f]*
-)+
-BFD : Loading debug info from \./module\.so \(0x[0-9a-f]*\) \.\.\. done \([0-9]* symbols\)
-// input lines 4
+BFD : Loading debug info from \./module\.so \(0x[a-f0-9]*\) \.\.\. done \([0-9]* symbols\)
+// input lines 2
// output till malloc\(310\)
-(MALLOC : malloc\(28\) = <unfinished>
-BFD : address 0x[0-9a-f]* corresponds to stl_alloc.h:[0-9]*
-MALLOC : <continued> 0x[0-9a-f]*
+(.*
)*
MALLOC : malloc\(310\) = <unfinished>
BFD : address 0x[0-9a-f]* corresponds to module.cc:16
@@ -28,5 +19,5 @@
// input lines 2
// output till ^NOTICE
(malloc 0x[0-9a-f]* *(dl-[a-z]*\.c|stl_alloc\.h|specific\.c|dlerror\.c):[0-9]* *<unknown type>; \(sz = [0-9]*\)
-)+
+)*
NOTICE : Finished
Index: src/libcwd/testsuite/libcwd.tst/test.exp
diff -u src/libcwd/testsuite/libcwd.tst/test.exp:1.6 src/libcwd/testsuite/libcwd.tst/test.exp:1.7
--- src/libcwd/testsuite/libcwd.tst/test.exp:1.6 Sat Dec 29 20:17:51 2001
+++ src/libcwd/testsuite/libcwd.tst/test.exp Mon Dec 31 20:43:05 2001
@@ -2,7 +2,7 @@
global SHAREDLIBS STATICLIBS
catch "glob -nocomplain $srcdir/$subdir/*.cc" srcfiles
-# set srcfiles $srcdir/$subdir/alloctag.cc
+# set srcfiles $srcdir/$subdir/dlopen.cc
verbose "srcfiles are $srcfiles"
set prefix ""
----------------------- End of diff -----------------------
|
|
From: Carlo W. <li...@us...> - 2002-01-04 04:22:45
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2002-00-04 04:22:43 UTC
Modified files:
libcwd/debugmalloc.cc libcwd/elf32.cc
libcwd/testsuite/lib/libcwd.exp
libcwd/testsuite/libcwd.tst/test.exp
Log message:
Bug fixes.
Improvement of line number lookup for dwarf-2.
---------------------- diff included ----------------------
Index: src/libcwd/debugmalloc.cc
diff -u src/libcwd/debugmalloc.cc:1.65 src/libcwd/debugmalloc.cc:1.66
--- src/libcwd/debugmalloc.cc:1.65 Sun Dec 30 17:03:54 2001
+++ src/libcwd/debugmalloc.cc Thu Jan 3 20:22:33 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/debugmalloc.cc,v 1.65 2001/12/31 01:03:54 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/debugmalloc.cc,v 1.66 2002/01/04 04:22:33 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -945,7 +945,9 @@
_private_::no_alloc_print_int_to(buf, a_size / type_info_ptr->ref_size(), false);
buf->put(']');
}
+#ifdef LIBCWD_USE_STRSTREAM
buf->put('\0');
+#endif
DoutInternal( dc::continued, buf->str() );
#ifdef LIBCWD_USE_STRSTREAM
buf->freeze(0);
Index: src/libcwd/elf32.cc
diff -u src/libcwd/elf32.cc:1.28 src/libcwd/elf32.cc:1.29
--- src/libcwd/elf32.cc:1.28 Sat Dec 29 20:17:46 2001
+++ src/libcwd/elf32.cc Thu Jan 3 20:22:33 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/elf32.cc,v 1.28 2001/12/30 04:17:46 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/elf32.cc,v 1.29 2002/01/04 04:22:33 libcw Exp $
//
// Copyright (C) 2001, by
//
@@ -599,22 +599,128 @@
typedef std::set<object_files_string, std::less<object_files_string>, _private_::object_files_allocator::rebind<object_files_string>::other> object_files_string_set_ct;
//==========================================================================================================================================
-// struct location_st
+// struct location_ct
//
// Internal representation for locations.
//
-struct location_st {
- object_files_string_set_ct::iterator source_iter;
- Elf32_Half line;
- object_files_string_set_ct::iterator func_iter;
-};
-
struct range_st {
Elf32_Addr start;
size_t size;
};
+struct location_st {
+ object_files_string_set_ct::iterator M_func_iter;
+ object_files_string_set_ct::iterator M_source_iter;
+ Elf32_Half M_line;
+
+ friend std::ostream& operator<<(std::ostream& os, location_st const& loc);
+};
+
+class object_file_ct;
+
+class location_ct : private location_st {
+private:
+ location_st M_prev_location;
+ Elf32_Addr M_address;
+ range_st M_range;
+ int M_flags;
+ bool M_used;
+ object_file_ct* M_object_file;
+
+public:
+ location_ct(object_file_ct* object_file) : M_address(0), M_flags(0), M_object_file(object_file) { M_line = 0; M_range.start = 0; }
+
+ void invalidate(void) {
+ M_flags = 0;
+ DoutDwarf(dc::bfd, "--> location invalidated.");
+ }
+ void set_line(Elf32_Half line) {
+ if (!(M_flags & 1) || M_line != line)
+ M_used = false;
+ M_flags |= 1;
+ M_line = line;
+ DoutDwarf(dc::bfd, "--> location.M_line = " << M_line);
+ if (is_valid())
+ {
+ DoutDwarf(dc::bfd, "--> location now valid.");
+ M_store();
+ }
+ }
+ void set_address(Elf32_Addr address) {
+ if (M_address != address)
+ M_used = false;
+ M_flags |= 2;
+ M_address = address;
+ DoutDwarf(dc::bfd, "--> location.M_address = 0x" << std::hex << address);
+ if (is_valid())
+ {
+ DoutDwarf(dc::bfd, "--> location now valid.");
+ M_store();
+ }
+ }
+ void copy(void)
+ {
+ if (is_valid())
+ M_store();
+ }
+ void set_source_iter(object_files_string_set_ct::iterator const& iter) { M_source_iter = iter; M_used = false; }
+ void set_func_iter(object_files_string_set_ct::iterator const& iter) { M_func_iter = iter; }
+ // load_stabs doesn't use out M_address.
+ bool is_valid_stabs(void) const { return (M_flags == 1); }
+ void increment_line(int increment) {
+ if (increment != 0)
+ M_used = false;
+#if DEBUGDWARF
+ bool was_not_valid = !(M_flags & 1);
+#endif
+ M_flags |= 1;
+ M_line += increment;
+ DoutDwarf(dc::bfd, "--> location.M_line = " << M_line);
+ if (is_valid())
+ {
+#if DEBUGDWARF
+ if (was_not_valid)
+ DoutDwarf(dc::bfd, "--> location now valid.");
+#endif
+ M_store();
+ }
+ }
+ void increment_address(unsigned int increment) {
+ if (increment > 0)
+ M_used = false;
+ M_address += increment;
+ DoutDwarf(dc::bfd, "--> location.M_address = 0x" << std::hex << M_address);
+#if DEBUGDWARF
+ bool was_not_valid = !(M_flags & 2);
+#endif
+ M_flags |= 2;
+ if (is_valid())
+ {
+#if DEBUGDWARF
+ if (was_not_valid)
+ DoutDwarf(dc::bfd, "--> location now valid.");
+#endif
+ M_store();
+ }
+ }
+ void sequence_end(void) {
+ DoutDwarf(dc::bfd, "--> Sequence end.");
+ if (is_valid())
+ M_store();
+ }
+
+ Elf32_Half get_line(void) const { LIBCWD_ASSERT( (M_flags & 1) ); return M_line; }
+ object_files_string_set_ct::iterator get_source_iter(void) const { return M_source_iter; }
+ Elf32_Addr get_address(void) const { return M_address; }
+
+ void stabs_range(range_st const& range) const;
+
+private:
+ bool is_valid(void) const { return (M_flags == 3); }
+ void M_store(void);
+};
+
bool operator==(range_st const& range1, range_st const& range2)
{
DoutFatal(dc::core, "Calling operator==(range_st const& range1, range_st const& range2)");
@@ -627,10 +733,15 @@
return os;
}
+std::ostream& operator<<(std::ostream& os, location_st const& loc)
+{
+ os << (*loc.M_source_iter).data() << ':' << std::dec << loc.M_line << " : \"" << (*loc.M_func_iter).data() << "\".";
+ return os;
+}
+
std::ostream& operator<<(std::ostream& os, std::pair<range_st const, location_st> const& p)
{
- os << std::hex << p.first.start << " - " << p.first.start + p.first.size
- << "; " << (*p.second.source_iter).data() << ':' << std::dec << p.second.line << " : \"" << (*p.second.func_iter).data() << "\".";
+ os << std::hex << p.first.start << " - " << p.first.start + p.first.size << "; " << p.second << '.';
return os;
}
#endif
@@ -654,8 +765,6 @@
Elf32_Shdr const& section_header(void) const { return M_section_header; }
};
-class object_file_ct;
-
struct hash_list_st {
char const* name;
Elf32_Addr addr;
@@ -703,6 +812,8 @@
virtual void find_nearest_line(asymbol_st const*, Elf32_Addr, char const**, char const**, unsigned int*);
private:
char* allocate_and_read_section(int i);
+ friend void location_ct::M_store(void);
+ friend void location_ct::stabs_range(range_st const& range) const;
void register_range(location_st const& location, range_st const& range);
void load_stabs(void);
void load_dwarf(void);
@@ -712,6 +823,48 @@
};
//-------------------------------------------------------------------------------------------------------------------------------------------
+
+void location_ct::M_store(void)
+{
+ if (M_used)
+ {
+ DoutDwarf(dc::bfd, "Skipping M_store: M_used is set.");
+ return;
+ }
+ if (M_prev_location.M_source_iter == M_source_iter && M_prev_location.M_line == M_line)
+ {
+ DoutDwarf(dc::bfd, "Skipping M_store: location didn't change.");
+ M_used = true;
+ return;
+ }
+ if (M_range.start == M_address)
+ {
+ DoutDwarf(dc::bfd, "Skipping M_store: address range is zero.");
+ return;
+ }
+ if (M_range.start)
+ {
+ DoutDwarf(dc::bfd, "M_store(): Registering new range.");
+ M_range.size = M_address - M_range.start;
+ M_object_file->register_range(M_prev_location, M_range);
+ }
+#if DEBUGDWARF
+ else
+ DoutDwarf(dc::bfd, "M_store(): M_range.start was 0.");
+#endif
+ M_range.start = M_address;
+ M_prev_location.M_func_iter = M_func_iter;
+ M_prev_location.M_source_iter = M_source_iter;
+ M_prev_location.M_line = M_line;
+ M_used = true;
+}
+
+inline void location_ct::stabs_range(range_st const& range) const
+{
+ M_object_file->register_range(*this, range);
+}
+
+//-------------------------------------------------------------------------------------------------------------------------------------------
// Implementation
static asection_st const abs_section_c = { 0, "*ABS*" };
@@ -1157,7 +1310,7 @@
debug_info_ptr += 4;
break;
case DW_FORM_data8:
- DoutDwarf(dc::finish, *reinterpret_cast<unsigned long long const*>(debug_info_ptr));
+ // DoutDwarf(dc::finish, *reinterpret_cast<unsigned long long const*>(debug_info_ptr));
debug_info_ptr += 8;
break;
case DW_FORM_indirect:
@@ -1181,7 +1334,7 @@
debug_info_ptr += 4;
break;
case DW_FORM_ref8:
- DoutDwarf(dc::finish, *reinterpret_cast<unsigned long long const*>(debug_info_ptr));
+ // DoutDwarf(dc::finish, *reinterpret_cast<unsigned long long const*>(debug_info_ptr));
debug_info_ptr += 8;
break;
case DW_FORM_ref_udata:
@@ -1264,12 +1417,8 @@
// State machine.
// See paragraph 6.2 of "DWARF Debugging Information Format" document.
- Elf32_Addr address; // The program-counter value corresponding to a machine instruction generated by the compiler.
uLEB128_t file; // An unsigned integer indicating the identity of the source file corresponding to a machine
// instruction.
- unsigned int line; // An unsigned integer indicating a source line number. Lines are numbered beginning at 1.
- // The compiler may emit the value 0 in cases where an instruction cannot be attributed to
- // any source line.
uLEB128_t column; // An unsigned integer indicating a column number within a source line. Columns are numbered
// beginning at 1. The value 0 is reserved to indicate that a statement begins at the left
// edge of the line.
@@ -1329,29 +1478,25 @@
object_files_string cur_dir;
object_files_string cur_source;
- location_st location;
- range_st range;
+ location_ct location(this);
object_files_string cur_func("-DWARF symbol\0"); // We don't add function names - this is used to see we're
// doing DWARF in find_nearest_line().
- location.func_iter = M_function_names.insert(cur_func).first;
+ location.set_func_iter(M_function_names.insert(cur_func).first);
do
{
- address = 0;
file = 0; // One less than the `file' mentioned in the documentation.
- line = 1;
column = 0;
is_stmt = default_is_stmt;
basic_block = false;
end_sequence = false;
-
- location.line = 0;
- range.start = 0;
-
cur_dir = default_dir;
cur_source = cur_dir + default_source;
- location.source_iter = M_source_files.insert(cur_source).first;
+
+ location.invalidate();
+ location.set_source_iter(M_source_files.insert(cur_source).first);
+ location.set_line(1);
while(!end_sequence)
{
@@ -1368,25 +1513,25 @@
LIBCWD_ASSERT( size > 0 );
uLEB128_t extended_opcode;
dwarf_read(debug_line_ptr, extended_opcode);
- LIBCWD_ASSERT( extended_opcode < 0x80 ); // Then it's size is one:
+ LIBCWD_ASSERT( extended_opcode < 0x80 ); // Then it's size is one:
--size;
switch(extended_opcode)
{
case DW_LNE_end_sequence:
LIBCWD_ASSERT( size == 0 );
end_sequence = true;
- DoutDwarf(dc::bfd, "DW_LNE_end_sequence: Address: 0x" << std::hex << address);
- range.size = address - range.start;
- if (location.line)
- register_range(location, range);
+ DoutDwarf(dc::bfd, "DW_LNE_end_sequence: Address: 0x" << std::hex << location.get_address());
+ location.sequence_end();
break;
case DW_LNE_set_address:
+ {
+ Elf32_Addr address;
LIBCWD_ASSERT( size == sizeof(address) );
dwarf_read(debug_line_ptr, address);
DoutDwarf(dc::bfd, "DW_LNE_set_address: 0x" << std::hex << address);
- if (!range.start)
- range.start = address;
+ location.set_address(address);
break;
+ }
case DW_LNE_define_file:
{
unsigned char const* end = debug_line_ptr + size;
@@ -1411,38 +1556,31 @@
break;
}
case DW_LNS_copy:
- DoutDwarf(dc::bfd, "DW_LNS_copy: Address/Line: 0x" << std::hex << address << ", " << std::dec << line);
- if (location.line && location.line != line)
- {
- range.size = address - range.start;
- register_range(location, range);
- range.start = address;
- }
- location.line = line;
+ DoutDwarf(dc::bfd, "DW_LNS_copy");
+ location.copy();
basic_block = false;
break;
case DW_LNS_advance_pc:
{
uLEB128_t address_increment;
dwarf_read(debug_line_ptr, address_increment);
- address += minimum_instruction_length * address_increment;
- DoutDwarf(dc::bfd, "DW_LNS_advance_pc: 0x" << std::hex << address);
- if (!range.start)
- range.start = address;
+ DoutDwarf(dc::bfd, "DW_LNS_advance_pc: " << std::hex << address_increment);
+ location.increment_address(minimum_instruction_length * address_increment);
break;
}
case DW_LNS_advance_line:
{
LEB128_t line_increment;
dwarf_read(debug_line_ptr, line_increment);
- line += line_increment;
- DoutDwarf(dc::bfd, "DW_LNS_advance_line: " << line);
+ DoutDwarf(dc::bfd, "DW_LNS_advance_line: " << line_increment);
+ location.increment_line(line_increment);
break;
}
case DW_LNS_set_file:
dwarf_read(debug_line_ptr, file);
--file;
DoutDwarf(dc::bfd, "DW_LNS_set_file: \"" << file_names[file].name << '"');
+ location.invalidate();
if (*file_names[file].name == '/')
cur_source.assign(file_names[file].name);
else
@@ -1458,8 +1596,7 @@
cur_source.append(file_names[file].name);
}
cur_source += '\0';
- location.source_iter = M_source_files.insert(cur_source).first;
- location.line = 0;
+ location.set_source_iter(M_source_files.insert(cur_source).first);
break;
case DW_LNS_set_column:
dwarf_read(debug_line_ptr, column);
@@ -1475,21 +1612,17 @@
break;
case DW_LNS_const_add_pc:
{
+ DoutDwarf(dc::bfd, "DW_LNS_const_add_pc");
unsigned int address_increment = (255 - opcode_base) / line_range;
- address += minimum_instruction_length * address_increment;
- DoutDwarf(dc::bfd, "DW_LNS_const_add_pc: 0x" << std::hex << address);
- if (!range.start)
- range.start = address;
+ location.increment_address(minimum_instruction_length * address_increment);
break;
}
case DW_LNS_fixed_advance_pc:
{
+ DoutDwarf(dc::bfd, "DW_LNS_fixed_advance_pc");
unsigned short int address_increment;
dwarf_read(debug_line_ptr, address_increment);
- address += minimum_instruction_length * address_increment;
- DoutDwarf(dc::bfd, "DW_LNS_fixed_advance_pc: 0x" << std::hex << address);
- if (!range.start)
- range.start = address;
+ location.increment_address(minimum_instruction_length * address_increment);
break;
}
default:
@@ -1506,17 +1639,12 @@
{
// Special opcode.
int line_increment = line_base + ((opcode - opcode_base) % line_range);
- line += line_increment;
unsigned int address_increment = (opcode - opcode_base) / line_range;
- address += minimum_instruction_length * address_increment;
- DoutDwarf(dc::bfd, "Special opcode. Address/Line: 0x" << std::hex << address << ", " << std::dec << line);
- if (location.line && location.line != line) // Catenate ranges with same location.
- {
- range.size = address - range.start;
- register_range(location, range);
- range.start = address;
- }
- location.line = line;
+ DoutDwarf(dc::bfd, "Special opcode. Address/Line increments: 0x" <<
+ std::hex << address_increment << ", " << std::dec << line_increment);
+ location.invalidate(); // Make sure we won't add a new range until after also line was incremented.
+ location.increment_address(minimum_instruction_length * address_increment);
+ location.increment_line(line_increment);
basic_block = false;
}
}
@@ -1582,7 +1710,7 @@
object_files_string cur_dir;
object_files_string cur_source;
object_files_string cur_func;
- location_st location;
+ location_ct location(this);
range_st range;
bool skip_function = false;
bool source_file_changed_and_we_didnt_copy_it_yet = true;
@@ -1630,7 +1758,7 @@
Dout(dc::bfd, "N_FUN: " << "end at " << std::hex << stabs[j].n_value << '.');
range.size = func_addr + stabs[j].n_value - range.start;
if (!skip_function)
- register_range(location, range);
+ location.stabs_range(range);
skip_function = false;
}
else
@@ -1646,7 +1774,7 @@
range.start = func_addr = stabs[j].n_value;
if (DEBUGSTABS)
Dout(dc::bfd, "N_FUN: " << std::hex << func_addr << " : \"" << &stabs_string_table[stabs[j].n_strx] << "\".");
- if (func_addr == 0 && location.line)
+ if (func_addr == 0 && location.is_valid_stabs())
{
// Start of function is not given (bug in assembler?), try to find it by name:
uint32_t hash = elf_hash(reinterpret_cast<unsigned char const*>(fn), (unsigned char)':');
@@ -1667,7 +1795,7 @@
// the dynamic linker has put it in the 'undefined' section and no
// address is known even though there is still this N_FUN entry.
skip_function = true;
- location.line = 0;
+ location.invalidate();
break;
}
else if (DEBUGSTABS)
@@ -1691,8 +1819,8 @@
LIBCWD_ASSERT( func_addr_test == func_addr );
}
#endif
- location.func_iter = M_function_names.insert(cur_func).first;
- location.line = 0; // See N_SLINE
+ location.set_func_iter(M_function_names.insert(cur_func).first);
+ location.invalidate(); // See N_SLINE
}
break;
}
@@ -1701,9 +1829,9 @@
Dout(dc::bfd, "N_SLINE: " << stabs[j].n_desc << " at " << std::hex << stabs[j].n_value << '.');
if (stabs[j].n_value != 0)
{
- // Always false when function was changed since last line because location.line is set to 0 in that case.
+ // Always false when function was changed since last line because location.invalidate() was called in that case.
// Catenate ranges with same location.
- if (!source_file_changed_and_we_didnt_copy_it_yet && stabs[j].n_desc == location.line)
+ if (!source_file_changed_and_we_didnt_copy_it_yet && location.is_valid_stabs() && stabs[j].n_desc == location.get_line())
break;
range.size = func_addr + stabs[j].n_value - range.start;
// Delay one source/line change when there was no code since last source file change.
@@ -1714,12 +1842,12 @@
break;
}
if (!skip_function)
- register_range(location, range);
+ location.stabs_range(range);
range.start += range.size;
}
// Store the source/line for the next range.
- location.source_iter = last_source_iter;
- location.line = stabs[j].n_desc;
+ location.set_source_iter(last_source_iter);
+ location.set_line(stabs[j].n_desc);
source_file_changed_and_we_didnt_copy_it_yet = false;
source_file_changed_but_line_number_not_yet = false;
break;
@@ -1754,7 +1882,7 @@
range.start = offset;
range.size = 1;
object_files_range_location_map_ct::const_iterator i(M_ranges.find(static_cast<range_st const>(range)));
- if (i == M_ranges.end() || (*(*(*i).second.func_iter).data() != '-' && strcmp((*(*i).second.func_iter).data(), symbol->name)))
+ if (i == M_ranges.end() || (*(*(*i).second.M_func_iter).data() != '-' && strcmp((*(*i).second.M_func_iter).data(), symbol->name)))
{
*file = NULL;
*func = symbol->name;
@@ -1762,12 +1890,12 @@
}
else
{
- *file = (*(*i).second.source_iter).data();
- if (*(*(*i).second.func_iter).data() != '-') // '-' is used for DWARF symbols by load_dwarf() (see above).
- *func = (*(*i).second.func_iter).data();
+ *file = (*(*i).second.M_source_iter).data();
+ if (*(*(*i).second.M_func_iter).data() != '-') // '-' is used for DWARF symbols by load_dwarf() (see above).
+ *func = (*(*i).second.M_func_iter).data();
else
*func = symbol->name;
- *line = (*i).second.line;
+ *line = (*i).second.M_line;
}
return;
}
@@ -1784,9 +1912,7 @@
{
if ((DEBUGDWARF && M_dwarf_debug_line_section_index)
|| (DEBUGSTABS && M_stabs_section_index))
- Dout(dc::bfd, std::hex << range.start << " - " << (range.start + range.size)
- << "; " << (*location.source_iter).data() << ':' << std::dec << location.line << " : \""
- << (*location.func_iter).data() << "\".");
+ Dout(dc::bfd, std::hex << range.start << " - " << (range.start + range.size) << "; " << location << '.');
#if DEBUGSTABS || DEBUGDWARF
std::pair<object_files_range_location_map_ct::iterator, bool> p(
#endif
@@ -1798,7 +1924,7 @@
#if DEBUGSTABS || DEBUGDWARF
if (!p.second)
{
- if ((*p.first).second.func_iter != location.func_iter)
+ if ((*p.first).second.M_func_iter != location.M_func_iter)
Dout(dc::bfd, "WARNING: Collision between different functions (" << *p.first << ")!?");
else
{
@@ -1806,9 +1932,9 @@
Dout(dc::bfd, "WARNING: Different start for same function (" << *p.first << ")!?");
if ((*p.first).first.size != range.size)
Dout(dc::bfd, "WARNING: Different sizes for same function. Not sure what .stabs entry to use.");
- if ((*p.first).second.line != location.line)
+ if ((*p.first).second.M_line != location.M_line)
Dout(dc::bfd, "WARNING: Different line numbers for overlapping range (" << *p.first << ")!?");
- if ((*p.first).second.source_iter != location.source_iter)
+ if ((*p.first).second.M_source_iter != location.M_source_iter)
Dout(dc::bfd, "Collision with " << *p.first << ".");
}
}
Index: src/libcwd/testsuite/lib/libcwd.exp
diff -u src/libcwd/testsuite/lib/libcwd.exp:1.8 src/libcwd/testsuite/lib/libcwd.exp:1.9
--- src/libcwd/testsuite/lib/libcwd.exp:1.8 Sat Feb 24 19:47:38 2001
+++ src/libcwd/testsuite/lib/libcwd.exp Thu Jan 3 20:22:33 2002
@@ -43,7 +43,7 @@
verbose " out = \"$out\""
if { [regexp -- "nodebug" $options] } {
- regsub -- "-g\[a-z0-9\]*" "$OPTIONS" "" compiler_options
+ regsub -- "-g\[-a-z0-9\]*" "$OPTIONS" "" compiler_options
} else {
set compiler_options "$OPTIONS"
}
Index: src/libcwd/testsuite/libcwd.tst/test.exp
diff -u src/libcwd/testsuite/libcwd.tst/test.exp:1.7 src/libcwd/testsuite/libcwd.tst/test.exp:1.8
--- src/libcwd/testsuite/libcwd.tst/test.exp:1.7 Mon Dec 31 20:43:05 2001
+++ src/libcwd/testsuite/libcwd.tst/test.exp Thu Jan 3 20:22:33 2002
@@ -2,7 +2,7 @@
global SHAREDLIBS STATICLIBS
catch "glob -nocomplain $srcdir/$subdir/*.cc" srcfiles
-# set srcfiles $srcdir/$subdir/dlopen.cc
+# set srcfiles $srcdir/$subdir/leak.cc
verbose "srcfiles are $srcfiles"
set prefix ""
----------------------- End of diff -----------------------
|