Use uint64_t except where other types are expected.

This commit is contained in:
Steve Checkoway
2004-09-07 12:59:08 +00:00
parent 3dac41c399
commit 7b2ec2cee3
4 changed files with 15 additions and 14 deletions
@@ -18,7 +18,7 @@ uint64_t GetCurrentThreadId()
return mach_thread_self(); return mach_thread_self();
} }
bool GetThreadBacktraceContext(int iCrashHandle, BacktraceContext *ctx) bool GetThreadBacktraceContext(uint64_t iCrashHandle, BacktraceContext *ctx)
{ {
thread_act_t thread = thread_act_t(iCrashHandle); thread_act_t thread = thread_act_t(iCrashHandle);
ppc_thread_state state; ppc_thread_state state;
+1 -1
View File
@@ -29,7 +29,7 @@ void GetBacktrace( const void **buf, size_t size, const BacktraceContext *ctx =
/* Set up a BacktraceContext to get a backtrace for a thread. ThreadID may /* Set up a BacktraceContext to get a backtrace for a thread. ThreadID may
* not be the current thread. True is returned on success, false on failure. */ * not be the current thread. True is returned on success, false on failure. */
bool GetThreadBacktraceContext( int ThreadID, BacktraceContext *ctx ); bool GetThreadBacktraceContext( uint64_t ThreadID, BacktraceContext *ctx );
/* Set up a BacktraceContext to get a backtrace after receiving a signal, given /* Set up a BacktraceContext to get a backtrace after receiving a signal, given
* a ucontext_t (see sigaction(2)). (This interface is UNIX-specific.) */ * a ucontext_t (see sigaction(2)). (This interface is UNIX-specific.) */
@@ -140,20 +140,20 @@ int GetCurrentThreadId()
return getpid(); return getpid();
} }
int SuspendThread( int ThreadID ) int SuspendThread( uint64_t ThreadID )
{ {
/* /*
* Linux: We can't simply kill(SIGSTOP) (or tkill), since that will stop all processes * Linux: We can't simply kill(SIGSTOP) (or tkill), since that will stop all processes
* (grr). We can ptrace(PTRACE_ATTACH) the process to stop it, and PTRACE_DETACH * (grr). We can ptrace(PTRACE_ATTACH) the process to stop it, and PTRACE_DETACH
* to restart it. * to restart it.
*/ */
return PtraceAttach( ThreadID ); return PtraceAttach( int(ThreadID) );
// kill( ThreadID, SIGSTOP ); // kill( ThreadID, SIGSTOP );
} }
int ResumeThread( int ThreadID ) int ResumeThread( uint64_t ThreadID )
{ {
return PtraceDetach( ThreadID ); return PtraceDetach( int(ThreadID) );
// kill( ThreadID, SIGSTOP ); // kill( ThreadID, SIGSTOP );
} }
@@ -167,7 +167,7 @@ int ResumeThread( int ThreadID )
* This call leaves the given thread suspended, so the returned context doesn't become invalid. * This call leaves the given thread suspended, so the returned context doesn't become invalid.
* ResumeThread() can be used to resume a thread after this call. */ * ResumeThread() can be used to resume a thread after this call. */
#if defined(CRASH_HANDLER) #if defined(CRASH_HANDLER)
bool GetThreadBacktraceContext( int ThreadID, BacktraceContext *ctx ) bool GetThreadBacktraceContext( uint64_t ThreadID, BacktraceContext *ctx )
{ {
/* Can't GetThreadBacktraceContext the current thread. */ /* Can't GetThreadBacktraceContext the current thread. */
ASSERT( ThreadID != GetCurrentThreadId() ); ASSERT( ThreadID != GetCurrentThreadId() );
@@ -178,20 +178,21 @@ bool GetThreadBacktraceContext( int ThreadID, BacktraceContext *ctx )
* *
* If it's in a debugger, we won't be able to ptrace(PTRACE_GETREGS). If * If it's in a debugger, we won't be able to ptrace(PTRACE_GETREGS). If
* it's us that attached, we will. */ * it's us that attached, we will. */
if( PtraceAttach( ThreadID ) == -1 ) if( PtraceAttach( int(ThreadID) ) == -1 )
{ {
if( errno != EPERM ) if( errno != EPERM )
{ {
CHECKPOINT_M( ssprintf( "%s (pid %i tid %i locking tid %i)", strerror(errno), getpid(), GetCurrentThreadId(), ThreadID ) ); CHECKPOINT_M( ssprintf( "%s (pid %i tid %i locking tid %i)",
strerror(errno), getpid(), GetCurrentThreadId(), int(ThreadID) ) );
return false; return false;
} }
} }
user_regs_struct regs; user_regs_struct regs;
if( ptrace( PTRACE_GETREGS, ThreadID, NULL, &regs ) == -1 ) if( ptrace( PTRACE_GETREGS, pid_t(ThreadID), NULL, &regs ) == -1 )
return false; return false;
ctx->pid = ThreadID; ctx->pid = pid_t(ThreadID);
#if defined(CPU_X86_64) #if defined(CPU_X86_64)
ctx->eip = (void *) regs.rip; ctx->eip = (void *) regs.rip;
ctx->ebp = (void *) regs.rbp; ctx->ebp = (void *) regs.rbp;
@@ -9,11 +9,11 @@ int GetCurrentThreadId();
/* Return true if NPTL libraries are in use, false if linuxthreads. */ /* Return true if NPTL libraries are in use, false if linuxthreads. */
bool UsingNPTL(); bool UsingNPTL();
int SuspendThread( int ThreadID ); int SuspendThread( uint64_t ThreadID );
int ResumeThread( int ThreadID ); int ResumeThread( uint64_t ThreadID );
struct BacktraceContext; struct BacktraceContext;
int GetThreadContext( int ThreadID, BacktraceContext *ctx ); int GetThreadContext( uint64_t ThreadID, BacktraceContext *ctx );
#endif #endif