Allow linking against system libraries for almost everything (#1790)
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#include <mach/mach_init.h>
|
||||
#include <mach/mach_error.h>
|
||||
#include "global.h"
|
||||
#include "Backtrace.hpp"
|
||||
#include "Backtrace.h"
|
||||
|
||||
bool SuspendThread( uint64_t threadHandle )
|
||||
{
|
||||
@@ -25,13 +25,13 @@ bool GetThreadBacktraceContext( uint64_t iID, BacktraceContext *ctx )
|
||||
/* Can't GetThreadBacktraceContext the current thread. */
|
||||
ASSERT( iID != GetCurrentThreadId() );
|
||||
SuspendThread( iID );
|
||||
|
||||
thread_act_t thread = thread_act_t( iID );
|
||||
|
||||
thread_act_t thread = thread_act_t( iID );
|
||||
|
||||
#if defined(__i386__)
|
||||
i386_thread_state_t state;
|
||||
mach_msg_type_number_t count = i386_THREAD_STATE_COUNT;
|
||||
|
||||
|
||||
if( thread_get_state(thread, i386_THREAD_STATE, thread_state_t(&state), &count) )
|
||||
return false;
|
||||
ctx->ip = (void *)state.__eip;
|
||||
@@ -41,12 +41,12 @@ bool GetThreadBacktraceContext( uint64_t iID, BacktraceContext *ctx )
|
||||
#elif defined(__x86_64__)
|
||||
x86_thread_state64_t state;
|
||||
mach_msg_type_number_t count = x86_THREAD_STATE64_COUNT;
|
||||
|
||||
|
||||
if (thread_get_state(thread, x86_THREAD_STATE64, thread_state_t(&state), &count))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
ctx->ip = (void *)state.__rip;
|
||||
ctx->bp = (void *)state.__rbp;
|
||||
ctx->sp = (void *)state.__rsp;
|
||||
@@ -63,16 +63,16 @@ RString SetThreadPrecedence( float prec )
|
||||
thread_precedence_policy po = { integer_t( lrintf(prec * 63) ) };
|
||||
kern_return_t ret = thread_policy_set( mach_thread_self(), THREAD_PRECEDENCE_POLICY,
|
||||
(thread_policy_t)&po, THREAD_PRECEDENCE_POLICY_COUNT );
|
||||
|
||||
|
||||
if( ret != KERN_SUCCESS )
|
||||
return mach_error_string( ret );
|
||||
return RString();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (c) 2004-2006 Steve Checkoway
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -82,7 +82,7 @@ RString SetThreadPrecedence( float prec )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
- (id) initWithArgc:(int)argc argv:(char **)argv
|
||||
{
|
||||
[super init];
|
||||
self = [super init];
|
||||
if( argc == 2 && !strncmp(argv[1], "-psn_", 5) )
|
||||
argc = 1;
|
||||
m_iArgc = argc;
|
||||
|
||||
@@ -17,7 +17,9 @@ extern "C" int sm_main( int argc, char *argv[] );
|
||||
#define NO_GL_FLUSH
|
||||
|
||||
#define CPU_X86
|
||||
#ifndef BACKTRACE_METHOD_X86_DARWIN
|
||||
#define BACKTRACE_METHOD_X86_DARWIN
|
||||
#endif
|
||||
#define BACKTRACE_LOOKUP_METHOD_DLADDR
|
||||
|
||||
#ifndef MACOSX
|
||||
|
||||
Reference in New Issue
Block a user