|
From: Carlo W. <li...@us...> - 2001-11-17 00:14:40
|
CVSROOT : /cvsroot/libcw
Module : src
Branch tags: branch-threading
Commit time: 2001-10-17 00:14:39 UTC
Modified files:
Tag: branch-threading
libcwd/bfd.cc libcwd/debugmalloc.cc
libcwd/documentation/doxygen.config
libcwd/include/libcw/debugmalloc.h
Added files:
Tag: branch-threading
libcwd/include/ios_base_Init.h libcwd/include/libcw/class_alloc.h
libcwd/include/libcw/class_marker.h
libcwd/include/libcw/class_memblk_types.h
Log message:
Work in progress.
---------------------- diff included ----------------------
Index: src/libcwd/bfd.cc
diff -u src/libcwd/bfd.cc:1.85.2.28 src/libcwd/bfd.cc:1.85.2.29
--- src/libcwd/bfd.cc:1.85.2.28 Tue Nov 13 19:01:06 2001
+++ src/libcwd/bfd.cc Fri Nov 16 16:14:28 2001
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/bfd.cc,v 1.85.2.28 2001/11/14 03:01:06 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/bfd.cc,v 1.85.2.29 2001/11/17 00:14:28 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -46,6 +46,7 @@
#include <cstdio> // Needed for vsnprintf.
#include <algorithm>
#include "debug.h"
+#include "ios_base_Init.h"
#ifdef CWDEBUG_DLOPEN_DEFINED
#undef dlopen
#undef dlclose
Index: src/libcwd/debugmalloc.cc
diff -u src/libcwd/debugmalloc.cc:1.61.2.42 src/libcwd/debugmalloc.cc:1.61.2.43
--- src/libcwd/debugmalloc.cc:1.61.2.42 Tue Nov 13 19:01:06 2001
+++ src/libcwd/debugmalloc.cc Fri Nov 16 16:14:28 2001
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/debugmalloc.cc,v 1.61.2.42 2001/11/14 03:01:06 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/debugmalloc.cc,v 1.61.2.43 2001/11/17 00:14:28 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -153,6 +153,7 @@
#include <iostream>
#include <iomanip>
#include "debug.h"
+#include "ios_base_Init.h"
#include <libcw/cwprint.h>
// MULTI THREADING
@@ -1540,7 +1541,7 @@
size_t memsize = const_dm_alloc_ct::get_memsize();
unsigned long memblks = const_dm_alloc_ct::get_memblks();
RELEASE_READ_LOCK
- o << "Allocated memory: " << memsize << " bytes in " << memblks << " blocks.";
+ o << "Allocated memory: " << memsize << " bytes in " << memblks << " blocks";
return o;
}
Index: src/libcwd/documentation/doxygen.config
diff -u src/libcwd/documentation/doxygen.config:1.1.2.3 src/libcwd/documentation/doxygen.config:1.1.2.4
--- src/libcwd/documentation/doxygen.config:1.1.2.3 Tue Nov 13 19:01:07 2001
+++ src/libcwd/documentation/doxygen.config Fri Nov 16 16:14:29 2001
@@ -73,7 +73,8 @@
../include/libcw/class_fatal_channel.h \
../include/libcw/class_continued_channel.h \
../include/libcw/class_channel_set.h \
- .
+ . \
+ ../include/libcw/debugmalloc.h
FILE_PATTERNS = *.dox
RECURSIVE = NO
EXCLUDE =
Index: src/libcwd/include/ios_base_Init.h
diff -u /dev/null src/libcwd/include/ios_base_Init.h:1.1.2.1
--- /dev/null Fri Nov 16 16:14:39 2001
+++ src/libcwd/include/ios_base_Init.h Fri Nov 16 16:14:29 2001
@@ -0,0 +1,30 @@
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/Attic/ios_base_Init.h,v 1.1.2.1 2001/11/17 00:14:29 libcw Exp $
+//
+// Copyright (C) 2000 - 2001, by
+//
+// Carlo Wood, Run on IRC <ca...@al...>
+// RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt
+// Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61
+//
+// This file may be distributed under the terms of the Q Public License
+// version 1.0 as appearing in the file LICENSE.QPL included in the
+// packaging of this file.
+//
+
+#ifndef IOS_BASE_INIT_H
+#define IOS_BASE_INIT_H
+
+namespace libcw {
+ namespace debug {
+ namespace _private_ {
+
+#ifdef __GLIBCPP__
+extern bool WST_ios_base_initialized;
+extern bool inside_ios_base_Init_Init(void);
+#endif
+
+ } // namespace _private_
+ } // namespace debug
+} // namespace libcw
+
+#endif // IOS_BASE_INIT__H
Index: src/libcwd/include/libcw/class_alloc.h
diff -u /dev/null src/libcwd/include/libcw/class_alloc.h:1.1.2.1
--- /dev/null Fri Nov 16 16:14:39 2001
+++ src/libcwd/include/libcw/class_alloc.h Fri Nov 16 16:14:29 2001
@@ -0,0 +1,81 @@
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/Attic/class_alloc.h,v 1.1.2.1 2001/11/17 00:14:29 libcw Exp $
+//
+// Copyright (C) 2000 - 2001, by
+//
+// Carlo Wood, Run on IRC <ca...@al...>
+// RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt
+// Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61
+//
+// This file may be distributed under the terms of the Q Public License
+// version 1.0 as appearing in the file LICENSE.QPL included in the
+// packaging of this file.
+//
+
+#ifndef LIBCW_CLASS_ALLOC_H
+#define LIBCW_CLASS_ALLOC_H
+
+#ifndef LIBCW_DEBUG_CONFIG_H
+#include <libcw/debug_config.h>
+#endif
+
+#ifndef LIBCW_CLASS_MEMBLK_TYPES_H
+#include <libcw/class_memblk_types.h> // Needed for memblk_types_nt.
+#endif
+#ifndef LIBCW_LOCKABLE_AUTO_PTR_H
+#include <libcw/lockable_auto_ptr.h> // Needed for lockable_auto_ptr<char, true>.
+#endif
+#if defined(DEBUGUSEBFD) && !defined(LIBCW_CLASS_LOCATION_H)
+#include <libcw/class_location.h> // Needed for location_ct.
+#endif
+#ifndef LIBCW_CSTDDEF
+#define LIBCW_CSTDDEF
+#include <cstddef> // Needed for size_t.
+#endif
+
+namespace libcw {
+ namespace debug {
+
+// Forward declaration
+class type_info_ct;
+
+//===================================================================================================
+//
+// The class which describes allocated memory blocks.
+//
+
+/**
+ * \brief An object of type alloc_ct contains information about one allocated memory block.
+ */
+class alloc_ct {
+protected:
+ void const* a_start; // Duplicate of (original) memblk_key_ct
+ size_t a_size; // Duplicate of (original) memblk_key_ct
+ memblk_types_nt a_memblk_type; // A flag which indicates the type of allocation
+ type_info_ct const* type_info_ptr; // Type info of related object
+ lockable_auto_ptr<char, true> a_description; // A label describing this memblk
+#ifdef DEBUGUSEBFD
+ location_ct M_location; // Source file, function and line number from where
+ // the allocator was called from
+#endif
+public:
+ alloc_ct(void const* s, size_t sz, memblk_types_nt type, type_info_ct const& ti) :
+ a_start(s), a_size(sz), a_memblk_type(type), type_info_ptr(&ti) { }
+ /** \brief The allocated size in bytes. */
+ size_t size(void) const { return a_size; }
+ /** \brief A pointer to the start of the allocated memory block. */
+ void const* start(void) const { return a_start; }
+ memblk_types_nt memblk_type(void) const { return a_memblk_type; }
+ type_info_ct const& type_info(void) const { return *type_info_ptr; }
+ char const* description(void) const { return a_description.get(); }
+#ifdef DEBUGUSEBFD
+ location_ct& location_reference(void) { return M_location; }
+ location_ct const& location(void) const { return M_location; }
+#endif
+protected:
+ virtual ~alloc_ct() {}
+};
+
+ } //namespace debug
+} // namespace libcw
+
+#endif // LIBCW_CLASS_ALLOC_H
Index: src/libcwd/include/libcw/class_marker.h
diff -u /dev/null src/libcwd/include/libcw/class_marker.h:1.1.2.1
--- /dev/null Fri Nov 16 16:14:39 2001
+++ src/libcwd/include/libcw/class_marker.h Fri Nov 16 16:14:29 2001
@@ -0,0 +1,33 @@
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/Attic/class_marker.h,v 1.1.2.1 2001/11/17 00:14:29 libcw Exp $
+//
+// Copyright (C) 2000 - 2001, by
+//
+// Carlo Wood, Run on IRC <ca...@al...>
+// RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt
+// Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61
+//
+// This file may be distributed under the terms of the Q Public License
+// version 1.0 as appearing in the file LICENSE.QPL included in the
+// packaging of this file.
+//
+
+#ifndef LIBCW_CLASS_MARKER_H
+#define LIBCW_CLASS_MARKER_H
+
+namespace libcw {
+ namespace debug {
+
+class marker_ct {
+private:
+ void register_marker(char const* label);
+public:
+ marker_ct(char const* label) { register_marker(label); }
+ marker_ct(void) { register_marker("An allocation marker"); }
+ ~marker_ct(void);
+};
+
+ } //namespace debug
+} // namespace libcw
+
+#endif // LIBCW_CLASS_MARKER_H
+
Index: src/libcwd/include/libcw/class_memblk_types.h
diff -u /dev/null src/libcwd/include/libcw/class_memblk_types.h:1.1.2.1
--- /dev/null Fri Nov 16 16:14:39 2001
+++ src/libcwd/include/libcw/class_memblk_types.h Fri Nov 16 16:14:29 2001
@@ -0,0 +1,69 @@
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/Attic/class_memblk_types.h,v 1.1.2.1 2001/11/17 00:14:29 libcw Exp $
+//
+// Copyright (C) 2000 - 2001, by
+//
+// Carlo Wood, Run on IRC <ca...@al...>
+// RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt
+// Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61
+//
+// This file may be distributed under the terms of the Q Public License
+// version 1.0 as appearing in the file LICENSE.QPL included in the
+// packaging of this file.
+//
+
+#ifndef LIBCW_CLASS_MEMBLK_TYPES_H
+#define LIBCW_CLASS_MEMBLK_TYPES_H
+
+#ifndef LIBCW_DEBUG_CONFIG_H
+#include <libcw/debug_config.h>
+#endif
+#ifndef LIBCW_IOSFWD
+#define LIBCW_IOSFWD
+#include <iosfwd> // Needed for ostream.
+#endif
+
+namespace libcw {
+ namespace debug {
+
+//===================================================================================================
+// Flags used to mark the type of `memblk':
+//
+
+// If you change this, then also edit `expected_from' in debugmalloc.cc!
+enum memblk_types_nt {
+ memblk_type_new, // Allocated with `new'
+ memblk_type_deleted, // Deleted with `delete'
+ memblk_type_new_array, // Allocated with `new[]'
+ memblk_type_deleted_array, // Deleted with `delete[]'
+ memblk_type_malloc, // Allocated with `malloc'
+ memblk_type_realloc, // Reallocated with `realloc'
+ memblk_type_freed, // Freed with `free'
+#ifdef DEBUGMARKER
+ memblk_type_marker, // A memory allocation "marker"
+ memblk_type_deleted_marker, // A deleted memory allocation "marker"
+#endif
+ memblk_type_external // Externally allocated with `malloc' (no magic numbers!)
+};
+
+class memblk_types_ct {
+private:
+ memblk_types_nt memblk_type;
+public:
+ memblk_types_ct(memblk_types_nt mbt) : memblk_type(mbt) { }
+ memblk_types_nt operator()(void) const { return memblk_type; }
+};
+
+extern ::std::ostream& operator<<(::std::ostream& os, memblk_types_ct);
+
+__inline__
+::std::ostream&
+operator<<(::std::ostream& os, memblk_types_nt memblk_type)
+{
+ return os << memblk_types_ct(memblk_type);
+}
+
+ } // namespace debug
+} // namespace libcw
+
+#endif // LIBCW_CLASS_MEMBLK_TYPES_H
+
Index: src/libcwd/include/libcw/debugmalloc.h
diff -u src/libcwd/include/libcw/debugmalloc.h:1.28.2.30 src/libcwd/include/libcw/debugmalloc.h:1.28.2.31
--- src/libcwd/include/libcw/debugmalloc.h:1.28.2.30 Tue Nov 13 19:01:08 2001
+++ src/libcwd/include/libcw/debugmalloc.h Fri Nov 16 16:14:29 2001
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/debugmalloc.h,v 1.28.2.30 2001/11/14 03:01:08 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/debugmalloc.h,v 1.28.2.31 2001/11/17 00:14:29 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -11,6 +11,10 @@
// packaging of this file.
//
+/** \file libcw/debugmalloc.h
+ * \brief An internal header file, don't include directly.
+ */
+
#ifndef LIBCW_DEBUGMALLOC_H
#define LIBCW_DEBUGMALLOC_H
@@ -18,126 +22,57 @@
#error "Don't include <libcw/debugmalloc.h> directly, include the appropriate \"debug.h\" instead."
#endif
+#include <libcw/debug_config.h>
+#ifndef DEBUGMALLOC
+#error "nonsense!"
+#endif
#ifdef DEBUGMALLOC
+/** \interface foobar
+ * \brief test interface
+ */
+
#ifndef LIBCW_CSTDDEF
#define LIBCW_CSTDDEF
-#include <cstddef> // Needed for size_t
+#include <cstddef> // Needed for size_t.
#endif
-
-namespace libcw {
- namespace debug {
- namespace _private_ {
-
-#ifdef __GLIBCPP__
-extern bool WST_ios_base_initialized;
-bool inside_ios_base_Init_Init(void);
+#ifndef LIBCW_CLASS_ALLOC_H
+#include <libcw/class_alloc.h>
#endif
-
- } // namespace _private_
- } // namespace debug
-} // namespace libcw
-
+#ifndef LIBCW_LOCKABLE_AUTO_PTR_H
#include <libcw/lockable_auto_ptr.h>
+#endif
+#ifndef LIBCW_PRIVATE_SET_ALLOC_CHECKING_H
#include <libcw/private_set_alloc_checking.h>
-#ifdef DEBUGUSEBFD
-#include <libcw/class_location.h>
#endif
+#ifndef LIBCW_CLASS_MEMBLK_TYPES_H
+#include <libcw/class_memblk_types.h>
+#endif
+#if defined(DEBUGMARKER) && !defined(LIBCW_CLASS_MARKER_H)
+#include <libcw/class_marker.h>
+#endif
namespace libcw {
namespace debug {
// Forward declaration
class type_info_ct;
-
-//===================================================================================================
-// Flags used to mark the type of `memblk':
-//
-
-// If you change this, then also edit `expected_from' in debugmalloc.cc!
-enum memblk_types_nt {
- memblk_type_new, // Allocated with `new'
- memblk_type_deleted, // Deleted with `delete'
- memblk_type_new_array, // Allocated with `new[]'
- memblk_type_deleted_array, // Deleted with `delete[]'
- memblk_type_malloc, // Allocated with `malloc'
- memblk_type_realloc, // Reallocated with `realloc'
- memblk_type_freed, // Freed with `free'
-#ifdef DEBUGMARKER
- memblk_type_marker, // A memory allocation "marker"
- memblk_type_deleted_marker, // A deleted memory allocation "marker"
-#endif
- memblk_type_external // Externally allocated with `malloc' (no magic numbers!)
-};
-
-class dm_alloc_ct;
-
-class memblk_types_ct {
-private:
- memblk_types_nt memblk_type;
-public:
- memblk_types_ct(memblk_types_nt mbt) : memblk_type(mbt) { }
- memblk_types_nt operator()(void) const { return memblk_type; }
-};
-
-extern ::std::ostream& operator<<(::std::ostream& os, memblk_types_ct);
-
-__inline__
-::std::ostream&
-operator<<(::std::ostream& os, memblk_types_nt memblk_type)
-{
- return os << memblk_types_ct(memblk_type);
-}
-
-//===================================================================================================
-//
-// The class which describes allocated memory blocks.
-//
-
-class alloc_ct {
-protected:
- void const* a_start; // Duplicate of (original) memblk_key_ct
- size_t a_size; // Duplicate of (original) memblk_key_ct
- memblk_types_nt a_memblk_type; // A flag which indicates the type of allocation
- type_info_ct const* type_info_ptr; // Type info of related object
- lockable_auto_ptr<char, true> a_description; // A label describing this memblk
-#ifdef DEBUGUSEBFD
- location_ct M_location; // Source file, function and line number from where
- // the allocator was called from
-#endif
-public:
- alloc_ct(void const* s, size_t sz, memblk_types_nt type, type_info_ct const& ti) :
- a_start(s), a_size(sz), a_memblk_type(type), type_info_ptr(&ti) { }
- size_t size(void) const { return a_size; }
- void const* start(void) const { return a_start; }
- memblk_types_nt memblk_type(void) const { return a_memblk_type; }
- type_info_ct const& type_info(void) const { return *type_info_ptr; }
- char const* description(void) const { return a_description.get(); }
-#ifdef DEBUGUSEBFD
- location_ct& location_reference(void) { return M_location; }
- location_ct const& location(void) const { return M_location; }
-#endif
-protected:
- virtual ~alloc_ct() {}
-};
-
-#ifdef DEBUGMARKER
-class marker_ct {
-private:
- void register_marker(char const* label);
-public:
- marker_ct(char const* label)
- {
- register_marker(label);
- }
- marker_ct(void)
- {
- register_marker("An allocation marker");
- }
- ~marker_ct(void);
-};
-#endif
+/** \interface malloc_report debug.h libcw/debug.h
+ * \brief writing total ammount of allocated memory to an ostream.
+ *
+ * \par Example:
+ * \n
+ * \code
+ * Dout(dc::malloc, malloc_report << '.');
+ * \endcode
+ *
+ * will output something like
+ *
+ * \outputexample
+ * Allocated 4350 bytes in 7 blocks.
+ * \endoutputexample
+ */
class debugmalloc_report_ct {
friend ::std::ostream& operator<<(::std::ostream& o, debugmalloc_report_ct);
};
----------------------- End of diff -----------------------
|