tsan: fix mac build

llvm-svn: 165004
This commit is contained in:
Dmitry Vyukov 2012-10-02 12:58:14 +00:00
parent 298e237d7e
commit 56faa551b9
8 changed files with 14 additions and 11 deletions

View File

@ -34,7 +34,7 @@ const uptr kMmapGranularity = 1UL << 16;
// Threads
int GetPid();
int GetTid();
uptr GetTid();
uptr GetThreadSelf();
void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top,
uptr *stack_bottom);

View File

@ -89,6 +89,10 @@ int internal_sched_yield() {
}
// ----------------- sanitizer_common.h
uptr GetTid() {
return syscall(__NR_gettid);
}
void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top,
uptr *stack_bottom) {
static const uptr kMaxThreadStackSize = 256 * (1 << 20); // 256M

View File

@ -80,6 +80,10 @@ int internal_sched_yield() {
}
// ----------------- sanitizer_common.h
uptr GetTid() {
return reinterpret_cast<uptr>(pthread_self());
}
void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top,
uptr *stack_bottom) {
CHECK(stack_top);

View File

@ -27,7 +27,6 @@
#include <sys/resource.h>
#include <sys/time.h>
#include <sys/types.h>
#include <syscall.h>
#include <unistd.h>
namespace __sanitizer {
@ -38,10 +37,6 @@ int GetPid() {
return getpid();
}
int GetTid() {
return syscall(__NR_gettid);
}
uptr GetThreadSelf() {
return (uptr)pthread_self();
}

View File

@ -104,7 +104,7 @@ static void PrintThread(const ReportThread *rt) {
TsanPrintf(" Thread %d", rt->id);
if (rt->name)
TsanPrintf(" '%s'", rt->name);
TsanPrintf(" (tid=%d, %s)", rt->pid, rt->running ? "running" : "finished");
TsanPrintf(" (tid=%zu, %s)", rt->pid, rt->running ? "running" : "finished");
if (rt->stack)
TsanPrintf(" created at:");
TsanPrintf("\n");

View File

@ -67,7 +67,7 @@ struct ReportLocation {
struct ReportThread {
int id;
int pid;
uptr pid;
bool running;
char *name;
ReportStack *stack;

View File

@ -327,7 +327,7 @@ struct ThreadDeadInfo {
struct ThreadContext {
const int tid;
int unique_id; // Non-rolling thread id.
int os_id; // pid
uptr os_id; // pid
uptr user_id; // Some opaque user thread id (e.g. pthread_t).
ThreadState *thr;
ThreadStatus status;
@ -481,7 +481,7 @@ void FuncEntry(ThreadState *thr, uptr pc);
void FuncExit(ThreadState *thr);
int ThreadCreate(ThreadState *thr, uptr pc, uptr uid, bool detached);
void ThreadStart(ThreadState *thr, int tid, int os_id);
void ThreadStart(ThreadState *thr, int tid, uptr os_id);
void ThreadFinish(ThreadState *thr);
int ThreadTid(ThreadState *thr, uptr pc, uptr uid);
void ThreadJoin(ThreadState *thr, uptr pc, int tid);

View File

@ -137,7 +137,7 @@ int ThreadCreate(ThreadState *thr, uptr pc, uptr uid, bool detached) {
return tid;
}
void ThreadStart(ThreadState *thr, int tid, int os_id) {
void ThreadStart(ThreadState *thr, int tid, uptr os_id) {
CHECK_GT(thr->in_rtl, 0);
uptr stk_addr = 0;
uptr stk_size = 0;