Commit a613c32d authored by gejun's avatar gejun

removed -has_valgrind

Change-Id: I22c7c47e614d214a81306380e43969099281fd5e
parent 2dc60b73
Notice that the following BSD-style license applies to the Valgrind header
files used by Chromium (valgrind.h and memcheck.h). However, the rest of
Valgrind is licensed under the terms of the GNU General Public License,
version 2, unless otherwise indicated.
files used by baidu-rpc (valgrind.h). However, the rest of Valgrind is
licensed under the terms of the GNU General Public License, version 2,
unless otherwise indicated.
----------------------------------------------------------------
......
Name: valgrind
URL: http://valgrind.org
License: BSD
Header files in this directory define runtime macros that determine whether the
current process is running under Valgrind and tell Memcheck tool about custom
memory allocators.
These header files were taken from Valgrind source code
(svn://svn.valgrind.org/valgrind/trunk@11504, dated 21 Jan 2011). The files are
covered under BSD license as described within.
This diff is collapsed.
This diff is collapsed.
......@@ -21,8 +21,6 @@ DEFINE_int32(guard_page_size, 4096, "size of guard page, allocate stacks by mall
DEFINE_int32(tc_stack_small, 32, "maximum small stacks cached by each thread");
DEFINE_int32(tc_stack_normal, 8, "maximum normal stacks cached by each thread");
DEFINE_bool(has_valgrind, false, "Set to true when running inside valgrind");
namespace bthread {
BAIDU_CASSERT(BTHREAD_STACKTYPE_PTHREAD == STACK_TYPE_PTHREAD, must_match);
......
......@@ -12,7 +12,8 @@
#include "bthread/types.h"
#include "bthread/context.h" // bthread_fcontext_t
#include "base/object_pool.h"
#include "bthread/valgrind.h" // VALGRIND_STACK_REGISTER
#include "base/third_party/dynamic_annotations/dynamic_annotations.h" // RunningOnValgrind
#include "base/third_party/valgrind/valgrind.h" // VALGRIND_STACK_REGISTER
namespace bthread {
......
......@@ -10,7 +10,6 @@
DECLARE_int32(guard_page_size);
DECLARE_int32(tc_stack_small);
DECLARE_int32(tc_stack_normal);
DECLARE_bool(has_valgrind);
namespace bthread {
......@@ -45,7 +44,7 @@ template <typename StackClass> struct StackContainerFactory {
// TODO: Growth direction of stack is arch-dependent(not handled by
// fcontext). We temporarily assume stack grows upwards.
// http://www.boost.org/doc/libs/1_55_0/libs/context/doc/html/context/stack.html
if (FLAGS_has_valgrind) {
if (RunningOnValgrind()) {
valgrind_stack_id = VALGRIND_STACK_REGISTER(
stack, (char*)stack - stacksize);
}
......@@ -54,7 +53,7 @@ template <typename StackClass> struct StackContainerFactory {
}
~Wrapper() {
if (stack) {
if (FLAGS_has_valgrind) {
if (RunningOnValgrind()) {
VALGRIND_STACK_DEREGISTER(valgrind_stack_id);
valgrind_stack_id = 0;
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment