[complement-svn] SF.net SVN: complement:[1972] trunk/complement/explore
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2008-10-13 10:35:42
|
Revision: 1972 http://complement.svn.sourceforge.net/complement/?rev=1972&view=rev Author: complement Date: 2008-10-13 10:35:31 +0000 (Mon, 13 Oct 2008) Log Message: ----------- turn on detection of call stack feature callstack require BFD interface and bfd lib; but it very useful for detection of exception origin; system_error.cc contains now only commented calls of callstack---usage should be reviewed. Modified Paths: -------------- trunk/complement/explore/include/config/feature.h trunk/complement/explore/lib/mt/Makefile trunk/complement/explore/lib/mt/callstack.cc trunk/complement/explore/lib/mt/system_error.cc Modified: trunk/complement/explore/include/config/feature.h =================================================================== --- trunk/complement/explore/include/config/feature.h 2008-10-13 10:34:44 UTC (rev 1971) +++ trunk/complement/explore/include/config/feature.h 2008-10-13 10:35:31 UTC (rev 1972) @@ -126,7 +126,7 @@ impossible without BFD (Binary File Descriptor). */ -#define __FIT_DISABLE_BFD +// #define __FIT_DISABLE_BFD #ifdef __FIT_DISABLE_BFD # ifdef __FIT_PRESENT_BFD Modified: trunk/complement/explore/lib/mt/Makefile =================================================================== --- trunk/complement/explore/lib/mt/Makefile 2008-10-13 10:34:44 UTC (rev 1971) +++ trunk/complement/explore/lib/mt/Makefile 2008-10-13 10:35:31 UTC (rev 1972) @@ -9,7 +9,7 @@ HEADERS_BASE = $(SRCROOT)/include/mt $(SRCROOT)/include/config $(SRCROOT)/include/misc # LDLIBS += -ldl -lbfd -LDLIBS += -ldl +LDLIBS += -ldl -lbfd check: all-shared $(MAKE) -C ut all-shared Modified: trunk/complement/explore/lib/mt/callstack.cc =================================================================== --- trunk/complement/explore/lib/mt/callstack.cc 2008-10-13 10:34:44 UTC (rev 1971) +++ trunk/complement/explore/lib/mt/callstack.cc 2008-10-13 10:35:31 UTC (rev 1972) @@ -233,16 +233,16 @@ } #endif - // int res; + int res; // if ( string( "obj/gcc/so_g/mt_ut" ) == dlinfo.dli_fname ) { - if ( /* (res = extract_info( dlinfo.dli_fname, ip, file, line )) != 0 */ false ) { + if ( (res = extract_info( dlinfo.dli_fname, ip, file, line )) != 0 /* false */ ) { file = "??"; line = 0; // s << "*** " << res << " " << dlinfo.dli_fname << endl; } else { - file = "??"; - line = 0; + // file = "??"; + // line = 0; } // } else { // file = "??"; Modified: trunk/complement/explore/lib/mt/system_error.cc =================================================================== --- trunk/complement/explore/lib/mt/system_error.cc 2008-10-13 10:34:44 UTC (rev 1971) +++ trunk/complement/explore/lib/mt/system_error.cc 2008-10-13 10:35:31 UTC (rev 1972) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/10/01 00:22:12 ptr> +// -*- C++ -*- Time-stamp: <08/10/07 01:02:13 ptr> /* * Copyright (c) 2007-2008 @@ -13,6 +13,9 @@ #include "mt/system_error" #include <cerrno> +#include "mt/callstack.h" +#include <sstream> +#include <iostream> #if 0 #ifdef STLPORT @@ -996,30 +999,48 @@ bool operator !=( const error_condition& l, const error_condition& r ) { return !(l == r); } +// char _stack_buf[4096]; + system_error::system_error( error_code code, const string& what ) : runtime_error( what ), ecode_( code.value(), code.category() ), _dbuf( 0 ) -{ } +{ + // stringstream s; + // xmt::callstack( cerr ); + // strcpy( _stack_buf, s.str().c_str() ); +} system_error::system_error( error_code code ) : runtime_error( "" ), ecode_( code.value(), code.category() ), _dbuf( 0 ) -{ } +{ + // stringstream s; + // xmt::callstack( cerr ); + // strcpy( _stack_buf, s.str().c_str() ); +} system_error::system_error( int code, const error_category& category, const string& what ) : runtime_error( what ), ecode_( code, category ), _dbuf( 0 ) -{ } +{ + // stringstream s; + // xmt::callstack( cerr ); + // strcpy( _stack_buf, s.str().c_str() ); +} system_error::system_error( int code, const error_category& category ) : runtime_error( "" ), ecode_( code, category ), _dbuf( 0 ) -{ } +{ + // stringstream s; + // xmt::callstack( cerr ); + // strcpy( _stack_buf, s.str().c_str() ); +} system_error::~system_error() throw() { @@ -1033,6 +1054,8 @@ size_t sz = strlen( runtime_error::what() ); size_t sz_add = sz + ecode_.message().length() + (sz > 0 ? 3 : 1); // + ": ", not \0 + // sz_add += strlen( _stack_buf ); + if ( sz_add < _bufsize ) { if ( sz > 0 ) { memcpy( _buf, runtime_error::what(), sz ); @@ -1040,6 +1063,7 @@ _buf[sz++] = ' '; } memcpy( _buf + sz, ecode_.message().data(), ecode_.message().length() ); + // memcpy( _buf + sz + ecode_.message().length() + (sz > 0 ? 3 : 1), _stack_buf, strlen( _stack_buf ) ); _buf[sz_add - 1] = 0; } else { _dbuf = static_cast<char *>(malloc( sz_add )); @@ -1050,6 +1074,7 @@ _dbuf[sz++] = ' '; } memcpy( _dbuf + sz, ecode_.message().data(), ecode_.message().length() ); + // memcpy( _dbuf + sz + ecode_.message().length() + (sz > 0 ? 3 : 1), _stack_buf, strlen( _stack_buf ) ); _dbuf[sz_add - 1] = 0; return _dbuf; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |