/* -*- mode: C; c-basic-offset: 3; -*- */ /* This file is part of drd, a thread error detector. Copyright (C) 2006-2009 Bart Van Assche . This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. The GNU General Public License is contained in the file COPYING. */ #ifndef __THREAD_H #define __THREAD_H /* Include directives. */ #include "drd_basics.h" #include "drd_segment.h" #include "pub_drd_bitmap.h" #include "pub_tool_libcassert.h" /* tl_assert() */ #include "pub_tool_stacktrace.h" /* typedef StackTrace */ #include "pub_tool_threadstate.h" /* VG_N_THREADS */ /* Defines. */ /** Maximum number of threads DRD keeps information about. */ #define DRD_N_THREADS VG_N_THREADS /** A number different from any valid DRD thread ID. */ #define DRD_INVALID_THREADID 0 /** * A number different from any valid POSIX thread ID. * * @note The PThreadId typedef and the INVALID_POSIX_THREADID depend on the * operating system and threading library in use. PThreadId must contain at * least as many bits as pthread_t, and INVALID_POSIX_THREADID * must be a value that will never be returned by pthread_self(). */ #define INVALID_POSIX_THREADID ((PThreadId)0) /* Type definitions. */ /** * POSIX thread ID. The type PThreadId must be at least as wide as * pthread_t. */ typedef UWord PThreadId; /** Per-thread information managed by DRD. */ typedef struct { Segment* first; /**< Pointer to first segment. */ Segment* last; /**< Pointer to last segment. */ ThreadId vg_threadid; /**< Valgrind thread ID. */ PThreadId pt_threadid; /**< POSIX thread ID. */ Addr stack_min_min; /**< Lowest value stack pointer ever had. */ Addr stack_min; /**< Current stack pointer. */ Addr stack_startup; /**