summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2015-03-26 10:13:36 -0400
committerAndrew Morrow <acm@mongodb.com>2015-03-27 11:37:29 -0400
commit67cf6c0d51bf59a1933325c793b02c220283f331 (patch)
tree5ff86583c096e26b702c6754c4e41330061cc139 /src/mongo
parent1fc9d37170bcf29068f02cc2898436281fe16d6a (diff)
downloadmongo-67cf6c0d51bf59a1933325c793b02c220283f331.tar.gz
SERVER-11020 Don't overload the meaning of _DEBUG, use our own debug macro
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/SConscript1
-rw-r--r--src/mongo/config.h.in3
-rw-r--r--src/mongo/db/commands/pipeline_command.cpp9
-rw-r--r--src/mongo/db/concurrency/lock_manager.cpp10
-rw-r--r--src/mongo/db/concurrency/lock_manager.h2
-rw-r--r--src/mongo/db/concurrency/lock_manager_defs.h6
-rw-r--r--src/mongo/db/concurrency/lock_state_test.cpp6
-rw-r--r--src/mongo/db/db.cpp2
-rw-r--r--src/mongo/db/sorter/sorter.cpp4
-rw-r--r--src/mongo/db/sorter/sorter_test.cpp4
-rw-r--r--src/mongo/db/storage/mmap_v1/dur.h6
-rw-r--r--src/mongo/db/storage/mmap_v1/dur_journal.cpp13
-rw-r--r--src/mongo/dbtests/framework_options.cpp2
-rw-r--r--src/mongo/dbtests/perftests.cpp6
-rw-r--r--src/mongo/dbtests/threadedtests.cpp6
-rw-r--r--src/mongo/s/chunk.cpp4
-rw-r--r--src/mongo/s/version_mongos.cpp4
-rw-r--r--src/mongo/util/assert_util.cpp6
-rw-r--r--src/mongo/util/concurrency/mutex.h2
-rw-r--r--src/mongo/util/concurrency/rwlockimpl.cpp6
-rw-r--r--src/mongo/util/concurrency/simplerwlock.h4
-rw-r--r--src/mongo/util/concurrency/thread_name.cpp37
-rw-r--r--src/mongo/util/debug_util.h2
-rw-r--r--src/mongo/util/debugger.h2
-rw-r--r--src/mongo/util/exception_filter_win32.cpp4
25 files changed, 72 insertions, 79 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index f7bb1d71384..485932242ac 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -369,6 +369,7 @@ env.NoCache(buildInfo)
config_header_substs = (
('@mongo_config_byte_order@', 'MONGO_CONFIG_BYTE_ORDER'),
+ ('@mongo_config_debug_build@', 'MONGO_CONFIG_DEBUG_BUILD'),
('@mongo_config_have___declspec_thread@', 'MONGO_CONFIG_HAVE___DECLSPEC_THREAD'),
('@mongo_config_have___thread@', 'MONGO_CONFIG_HAVE___THREAD'),
('@mongo_config_have_execinfo_backtrace@', 'MONGO_CONFIG_HAVE_EXECINFO_BACKTRACE'),
diff --git a/src/mongo/config.h.in b/src/mongo/config.h.in
index cac96ae4b25..9885212aed6 100644
--- a/src/mongo/config.h.in
+++ b/src/mongo/config.h.in
@@ -31,6 +31,9 @@
// Define to target byte order (1234 vs 4321)
@mongo_config_byte_order@
+// Define if building a debug build
+@mongo_config_debug_build@
+
// Defined if __declspec(thread) is available
@mongo_config_have___declspec_thread@
diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp
index 192924bceb7..d3d9e1e288c 100644
--- a/src/mongo/db/commands/pipeline_command.cpp
+++ b/src/mongo/db/commands/pipeline_command.cpp
@@ -199,11 +199,10 @@ namespace mongo {
// This is outside of the if block to keep the object alive until the pipeline is finished.
BSONObj parsed;
if (kDebugBuild && !pPipeline->isExplain() && !pCtx->inShard) {
- // Make sure all operations round-trip through Pipeline::toBson()
- // correctly by reparsing every command on DEBUG builds. This is
- // important because sharded aggregations rely on this ability.
- // Skipping when inShard because this has already been through the
- // transformation (and this unsets pCtx->inShard).
+ // Make sure all operations round-trip through Pipeline::toBson() correctly by
+ // reparsing every command in debug builds. This is important because sharded
+ // aggregations rely on this ability. Skipping when inShard because this has
+ // already been through the transformation (and this unsets pCtx->inShard).
parsed = pPipeline->serialize().toBson();
pPipeline = Pipeline::parseCommand(errmsg, parsed, pCtx);
verify(pPipeline);
diff --git a/src/mongo/db/concurrency/lock_manager.cpp b/src/mongo/db/concurrency/lock_manager.cpp
index 30468418643..506d057b9fd 100644
--- a/src/mongo/db/concurrency/lock_manager.cpp
+++ b/src/mongo/db/concurrency/lock_manager.cpp
@@ -28,10 +28,12 @@
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault
-#include <vector>
+#include "mongo/config.h"
#include "mongo/platform/basic.h"
+#include <vector>
+
#include "mongo/db/concurrency/lock_manager.h"
#include "mongo/db/concurrency/locker.h"
@@ -1075,14 +1077,14 @@ namespace {
ResourceId::ResourceId(ResourceType type, StringData ns)
: _fullHash(fullHash(type, stringDataHashFunction(ns))) {
-#ifdef _DEBUG
+#ifdef MONGO_CONFIG_DEBUG_BUILD
_nsCopy = ns.toString();
#endif
}
ResourceId::ResourceId(ResourceType type, const string& ns)
: _fullHash(fullHash(type, stringDataHashFunction(ns))) {
-#ifdef _DEBUG
+#ifdef MONGO_CONFIG_DEBUG_BUILD
_nsCopy = ns;
#endif
}
@@ -1095,7 +1097,7 @@ namespace {
ss << "{" << _fullHash << ": " << resourceTypeName(getType())
<< ", " << getHashId();
-#ifdef _DEBUG
+#ifdef MONGO_CONFIG_DEBUG_BUILD
ss << ", " << _nsCopy;
#endif
diff --git a/src/mongo/db/concurrency/lock_manager.h b/src/mongo/db/concurrency/lock_manager.h
index 8a21b438eea..fbc45652ec1 100644
--- a/src/mongo/db/concurrency/lock_manager.h
+++ b/src/mongo/db/concurrency/lock_manager.h
@@ -28,6 +28,8 @@
#pragma once
+#include "mongo/config.h"
+
#include <boost/thread/condition_variable.hpp>
#include <boost/thread/mutex.hpp>
diff --git a/src/mongo/db/concurrency/lock_manager_defs.h b/src/mongo/db/concurrency/lock_manager_defs.h
index ca11a8931e7..6ad64e3ab07 100644
--- a/src/mongo/db/concurrency/lock_manager_defs.h
+++ b/src/mongo/db/concurrency/lock_manager_defs.h
@@ -28,6 +28,8 @@
#pragma once
+#include "mongo/config.h"
+
#include <boost/static_assert.hpp>
#include <string>
#include <limits>
@@ -202,14 +204,14 @@ namespace mongo {
static uint64_t fullHash(ResourceType type, uint64_t hashId);
-#ifdef _DEBUG
+#ifdef MONGO_CONFIG_DEBUG_BUILD
// Keep the complete namespace name for debugging purposes (TODO: this will be
// removed once we are confident in the robustness of the lock manager).
std::string _nsCopy;
#endif
};
-#ifndef _DEBUG
+#ifndef MONGO_CONFIG_DEBUG_BUILD
// Treat the resource ids as 64-bit integers in release mode in order to ensure we do
// not spend too much time doing comparisons for hashing.
BOOST_STATIC_ASSERT(sizeof(ResourceId) == sizeof(uint64_t));
diff --git a/src/mongo/db/concurrency/lock_state_test.cpp b/src/mongo/db/concurrency/lock_state_test.cpp
index 7c4be4609fa..cfdbbbd4590 100644
--- a/src/mongo/db/concurrency/lock_state_test.cpp
+++ b/src/mongo/db/concurrency/lock_state_test.cpp
@@ -28,6 +28,8 @@
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault
+#include "mongo/config.h"
+
#include "mongo/platform/basic.h"
#include <boost/shared_ptr.hpp>
@@ -256,7 +258,7 @@ namespace {
// These two tests exercise single-threaded performance of uncontended lock acquisition. It
// is not practical to run them on debug builds.
-#ifndef _DEBUG
+#ifndef MONGO_CONFIG_DEBUG_BUILD
TEST(Locker, PerformanceBoostSharedMutex) {
for (int numLockers = 1; numLockers <= 64; numLockers = numLockers * 2) {
@@ -314,6 +316,6 @@ namespace {
}
}
-#endif // _DEBUG
+#endif // MONGO_CONFIG_DEBUG_BUILD
} // namespace mongo
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index f7742c00ab1..37d5839db93 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -508,7 +508,7 @@ namespace mongo {
l << ( is32bit ? " 32" : " 64" ) << "-bit host=" << getHostNameCached() << endl;
}
- DEV log(LogComponent::kControl) << "_DEBUG build (which is slower)" << endl;
+ DEV log(LogComponent::kControl) << "DEBUG build (which is slower)" << endl;
logMongodStartupWarnings(storageGlobalParams);
#if defined(_WIN32)
diff --git a/src/mongo/db/sorter/sorter.cpp b/src/mongo/db/sorter/sorter.cpp
index 8cb5048c2fc..f4c3301a1ae 100644
--- a/src/mongo/db/sorter/sorter.cpp
+++ b/src/mongo/db/sorter/sorter.cpp
@@ -45,6 +45,8 @@
* Do this once for each unique set of parameters to MONGO_CREATE_SORTER.
*/
+#include "mongo/config.h"
+
#include "mongo/db/sorter/sorter.h"
#include <boost/filesystem/operations.hpp>
@@ -90,7 +92,7 @@ namespace mongo {
template<typename Data, typename Comparator>
void dassertCompIsSane(const Comparator& comp, const Data& lhs, const Data& rhs) {
-#if defined(_DEBUG) && !defined(_MSC_VER)
+#if defined(MONGO_CONFIG_DEBUG_BUILD) && !defined(_MSC_VER)
// MSVC++ already does similar verification in debug mode in addition to using
// algorithms that do more comparisons. Doing our own verification in addition makes
// debug builds considerably slower without any additional safety.
diff --git a/src/mongo/db/sorter/sorter_test.cpp b/src/mongo/db/sorter/sorter_test.cpp
index fdab37d69b8..8deba56ac0e 100644
--- a/src/mongo/db/sorter/sorter_test.cpp
+++ b/src/mongo/db/sorter/sorter_test.cpp
@@ -26,6 +26,8 @@
* then also delete it in the license file.
*/
+#include "mongo/config.h"
+
#include "mongo/platform/basic.h"
#include "mongo/db/sorter/sorter.h"
@@ -341,7 +343,7 @@ namespace mongo {
// The debug builds are too slow to run these tests.
// Among other things, MSVC++ makes all heap functions O(N) not O(logN).
-#if !defined(_DEBUG)
+#if !defined(MONGO_CONFIG_DEBUG_BUILD)
{ // merge all data ASC
boost::shared_ptr<IWSorter> sorters[] = {
makeSorter(opts, IWComparator(ASC)),
diff --git a/src/mongo/db/storage/mmap_v1/dur.h b/src/mongo/db/storage/mmap_v1/dur.h
index e43444b3e91..6863686c08f 100644
--- a/src/mongo/db/storage/mmap_v1/dur.h
+++ b/src/mongo/db/storage/mmap_v1/dur.h
@@ -58,9 +58,9 @@ namespace dur {
// Declare write intents. Use these methods to declare "i'm about to write to x and it
// should be logged for redo."
//
- // Failure to call writing...() is checked in _DEBUG mode by using a read only mapped view
- // (i.e., you'll segfault if the code is covered in that situation). The _DEBUG check
- // doesn't verify that your length is correct though.
+ // Failure to call writing...() is checked in MONGO_CONFIG_DEBUG_BUILD mode by using a
+ // read only mapped view (i.e., you'll segfault if the code is covered in that
+ // situation). The debug check doesn't verify that your length is correct though.
/**
* Declare intent to write to x for up to len.
diff --git a/src/mongo/db/storage/mmap_v1/dur_journal.cpp b/src/mongo/db/storage/mmap_v1/dur_journal.cpp
index 5d7ba47c094..894fa1707c1 100644
--- a/src/mongo/db/storage/mmap_v1/dur_journal.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur_journal.cpp
@@ -30,6 +30,8 @@
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kJournal
+#include "mongo/config.h"
+
#include "mongo/platform/basic.h"
#include "mongo/db/storage/mmap_v1/dur_journal.h"
@@ -78,7 +80,7 @@ namespace mongo {
// work. (and should as-is)
// --smallfiles makes the limit small.
-#if defined(_DEBUG)
+#if defined(MONGO_CONFIG_DEBUG_BUILD)
unsigned long long DataLimitPerJournalFile = 128 * 1024 * 1024;
#elif defined(__APPLE__)
// assuming a developer box if OS X
@@ -393,10 +395,11 @@ namespace mongo {
unsigned long long limit = DataLimitPerJournalFile;
if( kDebugBuild && i == 1 ) {
- // moving 32->64, the prealloc files would be short. that is "ok", but we want to exercise that
- // case, so we force exercising here when _DEBUG is set by arbitrarily stopping prealloc at a low
- // limit for a file. also we want to be able to change in the future the constant without a lot of
- // work anyway.
+ // moving 32->64, the prealloc files would be short. that is "ok", but we
+ // want to exercise that case, so we force exercising here when
+ // MONGO_CONFIG_DEBUG_BUILD is set by arbitrarily stopping prealloc at a
+ // low limit for a file. also we want to be able to change in the future
+ // the constant without a lot of work anyway.
limit = 16 * 1024 * 1024;
}
preallocateFile(filepath, limit);
diff --git a/src/mongo/dbtests/framework_options.cpp b/src/mongo/dbtests/framework_options.cpp
index a4842012c15..cf0c553d8b7 100644
--- a/src/mongo/dbtests/framework_options.cpp
+++ b/src/mongo/dbtests/framework_options.cpp
@@ -203,7 +203,7 @@ namespace mongo {
storageGlobalParams.dur = true;
}
- DEV log() << "_DEBUG build" << endl;
+ DEV log() << "DEBUG build" << endl;
if( sizeof(void*)==4 )
log() << "32bit" << endl;
log() << "random seed: " << frameworkGlobalParams.seed << endl;
diff --git a/src/mongo/dbtests/perftests.cpp b/src/mongo/dbtests/perftests.cpp
index e7d05a93bfb..9fac2024ca7 100644
--- a/src/mongo/dbtests/perftests.cpp
+++ b/src/mongo/dbtests/perftests.cpp
@@ -126,7 +126,7 @@ namespace PerfTests {
static boost::shared_ptr<DBClientConnection> conn;
static string _perfhostname;
void pstatsConnect() {
- // no writing to perf db if _DEBUG
+ // no writing to perf db if this is a debug build
DEV return;
const char *fn = "../../settings.py";
@@ -314,7 +314,7 @@ namespace PerfTests {
int howLong() {
int hlm = howLongMillis();
DEV {
- // don't run very long with _DEBUG - not very meaningful anyway on that build
+ // don't run very long with in debug mode - not very meaningful anyway on that build
hlm = min(hlm, 500);
}
return hlm;
@@ -1117,7 +1117,7 @@ namespace PerfTests {
c->findOne(ns(), q);
}
void post() {
-#if !defined(_DEBUG)
+#if !defined(MONGO_CONFIG_DEBUG_BUILD)
verify( client()->count(ns()) > 50 );
#endif
}
diff --git a/src/mongo/dbtests/threadedtests.cpp b/src/mongo/dbtests/threadedtests.cpp
index 8085be0534e..74044046855 100644
--- a/src/mongo/dbtests/threadedtests.cpp
+++ b/src/mongo/dbtests/threadedtests.cpp
@@ -31,6 +31,8 @@
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kCommand
+#include "mongo/config.h"
+
#include "mongo/platform/basic.h"
#include <boost/thread.hpp>
@@ -94,7 +96,7 @@ namespace ThreadedTests {
const int nthr=135;
#endif
class MongoMutexTest : public ThreadedTest<nthr> {
-#if defined(_DEBUG)
+#if defined(MONGO_CONFIG_DEBUG_BUILD)
enum { N = 2000 };
#else
enum { N = 4000/*0*/ };
@@ -531,7 +533,7 @@ namespace ThreadedTests {
if( t.millis() > 20 ) {
#endif
DEV {
- // a _DEBUG buildbot might be slow, try to avoid false positives
+ // a debug buildbot might be slow, try to avoid false positives
mongo::unittest::log() <<
"warning lock upgrade was slow " << t.millis() << endl;
}
diff --git a/src/mongo/s/chunk.cpp b/src/mongo/s/chunk.cpp
index ea3989a8508..a8e62442bf1 100644
--- a/src/mongo/s/chunk.cpp
+++ b/src/mongo/s/chunk.cpp
@@ -30,6 +30,8 @@
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kSharding
+#include "mongo/config.h"
+
#include "mongo/platform/basic.h"
#include "mongo/s/chunk.h"
@@ -603,7 +605,7 @@ namespace {
<< " shard: " << toString()
<< " into " << (splitCount + 1)
<< " (splitThreshold " << splitThreshold << ")"
-#ifdef _DEBUG
+#ifdef MONGO_CONFIG_DEBUG_BUILD
<< " size: " << getPhysicalSize() // slow - but can be useful when debugging
#endif
<< ( res["shouldMigrate"].eoo() ? "" : (string)" (migrate suggested" +
diff --git a/src/mongo/s/version_mongos.cpp b/src/mongo/s/version_mongos.cpp
index e724bf23d07..1515a5aef86 100644
--- a/src/mongo/s/version_mongos.cpp
+++ b/src/mongo/s/version_mongos.cpp
@@ -49,7 +49,7 @@ namespace mongo {
ProcessId::getCurrent() << " port=" << serverGlobalParams.port <<
( sizeof(int*) == 4 ? " 32" : " 64" ) << "-bit host=" << getHostNameCached() <<
" (--help for usage)" << std::endl;
- DEV std::cout << "_DEBUG build" << std::endl;
+ DEV std::cout << "DEBUG build" << std::endl;
std::cout << "git version: " << gitVersion() << std::endl;
std::cout << openSSLVersion("OpenSSL version: ") << std::endl;
std::cout << "build sys info: " << sysInfo() << std::endl;
@@ -59,7 +59,7 @@ namespace mongo {
ProcessId::getCurrent() << " port=" << serverGlobalParams.port <<
( sizeof( int* ) == 4 ? " 32" : " 64" ) << "-bit host=" << getHostNameCached() <<
" (--help for usage)" << std::endl;
- DEV log() << "_DEBUG build" << std::endl;
+ DEV log() << "DEBUG build" << std::endl;
logProcessDetails();
}
}
diff --git a/src/mongo/util/assert_util.cpp b/src/mongo/util/assert_util.cpp
index ce513d4138c..71b5641549f 100644
--- a/src/mongo/util/assert_util.cpp
+++ b/src/mongo/util/assert_util.cpp
@@ -29,6 +29,8 @@
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault
+#include "mongo/config.h"
+
#include "mongo/platform/basic.h"
#include "mongo/util/assert_util.h"
@@ -118,7 +120,7 @@ namespace mongo {
log() << "warning assertion failure " << expr << ' ' << file << ' ' << dec << line << endl;
logContext();
assertionCount.condrollover( ++assertionCount.warning );
-#if defined(_DEBUG) || defined(_DURABLEDEFAULTON) || defined(_DURABLEDEFAULTOFF)
+#if defined(MONGO_CONFIG_DEBUG_BUILD) || defined(_DURABLEDEFAULTON) || defined(_DURABLEDEFAULTOFF)
// this is so we notice in buildbot
log() << "\n\n***aborting after wassert() failure in a debug/test build\n\n" << endl;
quickExit(EXIT_ABRUPT);
@@ -133,7 +135,7 @@ namespace mongo {
temp << "assertion " << file << ":" << line;
AssertionException e(temp.str(),0);
breakpoint();
-#if defined(_DEBUG) || defined(_DURABLEDEFAULTON) || defined(_DURABLEDEFAULTOFF)
+#if defined(MONGO_CONFIG_DEBUG_BUILD) || defined(_DURABLEDEFAULTON) || defined(_DURABLEDEFAULTOFF)
// this is so we notice in buildbot
log() << "\n\n***aborting after verify() failure as this is a debug/test build\n\n" << endl;
quickExit(EXIT_ABRUPT);
diff --git a/src/mongo/util/concurrency/mutex.h b/src/mongo/util/concurrency/mutex.h
index 835db801f37..890c6a570a6 100644
--- a/src/mongo/util/concurrency/mutex.h
+++ b/src/mongo/util/concurrency/mutex.h
@@ -126,7 +126,7 @@ namespace mongo {
};
#endif
- /** This can be used instead of boost recursive mutex. The advantage is the _DEBUG checks
+ /** This can be used instead of boost recursive mutex. The advantage is the debug checks
* and ability to assertLocked(). This has not yet been tested for speed vs. the boost one.
*/
class RecursiveMutex : boost::noncopyable {
diff --git a/src/mongo/util/concurrency/rwlockimpl.cpp b/src/mongo/util/concurrency/rwlockimpl.cpp
index ea5eacebb28..c184f03a6dc 100644
--- a/src/mongo/util/concurrency/rwlockimpl.cpp
+++ b/src/mongo/util/concurrency/rwlockimpl.cpp
@@ -29,6 +29,8 @@
*/
+#include "mongo/config.h"
+
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
@@ -55,8 +57,8 @@ namespace mongo {
SimpleRWLock::SimpleRWLock(StringData p) : name(p.toString()) {
InitializeSRWLock(&_lock);
}
-# if defined(_DEBUG)
- // the code below in _DEBUG build will check that we don't try to recursively lock,
+# if defined(MONGO_CONFIG_DEBUG_BUILD)
+ // the code below in a debug build will check that we don't try to recursively lock,
// which is not supported by this class. also checks that you don't unlock without
// having locked
void SimpleRWLock::lock() {
diff --git a/src/mongo/util/concurrency/simplerwlock.h b/src/mongo/util/concurrency/simplerwlock.h
index 9803a97e4e0..e37450ca7f6 100644
--- a/src/mongo/util/concurrency/simplerwlock.h
+++ b/src/mongo/util/concurrency/simplerwlock.h
@@ -28,6 +28,8 @@
#pragma once
+#include "mongo/config.h"
+
#include <boost/noncopyable.hpp>
#include "mongo/base/string_data.h"
@@ -44,7 +46,7 @@ namespace mongo {
#else
RWLockBase m;
#endif
-#if defined(_WIN32) && defined(_DEBUG)
+#if defined(_WIN32) && defined(MONGO_CONFIG_DEBUG_BUILD)
AtomicUInt32 shares;
ThreadLocalValue<int> s;
unsigned tid;
diff --git a/src/mongo/util/concurrency/thread_name.cpp b/src/mongo/util/concurrency/thread_name.cpp
index 1d9fe2ff201..ee26720f871 100644
--- a/src/mongo/util/concurrency/thread_name.cpp
+++ b/src/mongo/util/concurrency/thread_name.cpp
@@ -27,7 +27,6 @@
#include "mongo/platform/basic.h"
-#include "mongo/platform/compiler.h"
#include "mongo/util/concurrency/thread_name.h"
#include <boost/thread/tss.hpp>
@@ -38,46 +37,10 @@ namespace mongo {
namespace {
boost::thread_specific_ptr<std::string> _threadName;
-
-#if defined(_WIN32)
-
-#define MS_VC_EXCEPTION 0x406D1388
-#pragma pack(push,8)
- typedef struct tagTHREADNAME_INFO {
- DWORD dwType; // Must be 0x1000.
- LPCSTR szName; // Pointer to name (in user addr space).
- DWORD dwThreadID; // Thread ID (-1=caller thread).
- DWORD dwFlags; // Reserved for future use, must be zero.
- } THREADNAME_INFO;
-#pragma pack(pop)
-
- void setWinThreadName(const char *name) {
- /* is the sleep here necessary???
- Sleep(10);
- */
- THREADNAME_INFO info;
- info.dwType = 0x1000;
- info.szName = name;
- info.dwThreadID = -1;
- info.dwFlags = 0;
- __try {
- RaiseException( MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(ULONG_PTR), (ULONG_PTR*)&info );
- }
- __except(EXCEPTION_EXECUTE_HANDLER) {
- }
- }
-#endif
-
} // namespace
void setThreadName(StringData name) {
_threadName.reset(new string(name.rawData(), name.size()));
-
-#if defined( DEBUG ) && defined( _WIN32 )
- // naming might be expensive so don't do "conn*" over and over
- setWinThreadName(_threadName.get()->c_str());
-#endif
-
}
const std::string& getThreadName() {
diff --git a/src/mongo/util/debug_util.h b/src/mongo/util/debug_util.h
index 14ea0a1d98b..5a31385ba42 100644
--- a/src/mongo/util/debug_util.h
+++ b/src/mongo/util/debug_util.h
@@ -32,7 +32,7 @@
namespace mongo {
-#if defined(_DEBUG)
+#if defined(MONGO_CONFIG_DEBUG_BUILD)
const bool kDebugBuild = true;
#else
const bool kDebugBuild = false;
diff --git a/src/mongo/util/debugger.h b/src/mongo/util/debugger.h
index 2e91af92fbb..53adfe838c4 100644
--- a/src/mongo/util/debugger.h
+++ b/src/mongo/util/debugger.h
@@ -31,7 +31,7 @@
namespace mongo {
// Sets SIGTRAP handler to launch GDB
- // Noop unless on *NIX and compiled with _DEBUG
+ // Noop unless on *NIX and compiled with MONGO_CONFIG_DEBUG_BUILD
void setupSIGTRAPforGDB();
void breakpoint();
diff --git a/src/mongo/util/exception_filter_win32.cpp b/src/mongo/util/exception_filter_win32.cpp
index e13b2dd6c0f..a53c8fa739f 100644
--- a/src/mongo/util/exception_filter_win32.cpp
+++ b/src/mongo/util/exception_filter_win32.cpp
@@ -30,6 +30,8 @@
#ifdef _WIN32
+#include "mongo/config.h"
+
#include <ostream>
#include "mongo/platform/basic.h"
@@ -97,7 +99,7 @@ namespace mongo {
aMiniDumpInfo.ClientPointers = FALSE;
MINIDUMP_TYPE miniDumpType =
- #ifdef _DEBUG
+ #ifdef MONGO_CONFIG_DEBUG_BUILD
MiniDumpWithFullMemory;
#else
static_cast<MINIDUMP_TYPE>(