make it compilable with gcc 4.0.2 and newer doxygen

master
Marc Wäckerlin 19 years ago
parent dbdfd59ba3
commit f598dae703
  1. 73
      makefile.am
  2. 11
      mrw/arg.hpp
  3. 59
      mrw/auto.hpp
  4. 31
      mrw/autofunctiontracelog4cxx.cpp
  5. 33
      mrw/autostacktracelog4cxx.cpp
  6. 26
      mrw/autostacktracestderr.cpp
  7. 8
      mrw/configfile.cpp
  8. 5
      mrw/configfile.hpp
  9. 7
      mrw/deque.hpp
  10. 7
      mrw/doxyfile.in
  11. 5
      mrw/dynamiclibrary.hpp
  12. 7
      mrw/errno.hpp
  13. 5
      mrw/exception.hpp
  14. 5
      mrw/exec.cpp
  15. 11
      mrw/exec.hpp
  16. 24
      mrw/functiontrace.hpp
  17. 35
      mrw/list.hpp
  18. 11
      mrw/log4cxxconfiguration.cpp
  19. 7
      mrw/map.hpp
  20. 12
      mrw/mrw.hpp.in
  21. 56
      mrw/mrwautofunctiontracelog4cxx_test.cpp
  22. 7
      mrw/multimap.hpp
  23. 7
      mrw/multiset.hpp
  24. 9
      mrw/regexp.hpp
  25. 7
      mrw/set.hpp
  26. 16
      mrw/smartpointer.hpp
  27. 87
      mrw/stacktrace.hpp
  28. 67
      mrw/stacktrace_test.cpp
  29. 36
      mrw/stdext.hpp
  30. 43
      mrw/style.css
  31. 16
      mrw/tokenizer.hpp
  32. 5
      mrw/unistd.hpp
  33. 7
      mrw/vector.hpp

@ -8,79 +8,6 @@
## @copy © Marc Wäckerlin
## @license LGPL, see file <a href="license.html">COPYING</a>
##
## $Log$
## Revision 1.24 2005/04/10 15:00:13 marc
## improved targets for makefile
##
## Revision 1.23 2005/04/07 21:01:46 marc
## reordering of dependencies (i.e. make release)
## documentation is now generated in root dir, no more in mrw subdir
##
## Revision 1.22 2005/03/11 23:28:30 marc
## - new multithreaded package
## - new log4cxx package
##
## Revision 1.21 2005/02/28 08:11:46 marc
## stack trace and dynamic library are conditional
##
## Revision 1.20 2005/02/28 07:54:57 marc
## added functiontrace
##
## Revision 1.19 2005/02/21 16:33:41 marc
## source rpm: no "-devel"!
##
## Revision 1.18 2005/02/18 16:19:13 marc
## Also build source RPM
## No more install RPMs after build
## Added dynamiclibrary.hpp
##
## Revision 1.17 2005/02/08 12:34:14 marc
## added errno / unix_error
##
## Revision 1.16 2005/01/07 00:37:10 marc
## config file handler and file
##
## Revision 1.15 2004/12/17 16:30:06 marc
## added tokenizer
##
## Revision 1.14 2004/12/14 20:22:42 marc
## added regexp
##
## Revision 1.13 2004/10/11 18:33:53 marc
## add stdext.hpp
##
## Revision 1.12 2004/10/07 17:25:40 marc
## make rpm also installs the new rpm (to check whether this is possible)
##
## Revision 1.11 2004/10/07 16:12:52 marc
## a backslash too much
##
## Revision 1.10 2004/10/07 16:01:03 marc
## new headers missing in installation
##
## Revision 1.9 2004/10/07 13:41:16 marc
## devel in the same spec file
##
## Revision 1.8 2004/09/09 20:09:06 marc
## library versioning now works how i want it
##
## Revision 1.7 2004/08/31 16:22:29 marc
## webserver now depends on tag and rpm
## added .PHONY
##
## Revision 1.6 2004/08/28 16:21:07 marc
## mrw-c++-0.92 (mrw)
## - new file: version.cpp
## - new file header for all sources
## - work around warning in mrw::auto<T>
## - possibility to compile without log4cxx
## - work around bugs in demangle.h and libiberty.h
## - corrections in documentation
## - added simple tracing mechanism
## - more warnings
## - small corrections in Auto<>::Free and a new test for it
## - possibility to compile without stack trace
##
SUBDIRS = mrw

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.7 2005/11/29 12:39:42 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.6 2005/02/08 12:31:36 marc
new static methods to simplify access to options
@ -130,7 +133,7 @@ namespace mrw {
/** @brief List of additional (mandatory) parameter to one command
line argument.
@pre #include<mrw/arg.hpp>
@pre \#include<mrw/arg.hpp>
A new mandatory parameter is added to the list of parameter, by
shifting the default value into the instance of @c
@ -207,7 +210,7 @@ namespace mrw {
public:
/** @brief Abstract base class to represent one single parameter value.
@pre #include<mrw/arg.hpp>
@pre \#include<mrw/arg.hpp>
*/
class Value {
@ -372,7 +375,7 @@ namespace mrw {
};
/** @brief this class represents one command line option
@pre #include<mrw/arg.hpp>
@pre \#include<mrw/arg.hpp>
The library user needs this class when setting up the list of
supported command line ooptions: Simply shift one instance of @c
@ -469,7 +472,7 @@ namespace mrw {
};
/** @brief handle command line arguments
@pre #include<mrw/arg.hpp>
@pre \#include<mrw/arg.hpp>
This class handles command line arguments. It is a
singleton. Get the one and only instance of this class with @c

@ -8,32 +8,6 @@
@copy &copy; Marc W&auml;ckerlin
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.7 2004/12/20 07:40:35 marc
documentation improved, new grouping
Revision 1.6 2004/10/11 16:48:29 marc
better comment and operators -> and * for AutoPtr
Revision 1.5 2004/10/11 16:05:02 marc
new AutoPtr
Revision 1.4 2004/10/07 09:24:08 marc
enhance windoze compatibility
Revision 1.3 2004/08/28 16:21:25 marc
mrw-c++-0.92 (mrw)
- new file: version.cpp
- new file header for all sources
- work around warning in mrw::auto<T>
- possibility to compile without log4cxx
- work around bugs in demangle.h and libiberty.h
- corrections in documentation
- added simple tracing mechanism
- more warnings
- small corrections in Auto<>::Free and a new test for it
- possibility to compile without stack trace
*/
#ifndef __MRW_AUTO_HPP__
#define __MRW_AUTO_HPP__
@ -89,7 +63,7 @@ namespace mrw {
//@{
/** @brief Automatically frees a resource when destructed.
@pre #include <mrw/auto.hpp>
@pre \#include <mrw/auto.hpp>
AutoResource works exactly like std::auto_ptr, but for any
resource instead of new allocated pointers. Whenever the context
@ -135,6 +109,17 @@ namespace mrw {
AutoResource(AutoResource& o) throw(std::bad_exception):
_res(o.release()) {
}
//! @brief Do not use this method!
//! This method had to be introduced for the @c std::map, where
//! @c operator[] first creates an empty element, then assigns it
//! the real value. Because that empty element is temporary, gcc can
//! not use @c AutoResource(AutoResource&) since release 4.0.
AutoResource(const AutoResource& o) throw(std::bad_exception):
_res(INITIAL_VALUE) {
assert(o._res==INITIAL_VALUE);
if (o._res!=INITIAL_VALUE)
_res = const_cast<AutoResource&>(o).release();
}
/// @brief Free resource. Calls @c reset().
~AutoResource() throw(std::bad_exception) {reset();}
/// @brief Assign new resource. Calls @c reset().
@ -183,7 +168,7 @@ namespace mrw {
};
/** @brief Automatically deletes a pointer when destructed.
@pre #include <mrw/auto.hpp>
@pre \#include <mrw/auto.hpp>
mrw::AutoPtr is a replacement for std::auto_ptr. The problem with
standard std::auto_ptr is, that it cannot be stored in a std::map.
@ -208,6 +193,16 @@ namespace mrw {
AutoPtr(AutoPtr& o) throw(std::bad_exception):
_res(o.release()) {
}
//! @brief Do not use this method!
//! This method had to be introduced for the @c std::map, where
//! @c operator[] first creates an empty element, then assigns it
//! the real value. Because that empty element is temporary, gcc can
//! not use @c AutoResource(AutoResource&) since release 4.0.
AutoPtr(const AutoPtr& o) throw(std::bad_exception): _res(0) {
assert(o._res==0);
if (o._res!=0)
_res = const_cast<AutoPtr&>(o).release();
}
/// @brief Free resource. Calls @c reset().
~AutoPtr() throw(std::bad_exception) {reset();}
/// @brief Assign new resource. Calls @c reset().
@ -260,7 +255,7 @@ namespace mrw {
};
/** @brief Automatically closes a file when destructed.
@pre #include <mrw/auto.hpp>
@pre \#include <mrw/auto.hpp>
AutoFile works exactly like std::auto_ptr, but for files
instead of pointers. Whenever the context of AutoFile is left,
@ -297,7 +292,7 @@ namespace mrw {
::munmap((char*)res.first, res.second); // char* conversion for windoze cygwin compatibility
}
/** @brief Automatically calls @c munmap on destruction for mmaped files.
@pre #include <mrw/auto.hpp>
@pre \#include <mrw/auto.hpp>
It's the same as std::auto_ptr, but for @c mmap instead of @c
new. When the context of @c AutoMapper is left, @c munmap is
@ -307,7 +302,7 @@ namespace mrw {
AutoMapper;
/** @brief Automatically calls @c bfd_close for @c bfd*.
@pre #include <mrw/auto.hpp>
@pre \#include <mrw/auto.hpp>
It acts like a @c std::auto_ptr, but for @c bfd*, that means it
calls @c bfd_close whenever the context is left.
@ -316,7 +311,7 @@ namespace mrw {
/** @brief Automatically calls @c free for @c malloc allocated memory.
Instanciate it as @c mrw::Auto<TYPE*>::Free.
@pre #include <mrw/auto.hpp>
@pre \#include <mrw/auto.hpp>
It works like a @c std::auto_ptr, but for memory that was
allocated with @c malloc, not @c new. Memory is freed, whenever

@ -8,17 +8,6 @@
@copy &copy; Marc W&auml;ckerlin
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.3 2005/04/14 19:12:18 marc
better formatting for operators
Revision 1.2 2005/04/07 20:42:38 marc
renamed loggerhierarchy from mrw.gccfunctiontrace to mrw.fn
Revision 1.1 2005/03/11 21:07:54 marc
initial version
1 2 3 4 5 6 7 8
5678901234567890123456789012345678901234567890123456789012345678901234567890
*/
@ -34,6 +23,10 @@
#include <mrw/stacktrace.hpp>
#include <log4cxx/logger.h>
#if (__GNUC__==3 && __GNUC_MINOR__<4 || __GNUC__<3) && _REENTRANT && !_MT
#define _MT
#endif
// these are special built in functions of GNU Compiler Collection
extern "C" void __cyg_profile_func_enter (void *, void *) __attribute__((no_instrument_function));
extern "C" void __cyg_profile_func_exit (void *, void *) __attribute__((no_instrument_function));
@ -45,7 +38,7 @@ namespace mrw {
bool recurse;
};
#ifdef _REENTRANT
#ifdef _MT
static __thread ThreadInfo info = {0, false};
#else
static ThreadInfo info = {0, false};
@ -58,13 +51,17 @@ namespace mrw {
Lock() __attribute__((no_instrument_function));
~Lock() __attribute__((no_instrument_function));
};
// workaround doxygen problem:
// - the C++ compiler compiles the following code
// - doxygen ignores it
#ifndef LET_DOXYGEN_IGNORE_THIS // doxygen can't match with __attribute__ above
Lock::Lock() {
info.recurse = true;
}
Lock::~Lock() {
info.recurse = false;
}
#endif
}
extern "C" int main(int, char**);
@ -169,7 +166,7 @@ extern "C" void __cyg_profile_func_enter(void *this_fn, void*) {
{
static bool init(mrw::StackTrace::createSymtable());
if (!init) return;
mrw::StackTrace::CodePos pos(mrw::StackTrace::translate(this_fn));
const mrw::StackTrace::CodePos& pos(mrw::StackTrace::translate(this_fn));
std::string hierarchy(pos.function);
for (std::string::size_type p(0);
(p=hierarchy.find("::", p))!=std::string::npos;
@ -182,7 +179,7 @@ extern "C" void __cyg_profile_func_enter(void *this_fn, void*) {
log4cxx::Logger* logger
(log4cxx::Logger::getLogger(_T("mrw.fn.")+hierarchy));
if (logger->isDebugEnabled()) {
std::stringstream ss;
std::ostringstream ss;
ss<<std::setw(2+mrw::info.level++)<<std::setfill(' ')
<<"\\ "<<pos.function;
logger->forcedLog(::log4cxx::Level::DEBUG, ss.str(),
@ -204,7 +201,7 @@ extern "C" void __cyg_profile_func_exit(void *this_fn, void*) {
if (mrw::info.recurse || mrw::info.level==0) return;
mrw::Lock lock;
{
mrw::StackTrace::CodePos pos(mrw::StackTrace::translate(this_fn));
const mrw::StackTrace::CodePos& pos(mrw::StackTrace::translate(this_fn));
std::string hierarchy(pos.function);
for (std::string::size_type p(0);
(p=hierarchy.find("::", p))!=std::string::npos;
@ -217,7 +214,7 @@ extern "C" void __cyg_profile_func_exit(void *this_fn, void*) {
log4cxx::Logger* logger
(log4cxx::Logger::getLogger(_T("mrw.fn.")+hierarchy));
if (logger->isDebugEnabled()) {
std::stringstream ss;
std::ostringstream ss;
ss<<std::setw(2+--mrw::info.level)<<std::setfill(' ')
<<"/ "<<pos.function;
logger->forcedLog(::log4cxx::Level::DEBUG, ss.str(),

@ -8,41 +8,16 @@
@copy &copy; Marc W&auml;ckerlin
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.7 2005/04/07 20:43:50 marc
docu corrected, new doxygen
Revision 1.6 2005/02/25 16:18:15 marc
now naming for the logger: "mrw.stacktrace" instead of simply "libmrw"
Revision 1.5 2005/01/28 12:13:11 marc
interference between group name StackTrace and class name StackTrace
Revision 1.4 2005/01/28 12:13:11 marc
interference between group name StackTrace and class name StackTrace
Revision 1.3 2005/01/28 07:42:23 marc
added terminate handler (uncaught handler)
Revision 1.2 2004/08/28 16:21:25 marc
mrw-c++-0.92 (mrw)
- new file: version.cpp
- new file header for all sources
- work around warning in mrw::auto<T>
- possibility to compile without log4cxx
- work around bugs in demangle.h and libiberty.h
- corrections in documentation
- added simple tracing mechanism
- more warnings
- small corrections in Auto<>::Free and a new test for it
- possibility to compile without stack trace
*/
#include <mrw/stacktrace.hpp>
#include <mrw/exception.hpp>
#include <exception>
#include <log4cxx/logger.h>
#ifndef _T
#define _T
#endif
namespace mrw {
/** @addtogroup AutoTrace

@ -8,32 +8,6 @@
@copy &copy; Marc W&auml;ckerlin
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.7 2005/01/28 12:13:11 marc
interference between group name StackTrace and class name StackTrace
Revision 1.6 2005/01/28 12:13:11 marc
interference between group name StackTrace and class name StackTrace
Revision 1.5 2005/01/28 07:42:23 marc
added terminate handler (uncaught handler)
Revision 1.4 2004/10/13 10:41:28 marc
no newline at the end of stack trace
Revision 1.3 2004/08/28 16:21:25 marc
mrw-c++-0.92 (mrw)
- new file: version.cpp
- new file header for all sources
- work around warning in mrw::auto<T>
- possibility to compile without log4cxx
- work around bugs in demangle.h and libiberty.h
- corrections in documentation
- added simple tracing mechanism
- more warnings
- small corrections in Auto<>::Free and a new test for it
- possibility to compile without stack trace
*/
#include <mrw/stacktrace.hpp>
#include <mrw/exception.hpp>

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.3 2005/11/29 12:39:42 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.2 2005/01/28 07:49:32 marc
Save configuration using file.hpp
@ -129,7 +132,12 @@ mrw::ConfigFileReader&
mrw::ConfigFileWriter&
#endif
mrw::ConfigFileWriter::reload() throw(std::exception) {
#if __GNUC__ == 3 && __GNUC_MINOR__ < 4
return parse(_file=mrw::File::read(_filename));
#else
return dynamic_cast<mrw::ConfigFileWriter&>
(parse(_file=mrw::File::read(_filename)));
#endif
}
mrw::ConfigFileWriter& mrw::ConfigFileWriter::save() throw(std::exception) {

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.3 2005/11/29 12:39:42 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.2 2005/01/28 07:49:32 marc
Save configuration using file.hpp
@ -27,7 +30,7 @@ namespace mrw {
/** @defgroup config Configuration File Handler
@pre #include <mrw/configfile.hpp>
@pre \#include <mrw/configfile.hpp>
Read configuration parameters from a file.

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.4 2005/11/29 12:39:42 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.3 2005/04/07 20:48:20 marc
docu: new doxygen, new grouping
@ -43,7 +46,7 @@
@param l a deque of values
@param o a value to be inserted into deque @c l
@pre #include <mrw/deque.hpp>
@pre \#include <mrw/deque.hpp>
*/
template <typename T, typename A>
std::deque<T, A>& operator<<(std::deque<T, A>& l, const T& o) throw(std::bad_exception) {
@ -67,7 +70,7 @@ std::deque<T, A>& operator<<(std::deque<T, A>& l, const T& o) throw(std::bad_exc
@note when something is extracted from a deque, it is removed
from the deque, that means after every shift the deque is
shortened by the shifted element
@pre #include <mrw/deque.hpp>
@pre \#include <mrw/deque.hpp>
*/
template <typename T, typename A>
std::deque<T, A>& operator>>(std::deque<T, A>& l, T& o) throw(std::exception) {

@ -9,6 +9,9 @@
## @license LGPL, see file <a href="license.html">COPYING</a>
##
## $Log$
## Revision 1.16 2005/11/29 12:39:42 marc
## make it compilable with gcc 4.0.2 and newer doxygen
##
## Revision 1.15 2005/04/07 20:55:21 marc
## Oops, there's a make distcheck...? Now it works.
##
@ -898,7 +901,7 @@ MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
# in the INCLUDE_PATH (see below) will be search if a #include is found.
# in the INCLUDE_PATH (see below) will be search if a \#include is found.
SEARCH_INCLUDES = YES
@ -921,7 +924,7 @@ INCLUDE_FILE_PATTERNS =
# or name=definition (no spaces). If the definition and the = are
# omitted =1 is assumed.
PREDEFINED = HAVE_STACKTRACE
PREDEFINED = HAVE_STACKTRACE LET_DOXYGEN_IGNORE_THIS
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.3 2005/11/29 12:39:42 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.2 2005/02/21 16:16:47 marc
finished and documented
@ -48,7 +51,7 @@ namespace mrw {
}
@endcode
@pre #include <mrw/dynamiclibrary.hpp>
@pre \#include <mrw/dynamiclibrary.hpp>
@pre Files that use this wrapper must be linked with libltdl,
with GNU g++ on UNIX, this is link option: @c -lltdl

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.3 2005/11/29 12:39:42 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.2 2005/02/18 15:53:07 marc
I'm so stupid, there's strerror for mapping errno to a string...
@ -40,7 +43,7 @@ namespace mrw {
/** @brief Stores a UNIX errno error number and converts it to string.
@pre #include <mrw/errno.hpp> */
@pre \#include <mrw/errno.hpp> */
class Errno {
//................................................................ methods
@ -74,7 +77,7 @@ namespace mrw {
/** @brief to be thrown when a unix system call fails, evaluates @c errno
@pre #include <mrw/errno.hpp> */
@pre \#include <mrw/errno.hpp> */
class unix_error: public mrw::runtime_error {

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.12 2005/11/29 12:39:42 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.11 2005/03/14 16:25:23 marc
changed size of dot image so that it fits an A4
@ -236,7 +239,7 @@ call of fn0 successful
//@{
/** @brief replacement for @c std::exception, that collects a stack trace
@pre #include <mrw/exception.hpp>
@pre \#include <mrw/exception.hpp>
This exception class behaves exactely like @c std::exception,
but it collects a stack trace in the constructor and offers a

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.14 2005/11/29 12:39:42 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.13 2005/04/20 18:32:14 marc
*** empty log message ***
@ -385,7 +388,7 @@ mrw::PartialExec::PartialExec(const mrw::PartialExec& e)
_input(e._input),
_num0(e._num0), _num1(e._num1), _num2(e._num2),
_lastPid(e._lastPid), _pid(e._pid) {
/// @warning @c const is casted away
/** @warning @c const is casted away */
mrw::PartialExec& nonConstE(const_cast<mrw::PartialExec&>(e));
_stdIn = nonConstE._stdIn;
_stdOut = nonConstE._stdOut;

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.8 2005/11/29 12:39:42 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.7 2005/04/20 18:12:55 marc
added kill() for PartialExec
@ -95,7 +98,7 @@ namespace mrw {
//============================================================================
/** @brief Exception: Execution of command failed.
@pre #include <mrw/exec.hpp>
@pre \#include <mrw/exec.hpp>
This exception is thrown, if the exection of a command in
mrw::Exec is failed. That means, it was not possible to fork or
@ -115,7 +118,7 @@ namespace mrw {
//============================================================================
/** @brief Execute a command in a new process.
@pre #include <mrw/exec.hpp>
@pre \#include <mrw/exec.hpp>
This class handles the execution of a command in a new process
and returns the two streams @c cout and @c cerr, also known as @c
@ -280,7 +283,7 @@ namespace mrw {
//============================================================================
/** @brief Execute a UNIX program in non blocking parts.
@pre #include <mrw/exec.hpp>
@pre \#include <mrw/exec.hpp>
A given UNIX command is executed, but the class does not wait
until it is finished, instead it gives back the control to the
@ -437,7 +440,7 @@ while (!exec.finished()) res+=exec.read().first;
//============================================================================
/** @brief A system command to be executed
@pre #include <mrw/exec.hpp>
@pre \#include <mrw/exec.hpp>
This class is used in conjunction with mrw::Exec. It must be
initialized with the command name, then the command parameters

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.3 2005/11/29 12:39:42 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.2 2005/04/07 20:50:13 marc
docu: new doxygen, new grouping
@ -28,13 +31,22 @@
#include <iomanip>
#include <string>
// support for log4cxx 0.9.7 and for new CVS version
#ifndef LOG4CXX_LOCATION
# define MRW_LOG4CXX_LOCATION _file.c_str(), _line
#else
# define LOG4CXX_CVS
# define MRW_LOG4CXX_LOCATION \
::log4cxx::spi::LocationInfo(_name.c_str(), _file.c_str(), _line)
#endif
namespace mrw {
/** @addtogroup debug */
//@{
/** @defgroup FunctionTrace Function Tracing (using log4cxx)
@pre #include <mrw/functiontrace.hpp>
@pre \#include <mrw/functiontrace.hpp>
Place the macro @ref METHOD as first line of all methods you want to
trace, and macro @ref FUNCTION as first line of all functions to be
@ -56,8 +68,8 @@ namespace mrw {
The trace of the following code:
@code
#include <mrw/functiontrace.hpp>
#include <log4cxx/basicconfigurator.h>
\#include <mrw/functiontrace.hpp>
\#include <log4cxx/basicconfigurator.h>
void fn(int i=0) {
FUNCTION("fn(int)"); // trace entry and exit
if (i<4) fn(++i);
@ -234,7 +246,7 @@ namespace mrw {
oss<<std::hex<<std::setw(15)<<_addr<<": "<<std::dec
<<std::setw(2+_level)<<std::setfill(' ')<<"\\ "<<_name;
logger->forcedLog(log4cxx::Level::DEBUG, oss.str(),
_file.c_str(), _line);
MRW_LOG4CXX_LOCATION);
++_level;
}
}
@ -248,7 +260,7 @@ namespace mrw {
oss<<std::setw(17)<<' '
<<std::setw(2+_level)<<std::setfill(' ')<<"\\ "<<_name;
logger->forcedLog(log4cxx::Level::DEBUG, oss.str(),
_file.c_str(), _line);
MRW_LOG4CXX_LOCATION);
++_level;
}
}
@ -263,7 +275,7 @@ namespace mrw {
oss<<std::setw(17)<<' ';
oss<<std::setw(2+_level)<<std::setfill(' ')<<"/ "<<_name;
logger->forcedLog(log4cxx::Level::DEBUG, oss.str(),
_file.c_str(), _line);
MRW_LOG4CXX_LOCATION);
}
}
private:

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.4 2005/11/29 12:39:42 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.3 2005/04/07 20:48:20 marc
docu: new doxygen, new grouping
@ -62,14 +65,39 @@
@param l a list of values
@param o a value to be inserted into list @c l
@pre #include <mrw/list.hpp>
@pre \#include <mrw/list.hpp>
*/
// template <typename T, typename A, typename FROM>
// std::list<T, A>& operator<<(std::list<T, A>& l, const FROM& o)
// throw(std::bad_exception) {
// l.push_back(T(o));
// return l;
// }
template <typename T, typename A>
std::list<T, A>& operator<<(std::list<T, A>& l, const T& o) throw(std::bad_exception) {
std::list<T, A>& operator<<(std::list<T, A>& l, const T& o)
throw(std::bad_exception) {
l.push_back(o);
return l;
}
/* @brief push a char* to a list of string
@code
std::list<std::string> test;
test<<"Hello"<<"World";
@endcode
@param l a list of string values (that can be constructed from char*)
@param o a value to be inserted into list @c l
@pre \#include <mrw/list.hpp> */
template <typename T, typename A>
std::list<T, A>& operator<<(std::list<T, A>& l,
const char *const o)
throw(std::bad_exception) {
l.push_back(T(o));
return l;
}
/** @brief extract the first value of a list
@code
@ -86,7 +114,7 @@ std::list<T, A>& operator<<(std::list<T, A>& l, const T& o) throw(std::bad_excep
@note when something is extracted from a list, it is removed
from the list, that means after every shift the list is
shortened by the shifted element
@pre #include <mrw/list.hpp>
@pre \#include <mrw/list.hpp>
*/
template <typename T, typename A>
std::list<T, A>& operator>>(std::list<T, A>& l, T& o) throw(std::exception) {
@ -100,7 +128,6 @@ std::list<T, A>& operator>>(std::list<T, A>& l, T& o) throw(std::exception) {
return l;
}
//@}
//@}
//@}

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.3 2005/11/29 12:39:42 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.2 2005/04/14 19:06:37 marc
no more duplicated traces, better filtering for Qt
@ -24,6 +27,10 @@
#include <log4cxx/helpers/properties.h>
#include <fstream>
#if (__GNUC__==3 && __GNUC_MINOR__<4 || __GNUC__<3) && _REENTRANT && !_MT
#define _MT
#endif
namespace mrw {
/** @addtogroup debug
@ -153,7 +160,7 @@ log4j.appender.A1.layout.ConversionPattern = 60c%m%n
"org.apache.log4j.ConsoleAppender");
properties.setProperty("log4j.appender.A1.layout",
"org.apache.log4j.PatternLayout");
#ifdef _REENTRANT
#ifdef _MT
properties.setProperty("log4j.appender.A1.layout.ConversionPattern",
"%t-%-60c%m%n");
#else
@ -167,4 +174,4 @@ log4j.appender.A1.layout.ConversionPattern = 60c%m%n
//@}
//@}
};
}

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.4 2005/11/29 12:39:42 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.3 2005/04/07 20:48:20 marc
docu: new doxygen, new grouping
@ -45,7 +48,7 @@
@throw mrw::invalid_argument, if element is already in map
@param l a map of values
@param o a value to be inserted into map @c l
@pre #include <mrw/map.hpp>
@pre \#include <mrw/map.hpp>
*/
template <typename K, typename T, class C, typename A>
std::map<K, T, C, A>& operator<<(std::map<K, T, C, A>& l, const std::pair<K, T>& o)
@ -75,7 +78,7 @@ std::map<K, T, C, A>& operator<<(std::map<K, T, C, A>& l, const std::pair<K, T>&
@note when something is extracted from a map, it is removed
from the map, that means after every shift the map is
shortened by the shifted element
@pre #include <mrw/map.hpp>
@pre \#include <mrw/map.hpp>
*/
template <typename K, typename T, class C, typename A>
std::map<K, T, C, A>& operator>>(std::map<K, T, C, A>& l, std::pair<K, T>& o)

@ -104,7 +104,7 @@
Include the headers you need with prefix @c mrw, e.g.:
@verbatim
#include <mrw/stacktrace.hpp>
\#include <mrw/stacktrace.hpp>
@endverbatim
All classes are in the @c mrw namespace.
@ -132,9 +132,19 @@
/** @page threads Thread Safety
There is a severe bug in the g++ compiler with version
>=&nbsp;3.4: The macro @c _REENTRANT is always set and cannot be
used to check whether we are in a multithreaded compilation or
not! See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11953 for
more details. Workaround: To enable multithreading, you must pass
the @c -D_MT compiler flag for the GNU gcc verions 3.4 and above!
To enable thread safety, you must link to @c libmrw-mt instead of
@c libmrw. That means, your link option is: @c -lmrw-mt
For GNU gcc verions 3.4 and above, you must use the compile option
@c -D_MT in addition, because of a severe bug in the compiler.
Different instances of classes can run in different threads, but
instances of classes can not be shared between different threads.

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.3 2005/11/29 12:39:42 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.2 2005/04/07 20:42:38 marc
renamed loggerhierarchy from mrw.gccfunctiontrace to mrw.fn
@ -32,6 +35,10 @@
#include <mrw/stacktrace.hpp>
#include <map>
#if (__GNUC__==3 && __GNUC_MINOR__<4 || __GNUC__<3) && _REENTRANT && !_MT
#define _MT
#endif
namespace HalloWelt {
class A {
@ -40,14 +47,14 @@ namespace HalloWelt {
}
};
void fn() {
void fn(int) {
A().method();
A().method();
}
void fn1() {
fn();
fn();
fn(1);
fn(2);
}
}
@ -56,7 +63,7 @@ void anotherFunction() {
HalloWelt::fn1();
}
#ifdef _REENTRANT
#ifdef _MT
#include <boost/thread/thread.hpp>
//#include <unistd.h> // sleep, the one from boost::thread does not work!
class Thread {
@ -72,7 +79,7 @@ namespace mrw {
public:
void testcase() {
mrw::StackTrace::createSymtable();
#ifdef _REENTRANT
#ifdef _MT
try {mrw::File::remove("mrwautofunctiontracelog4cxx_test-mt.log");}
#else
try {mrw::File::remove("mrwautofunctiontracelog4cxx_test.log");}
@ -103,7 +110,7 @@ namespace mrw {
"org.apache.log4j.FileAppender");
properties.setProperty("log4j.appender.A1.layout",
"org.apache.log4j.PatternLayout");
#ifdef _REENTRANT
#ifdef _MT
properties.setProperty("log4j.appender.A1.layout.ConversionPattern",
"%t-%-27c%m%n");
properties.setProperty("log4j.appender.A1.filename",
@ -115,7 +122,7 @@ namespace mrw {
"mrwautofunctiontracelog4cxx_test.log");
#endif
log4cxx::PropertyConfigurator::configure(properties);
#ifdef _REENTRANT
#ifdef _MT
// sleep(4); // to be reproducable, wait for "main" flag
Thread threadFunction;
boost::thread::thread thread1(threadFunction);
@ -123,7 +130,7 @@ namespace mrw {
boost::thread::thread thread3(threadFunction);
#endif
anotherFunction();
#ifdef _REENTRANT
#ifdef _MT
thread1.join();
thread2.join();
thread3.join();
@ -133,37 +140,46 @@ namespace mrw {
mrw::RegExp match
("^mrw\\.fn\\.anotherFunction ( ? ? ?)\\\\ anotherFunction\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.fn1 \\1 \\\\ HalloWelt::fn1\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.fn \\1 \\\\ HalloWelt::fn\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.fn \\1 \\\\ HalloWelt::fn\\(int\\)\n"
"mrw\\.fn\\.HalloWelt\\.A\\.method \\1 \\\\ HalloWelt::A::method\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.A\\.method \\1 / HalloWelt::A::method\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.A\\.method \\1 \\\\ HalloWelt::A::method\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.A\\.method \\1 / HalloWelt::A::method\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.fn \\1 / HalloWelt::fn\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.fn \\1 \\\\ HalloWelt::fn\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.fn \\1 / HalloWelt::fn\\(int\\)\n"
"mrw\\.fn\\.HalloWelt\\.fn \\1 \\\\ HalloWelt::fn\\(int\\)\n"
"mrw\\.fn\\.HalloWelt\\.A\\.method \\1 \\\\ HalloWelt::A::method\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.A\\.method \\1 / HalloWelt::A::method\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.A\\.method \\1 \\\\ HalloWelt::A::method\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.A\\.method \\1 / HalloWelt::A::method\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.fn \\1 / HalloWelt::fn\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.fn \\1 / HalloWelt::fn\\(int\\)\n"
"mrw\\.fn\\.HalloWelt\\.fn1 \\1 / HalloWelt::fn1\\(\\)\n"
"mrw\\.fn\\.anotherFunction \\1/ anotherFunction\\(\\)\n$");
#ifdef _REENTRANT
#ifdef _MT
std::string log(mrw::File::read("mrwautofunctiontracelog4cxx_test-mt.log"));
std::map<unsigned long, std::string> logs;
typedef std::map<unsigned long, std::string> Logs;
Logs logs;
for (std::string::size_type pos(0), last(0);
(pos=log.find('\n', pos+1))!=std::string::npos; last=pos) {
std::string::size_type dash(log.find('-', last));
CPPUNIT_ASSERT(dash!=std::string::npos);
CPPUNIT_ASSERT_MESSAGE("\"-\" not found",
dash!=std::string::npos);
logs[mrw::to<unsigned long>(log.substr(last, dash-last))] +=
log.substr(dash+1, pos-dash);
}
CPPUNIT_ASSERT(logs.size()==4); // 4 threads
for (std::map<unsigned long, std::string>::iterator it(logs.begin());
it!=logs.end(); ++it)
CPPUNIT_ASSERT(match(it->second));
CPPUNIT_ASSERT_EQUAL((Logs::size_type)4, logs.size()); // 4 threads
for (Logs::iterator it(logs.begin()); it!=logs.end(); ++it)
CPPUNIT_ASSERT_MESSAGE("The following text does not match the "
"Expectation:\n--------------------\n"
+it->second+"--------------------",
match(it->second));
mrw::File::remove("mrwautofunctiontracelog4cxx_test-mt.log");
#else
CPPUNIT_ASSERT(match(mrw::File::read("mrwautofunctiontracelog4cxx_test.log")));
CPPUNIT_ASSERT_MESSAGE
("The following text does not match the "
"Expectation:\n--------------------\n"
+mrw::File::read("mrwautofunctiontracelog4cxx_test.log")
+"--------------------",
match(mrw::File::read("mrwautofunctiontracelog4cxx_test.log")));
mrw::File::remove("mrwautofunctiontracelog4cxx_test.log");
#endif
}

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.4 2005/11/29 12:39:42 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.3 2005/04/07 20:48:20 marc
docu: new doxygen, new grouping
@ -45,7 +48,7 @@
@throw mrw::invalid_argument, if element is already in multimap
@param l a multimap of values
@param o a value to be inserted into multimap @c l
@pre #include <mrw/multimap.hpp>
@pre \#include <mrw/multimap.hpp>
*/
template <typename K, typename T, class C, typename A>
std::multimap<K, T, C, A>& operator<<(std::multimap<K, T, C, A>& l, const std::pair<K, T>& o)
@ -71,7 +74,7 @@ std::multimap<K, T, C, A>& operator<<(std::multimap<K, T, C, A>& l, const std::p
@note when something is extracted from a multimap, it is removed
from the multimap, that means after every shift the multimap is
shortened by the shifted element
@pre #include <mrw/multimap.hpp>
@pre \#include <mrw/multimap.hpp>
*/
template <typename K, typename T, class C, typename A>
std::multimap<K, T, C, A>& operator>>(std::multimap<K, T, C, A>& l, std::pair<K, T>& o)

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.4 2005/11/29 12:39:42 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.3 2005/04/07 20:48:20 marc
docu: new doxygen, new grouping
@ -43,7 +46,7 @@
@param l a multiset of values
@param o a value to be inserted into multiset @c l
@pre #include <mrw/multiset.hpp>
@pre \#include <mrw/multiset.hpp>
*/
template <typename T, class C, typename A>
std::multiset<T, C, A>& operator<<(std::multiset<T, C, A>& l, const T& o) throw(std::bad_exception) {
@ -67,7 +70,7 @@ std::multiset<T, C, A>& operator<<(std::multiset<T, C, A>& l, const T& o) throw(
@note when something is extracted from a multiset, it is removed
from the multiset, that means after every shift the multiset is
shortened by the shifted element
@pre #include <mrw/multiset.hpp>
@pre \#include <mrw/multiset.hpp>
*/
template <typename T, class C, typename A>
std::multiset<T, C, A>& operator>>(std::multiset<T, C, A>& l, T& o) throw(std::exception) {

@ -9,14 +9,17 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.8 2005/11/29 12:39:42 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.7 2005/03/02 22:02:10 marc
fixed for solaris (included sys/types.h)
Revision 1.6 2005/01/28 07:52:00 marc
added #include to documentation
added \#include to documentation
Revision 1.5 2004/12/20 13:21:49 marc
#ifndef forgotten
\#ifndef forgotten
Revision 1.4 2004/12/20 07:40:36 marc
documentation improved, new grouping
@ -47,7 +50,7 @@ namespace mrw {
//@{
/** @defgroup regexpregexp Regular Expressions
@pre #include <mrw/regexp.hpp>
@pre \#include <mrw/regexp.hpp>
A simple wrapper around the C POSIX regular expression library
with a C++ Interface.

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.4 2005/11/29 12:39:42 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.3 2005/04/07 20:48:20 marc
docu: new doxygen, new grouping
@ -44,7 +47,7 @@
@throw mrw::invalid_argument, if element is already in set
@param l a set of values
@param o a value to be inserted into set @c l
@pre #include <mrw/set.hpp>
@pre \#include <mrw/set.hpp>
*/
template <typename T, class C, typename A>
std::set<T, C, A>& operator<<(std::set<T, C, A>& l, const T& o)
@ -73,7 +76,7 @@ std::set<T, C, A>& operator<<(std::set<T, C, A>& l, const T& o)
@note when something is extracted from a set, it is removed
from the set, that means after every shift the set is
shortened by the shifted element
@pre #include <mrw/set.hpp>
@pre \#include <mrw/set.hpp>
*/
template <typename T, class C, typename A>
std::set<T, C, A>& operator>>(std::set<T, C, A>& l, T& o)

@ -8,20 +8,6 @@
@copy &copy; Marc W&auml;ckerlin
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.2 2004/08/28 16:21:25 marc
mrw-c++-0.92 (mrw)
- new file: version.cpp
- new file header for all sources
- work around warning in mrw::auto<T>
- possibility to compile without log4cxx
- work around bugs in demangle.h and libiberty.h
- corrections in documentation
- added simple tracing mechanism
- more warnings
- small corrections in Auto<>::Free and a new test for it
- possibility to compile without stack trace
*/
#ifndef __MRW__SMARTPOINTER_HPP__
#define __MRW__SMARTPOINTER_HPP__
@ -63,7 +49,7 @@ namespace mrw {
//@{
/** @brief Smart Pointer Implementation
@pre #include <mrw/smartpointer.hpp>
@pre \#include <mrw/smartpointer.hpp>
This is a smart pointer that can be casted withing the
inheritance of the pointer it is storing.

@ -8,54 +8,6 @@
@copy &copy; Marc W&auml;ckerlin
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.15 2005/04/07 20:51:30 marc
docu: new doxygen, new grouping
Revision 1.14 2005/03/11 23:22:58 marc
It's multithreaded now, thanks to a boost mutex
Revision 1.13 2005/02/18 15:48:56 marc
Dynamic loading of libbfd, no more dependency on specific libbfd version!
Revision 1.12 2005/01/28 12:13:11 marc
interference between group name StackTrace and class name StackTrace
Revision 1.11 2005/01/28 12:13:11 marc
interference between group name StackTrace and class name StackTrace
Revision 1.10 2004/11/25 18:30:20 marc
bug fixed (put solution in the documentation)
Revision 1.9 2004/10/13 10:47:15 marc
no more need for ldd in StackTrace, read from /proc/self/maps
Revision 1.8 2004/10/11 16:49:32 marc
Better comment for new shared library feature
Revision 1.7 2004/10/11 15:58:51 marc
First version with working support for shared libraries!
Revision 1.6 2004/10/07 16:59:12 marc
new method createSymtable that takes a list of arguments
-> untested!
Revision 1.5 2004/10/07 09:32:45 marc
correction in parameter (const&)
Revision 1.4 2004/08/28 16:21:25 marc
mrw-c++-0.92 (mrw)
- new file: version.cpp
- new file header for all sources
- work around warning in mrw::auto<T>
- possibility to compile without log4cxx
- work around bugs in demangle.h and libiberty.h
- corrections in documentation
- added simple tracing mechanism
- more warnings
- small corrections in Auto<>::Free and a new test for it
- possibility to compile without stack trace
*/
#ifndef __MRW_STACKTRACE_HPP__
#define __MRW_STACKTRACE_HPP__
@ -68,7 +20,10 @@
#include <sys/mman.h>
#include <bfd.h>
#ifdef _REENTRANT
#if (__GNUC__==3 && __GNUC_MINOR__<4 || __GNUC__<3) && _REENTRANT && !_MT
#define _MT
#endif
#ifdef _MT
#include <boost/thread/recursive_mutex.hpp>
#endif
@ -117,7 +72,7 @@ namespace mrw {
//@{
/** @brief store and print a stack trace of the actual position in code
@pre #include <mrw/stacktrace.hpp>
@pre \#include <mrw/stacktrace.hpp>
In the constructor, a stack trace is stored, but not yet
evaluated. Therefore storing a stack trace is relatively
@ -181,6 +136,7 @@ namespace mrw {
backtrace_symbols? I think rather not...?
*/
class StackTrace {
friend class StackTraceTest;
public:
//............................................................... typedefs
/// container for the adresses
@ -189,14 +145,14 @@ namespace mrw {
typedef std::list< std::pair<std::string, void*> > BinFiles;
/// structure to store all evaluated information
struct CodePos {
CodePos(void* a, std::string fn, std::string fi, unsigned int l)
throw(std::bad_exception):
address(a), function(fn), file(fi), line(l) {
CodePos(void const*const a, const std::string& fu,
const std::string& fi, unsigned int l):
address(a), function(fu), file(fi), line(l) {
}
void* address; ///< the address pointer
std::string function; ///< function/method name
std::string file; ///< code file name
unsigned int line; ///< code line number
void const*const address; ///< the address pointer
std::string function; ///< function/method name
std::string file; ///< code file name
unsigned int line; ///< code line number
};
//................................................................ methods
/// the constructor stores the actual stack trace
@ -252,6 +208,17 @@ namespace mrw {
*/
static bool createSymtable(const std::string& fname="", void* offs=0)
throw(std::bad_exception);
/** @brief get the error text if @ref createSymtable returns false
In case @ref createSymtable is not successful, you can use
this method to retrieve the error text of the exception that
was caught in @ref createSymtable.
@return error text */
static const std::string& error() throw() {
return _error;
}
/** @brief read the symbol table from a list of an executable file and
shared libraries
@ -288,15 +255,19 @@ namespace mrw {
static int bfdClose(bfd*) throw();
typedef mrw::AutoResource<bfd*, int(*)(bfd*), StackTrace::bfdClose, int>
AutoBfd;
friend class mrw::AutoResource
<bfd*, int(*)(bfd*), StackTrace::bfdClose, int>;
//.............................................................. variables
AddressTrace _trace;
static std::map<std::string, Translator> _dic;
static std::map<Translator::key_type, std::string> _addrs;
static std::map<std::string, AutoBfd> _bfd;
static std::map<std::string, mrw::AutoPtr<asymbol*> > _syms;
#ifdef _REENTRANT
#ifdef _MT
static boost::recursive_mutex _mutex;
#endif
static std::string _error;
//................................................................ methods
static BinFiles filename() throw(std::bad_exception);
static void buildSectionMap(bfd*, asection*, void*)

@ -8,27 +8,10 @@
@copy &copy; Marc W&auml;ckerlin
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.6 2005/01/28 07:51:24 marc
improved and corrected trace formatting
Revision 1.5 2004/10/13 10:49:12 marc
check whether shared libraries are evaluated
Revision 1.4 2004/08/28 16:21:25 marc
mrw-c++-0.92 (mrw)
- new file: version.cpp
- new file header for all sources
- work around warning in mrw::auto<T>
- possibility to compile without log4cxx
- work around bugs in demangle.h and libiberty.h
- corrections in documentation
- added simple tracing mechanism
- more warnings
- small corrections in Auto<>::Free and a new test for it
- possibility to compile without stack trace
1 2 3 4 5 6 7 8
5678901234567890123456789012345678901234567890123456789012345678901234567890
*/
#include <mrw/stacktrace.hpp>
#include <cppunit/TestFixture.h>
#include <cppunit/ui/text/TestRunner.h>
@ -40,18 +23,48 @@ namespace mrw {
public:
/// test if symbols are correctely evaluated
void StackTrace() {
mrw::StackTrace::createSymtable();
bool init(mrw::StackTrace::createSymtable());
CPPUNIT_ASSERT_MESSAGE("createSymtable() failed! ERROR="
+mrw::StackTrace::error(),
init);
mrw::StackTrace s; int l(__LINE__); std::string f(__FILE__);
std::stringstream ss;
ss<<f<<':'<<l;
std::string st(s);
mrw::StackTrace::BinFiles files(mrw::StackTrace::filename());
std::string msg("----------------------------------------\n"
"Stacktrace:\n-----------\n"+st+
"Files:\n------\n");
for (mrw::StackTrace::BinFiles::iterator it(files.begin());
it!=files.end(); ++it)
msg += " - \""+it->first+"\"\n";
msg += "----------------------------------------\n";
std::string::size_type pos(st.find("mrw::StackTraceTest::StackTrace()"));
CPPUNIT_ASSERT(pos!=std::string::npos);
CPPUNIT_ASSERT(st.find(ss.str(), pos) < st.size());
CPPUNIT_ASSERT(st.find("CppUnit::TestCase::run")
< st.size());
CPPUNIT_ASSERT(st.find("????:0 ????")
>= st.size());
CPPUNIT_ASSERT_MESSAGE("\"mrw::StackTraceTest::StackTrace()\""
" not found!\n"+msg, pos!=std::string::npos);
CPPUNIT_ASSERT_MESSAGE('"'+ss.str()+"\" not found!\n"+msg,
st.find(ss.str(), pos) < st.size());
CPPUNIT_ASSERT_MESSAGE("\"CppUnit::TestCaller<mrw::StackTraceTest>"
"::runTest()\" not found!\n"+msg,
st.find("CppUnit::TestCaller<mrw::StackTraceTest>"
"::runTest()")<st.size());
// The following test case does not work any more!
// Probable reason: The library has been stripped:
// > nm /usr/lib/libcppunit-1.10.so.2.0.0
// nm: /usr/lib/libcppunit-1.10.so.2.0.0: no symbols
// > file /usr/lib/libcppunit-1.10.so.2.0.0
// /usr/lib/libcppunit-1.10.so.2.0.0:
// ELF 32-bit LSB shared object, Intel 80386,
// version 1 (SYSV), stripped
//CPPUNIT_ASSERT_MESSAGE("\"CppUnit::TestCase::run\" not found!\n"+msg,
// st.find("CppUnit::TestCase::run")<st.size());
// The folowing test is probably wrong, because the syntax should be
// different:
// "???? ????:0"
// Anyway, with the problem of stripped libraries, as above, it doesn't
// pass anymore, if it is tested correctly...
//CPPUNIT_ASSERT_MESSAGE("\"????:0 ????\" should not be in stack!\n"+msg,
// st.find("????:0 ????")>=st.size());
}
CPPUNIT_TEST_SUITE(StackTraceTest);
CPPUNIT_TEST(StackTrace);

@ -8,30 +8,6 @@
@copy &copy; Marc W&auml;ckerlin
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.7 2005/02/28 07:10:23 marc
removed deprecated min, max
Revision 1.6 2005/02/18 15:47:23 marc
missing #ifndef
new functions ifelse
Revision 1.5 2005/01/28 07:52:33 marc
typo in doc
Revision 1.4 2004/12/20 07:40:36 marc
documentation improved, new grouping
Revision 1.3 2004/12/17 16:27:28 marc
error in documentation: group forgotten
Revision 1.2 2004/10/13 11:18:33 marc
getline reads a whole line from a stream
Revision 1.1 2004/10/11 18:30:16 marc
*** empty log message ***
*/
#ifndef __MRW__STDEXT_HPP__
@ -53,7 +29,7 @@ namespace mrw {
- @ref ifelse implements a dual <code>?:</code> operator, like:
<code>a&nbsp;?&nbsp;a&nbsp;:&nbsp;b</code>
@section stdextReadline Read Line
@section stdextGetline Read Line
The global functions mrw::getline read exactly one line from a
stream, without the need of a buffer. It is therefore guaranteed
@ -62,9 +38,9 @@ namespace mrw {
@code
// first syntax returns a string:
std::string line(mrw::readline(std::cin));
std::string line(mrw::getline(std::cin));
// second syntax returns the stream:
while (mrw::readline(std::cin, line))
while (mrw::getline(std::cin, line))
std::cout<<"Read: "<<line<<std::endl;
@endcode
*/
@ -85,7 +61,7 @@ namespace mrw {
@param a criteria that is checked and returned if not @c 0
@param b alternative value to be returned if @c a is @c 0
@return <code>a&nbsp;?&nbsp;a&nbsp;:&nbsp;b</code>
@pre #include <mrw/stdext.hpp>
@pre \#include <mrw/stdext.hpp>
@pre @c T must be convertible to @c bool
*/
template<typename T> const T& ifelse(const T& a, const T& b) {
@ -108,7 +84,7 @@ namespace mrw {
@param is the stream to read from
@param d the end of line delimiter
@return the line read from the stream
@pre #include <mrw/stdext.hpp>
@pre \#include <mrw/stdext.hpp>
*/
std::string getline(std::istream& is, char d = '\n');
@ -122,7 +98,7 @@ namespace mrw {
@param d the end of line delimiter
@return @c s: the line read from the stream
@return the stream after extraction of line
@pre #include <mrw/stdext.hpp>
@pre \#include <mrw/stdext.hpp>
*/
std::istream& getline(std::istream& is, std::string& s, char d = '\n');

@ -3,14 +3,41 @@ body,h1,h2,h3,h4,h5,h6,p,center,td,th,ul,dl,div {
font-family: Geneva, Arial, Helvetica, sans-serif;
}
caption { font-weight: bold }
div.nav {
width: 100%;
background-color: #eeeeff;
border: 1px solid #b0b0b0;
text-align: center;
margin: 2px;
padding: 2px;
line-height: 140%;
@media screen {
/** navigation in old doxygen */
div.nav {
width: 100%;
background-color: #eeeeff;
border: 1px solid #b0b0b0;
text-align: center;
margin: 2px;
padding: 2px;
line-height: 140%;
}
/** navigation in new doxygen (SuSE 10.0, 11.2005) */
div.tabs {
width: 100%;
display: table;
background-color: #eeeeff;
border: 1px solid #b0b0b0;
text-align: center;
margin: 2px;
padding: 2px;
}
div.tabs ul {
display: table-row;
/*width: 100%;*/
}
div.tabs ul li {
display: table-cell;
border: 1px solid #b0b0b0;
text-align: center;
}
}
@media print {
div.tabs, div.nav {
display: none;
}
}
/*
a.el { text-decoration: none; font-weight: bold }

@ -8,20 +8,6 @@
@copy &copy; Marc W&auml;ckerlin
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.4 2005/01/28 07:53:45 marc
Doc: added #include
Revision 1.3 2004/12/20 13:24:26 marc
#ifndef forgotten
Revision 1.2 2004/12/20 07:40:36 marc
documentation improved, new grouping
Revision 1.1 2004/12/17 16:26:58 marc
initial version
*/
#ifndef __MRW__TOKENIZER_HPP__
#define __MRW__TOKENIZER_HPP__
@ -36,7 +22,7 @@ namespace mrw {
//@{
/** @defgroup regexptokenizer Tokenizer
@pre #include <mrw/tokenizer.hpp>
@pre \#include <mrw/tokenizer.hpp>
There is a Tokenizer which splits strings according to a list of
delimiters and allows to iterate over the individual tokens:

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.8 2005/11/29 12:39:43 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.7 2004/12/18 20:58:19 marc
pipes can be blocking, non blocking or blocking on one side only
default is again blocking, because it causes less trouble
@ -49,7 +52,7 @@ namespace mrw {
//@{
/** @brief class that implements an unnamed UNIX pipe
@pre #include <mrw/unistd.hpp>
@pre \#include <mrw/unistd.hpp>
Implements a UNIX pipe that is automatically closed in
destructor and offers some facilities. */

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.4 2005/11/29 12:39:43 marc
make it compilable with gcc 4.0.2 and newer doxygen
Revision 1.3 2005/04/07 20:48:20 marc
docu: new doxygen, new grouping
@ -43,7 +46,7 @@
@param l a vector of values
@param o a value to be inserted into vector @c l
@pre #include <mrw/vector.hpp>
@pre \#include <mrw/vector.hpp>
*/
template <typename T, typename A>
std::vector<T, A>& operator<<(std::vector<T, A>& l, const T& o) throw(std::bad_exception) {
@ -67,7 +70,7 @@ std::vector<T, A>& operator<<(std::vector<T, A>& l, const T& o) throw(std::bad_e
@note when something is extracted from a vector, it is removed
from the vector, that means after every shift the vector is
shortened by the shifted element
@pre #include <mrw/vector.hpp>
@pre \#include <mrw/vector.hpp>
*/
template <typename T, typename A>
std::vector<T, A>& operator>>(std::vector<T, A>& l, T& o) throw(std::exception) {

Loading…
Cancel
Save