summaryrefslogtreecommitdiff
path: root/src/mongo/util/stacktrace.cpp
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2012-05-15 15:38:23 -0400
committerEliot Horowitz <eliot@10gen.com>2012-05-16 18:22:19 -0400
commitefa3358d03a197cd8e520a17826bfb9ec469ba24 (patch)
tree8d6888bdfef22e7e741d4ad0c296b33dcb17dcff /src/mongo/util/stacktrace.cpp
parent6ce99c45a6ef986ea3bdf59f7c477f484e256c11 (diff)
downloadmongo-efa3358d03a197cd8e520a17826bfb9ec469ba24.tar.gz
fix ConsCache caching
Diffstat (limited to 'src/mongo/util/stacktrace.cpp')
-rw-r--r--src/mongo/util/stacktrace.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/mongo/util/stacktrace.cpp b/src/mongo/util/stacktrace.cpp
index f1f37d44350..5cb5f91d69d 100644
--- a/src/mongo/util/stacktrace.cpp
+++ b/src/mongo/util/stacktrace.cpp
@@ -75,7 +75,8 @@ namespace mongo {
map<string,bool>::const_iterator it = _map.find( name );
if ( it == _map.end() )
return false;
- return it->second;
+ val = it->second;
+ return true;
}
void set( const string& name , bool val ) {
@@ -96,12 +97,15 @@ namespace mongo {
char** strings = ::backtrace_symbols( b, size );
for ( int i = 0; i < size; i++ ) {
- string x = strings[i];
+ const string x = strings[i];
{
bool temp;
- if ( consCache.inCache( x , temp ) )
- return temp;
+ if ( consCache.inCache( x , temp ) ) {
+ if ( temp )
+ return true;
+ continue;
+ }
}
size_t l = x.find( '(' );
@@ -121,14 +125,17 @@ namespace mongo {
if ( isNameAConstructor( nice ) ) {
if ( printOffending )
- std::cout << "found a constructor in the call tree: " << nice << std::endl;
+ std::cout << "found a constructor in the call tree: " << nice << "\n" << x << std::endl;
::free( strings );
::free( nice );
+ consCache.set( x , true );
return true;
}
::free( nice );
+ consCache.set( x , false );
+
}
::free( strings );