Fixed some compilation issues on Mac OS X Leopard.
This commit is contained in:
parent
a2808903b1
commit
0d16a7bbe4
|
@ -243,6 +243,27 @@ typedef struct ucontext SIGCONTEXT;
|
||||||
|
|
||||||
typedef ucontext_t SIGCONTEXT;
|
typedef ucontext_t SIGCONTEXT;
|
||||||
|
|
||||||
|
/* work around silly renaming of struct members in OS X 10.5 */
|
||||||
|
#if __DARWIN_UNIX03 && defined(_STRUCT_X86_EXCEPTION_STATE32)
|
||||||
|
#define EAX_sig(context) ((context)->uc_mcontext->__ss.__eax)
|
||||||
|
#define EBX_sig(context) ((context)->uc_mcontext->__ss.__ebx)
|
||||||
|
#define ECX_sig(context) ((context)->uc_mcontext->__ss.__ecx)
|
||||||
|
#define EDX_sig(context) ((context)->uc_mcontext->__ss.__edx)
|
||||||
|
#define ESI_sig(context) ((context)->uc_mcontext->__ss.__esi)
|
||||||
|
#define EDI_sig(context) ((context)->uc_mcontext->__ss.__edi)
|
||||||
|
#define EBP_sig(context) ((context)->uc_mcontext->__ss.__ebp)
|
||||||
|
#define CS_sig(context) ((context)->uc_mcontext->__ss.__cs)
|
||||||
|
#define DS_sig(context) ((context)->uc_mcontext->__ss.__ds)
|
||||||
|
#define ES_sig(context) ((context)->uc_mcontext->__ss.__es)
|
||||||
|
#define FS_sig(context) ((context)->uc_mcontext->__ss.__fs)
|
||||||
|
#define GS_sig(context) ((context)->uc_mcontext->__ss.__gs)
|
||||||
|
#define SS_sig(context) ((context)->uc_mcontext->__ss.__ss)
|
||||||
|
#define EFL_sig(context) ((context)->uc_mcontext->__ss.__eflags)
|
||||||
|
#define EIP_sig(context) (*((unsigned long*)&(context)->uc_mcontext->__ss.__eip))
|
||||||
|
#define ESP_sig(context) (*((unsigned long*)&(context)->uc_mcontext->__ss.__esp))
|
||||||
|
#define TRAP_sig(context) ((context)->uc_mcontext->__es.__trapno)
|
||||||
|
#define ERROR_sig(context) ((context)->uc_mcontext->__es.__err)
|
||||||
|
#else
|
||||||
#define EAX_sig(context) ((context)->uc_mcontext->ss.eax)
|
#define EAX_sig(context) ((context)->uc_mcontext->ss.eax)
|
||||||
#define EBX_sig(context) ((context)->uc_mcontext->ss.ebx)
|
#define EBX_sig(context) ((context)->uc_mcontext->ss.ebx)
|
||||||
#define ECX_sig(context) ((context)->uc_mcontext->ss.ecx)
|
#define ECX_sig(context) ((context)->uc_mcontext->ss.ecx)
|
||||||
|
@ -250,21 +271,18 @@ typedef ucontext_t SIGCONTEXT;
|
||||||
#define ESI_sig(context) ((context)->uc_mcontext->ss.esi)
|
#define ESI_sig(context) ((context)->uc_mcontext->ss.esi)
|
||||||
#define EDI_sig(context) ((context)->uc_mcontext->ss.edi)
|
#define EDI_sig(context) ((context)->uc_mcontext->ss.edi)
|
||||||
#define EBP_sig(context) ((context)->uc_mcontext->ss.ebp)
|
#define EBP_sig(context) ((context)->uc_mcontext->ss.ebp)
|
||||||
|
|
||||||
#define CS_sig(context) ((context)->uc_mcontext->ss.cs)
|
#define CS_sig(context) ((context)->uc_mcontext->ss.cs)
|
||||||
#define DS_sig(context) ((context)->uc_mcontext->ss.ds)
|
#define DS_sig(context) ((context)->uc_mcontext->ss.ds)
|
||||||
#define ES_sig(context) ((context)->uc_mcontext->ss.es)
|
#define ES_sig(context) ((context)->uc_mcontext->ss.es)
|
||||||
#define FS_sig(context) ((context)->uc_mcontext->ss.fs)
|
#define FS_sig(context) ((context)->uc_mcontext->ss.fs)
|
||||||
#define GS_sig(context) ((context)->uc_mcontext->ss.gs)
|
#define GS_sig(context) ((context)->uc_mcontext->ss.gs)
|
||||||
#define SS_sig(context) ((context)->uc_mcontext->ss.ss)
|
#define SS_sig(context) ((context)->uc_mcontext->ss.ss)
|
||||||
|
|
||||||
#define EFL_sig(context) ((context)->uc_mcontext->ss.eflags)
|
#define EFL_sig(context) ((context)->uc_mcontext->ss.eflags)
|
||||||
|
|
||||||
#define EIP_sig(context) (*((unsigned long*)&(context)->uc_mcontext->ss.eip))
|
#define EIP_sig(context) (*((unsigned long*)&(context)->uc_mcontext->ss.eip))
|
||||||
#define ESP_sig(context) (*((unsigned long*)&(context)->uc_mcontext->ss.esp))
|
#define ESP_sig(context) (*((unsigned long*)&(context)->uc_mcontext->ss.esp))
|
||||||
|
|
||||||
#define TRAP_sig(context) ((context)->uc_mcontext->es.trapno)
|
#define TRAP_sig(context) ((context)->uc_mcontext->es.trapno)
|
||||||
#define ERROR_sig(context) ((context)->uc_mcontext->es.err)
|
#define ERROR_sig(context) ((context)->uc_mcontext->es.err)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __APPLE__ */
|
#endif /* __APPLE__ */
|
||||||
|
|
||||||
|
@ -1335,7 +1353,7 @@ BOOL SIGNAL_Init(void)
|
||||||
struct sigaction sig_act;
|
struct sigaction sig_act;
|
||||||
|
|
||||||
#ifdef HAVE_SIGALTSTACK
|
#ifdef HAVE_SIGALTSTACK
|
||||||
struct sigaltstack ss;
|
stack_t ss;
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
int mib[2], val = 1;
|
int mib[2], val = 1;
|
||||||
|
|
|
@ -162,7 +162,8 @@ void finish_process_tracing( struct process *process )
|
||||||
/* retrieve the thread x86 registers */
|
/* retrieve the thread x86 registers */
|
||||||
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
|
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
|
||||||
{
|
{
|
||||||
struct x86_debug_state32 state;
|
#ifdef __i386__
|
||||||
|
x86_debug_state32_t state;
|
||||||
mach_msg_type_number_t count = sizeof(state) / sizeof(int);
|
mach_msg_type_number_t count = sizeof(state) / sizeof(int);
|
||||||
mach_msg_type_name_t type;
|
mach_msg_type_name_t type;
|
||||||
mach_port_t port, process_port = get_process_port( thread->process );
|
mach_port_t port, process_port = get_process_port( thread->process );
|
||||||
|
@ -180,21 +181,33 @@ void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int f
|
||||||
|
|
||||||
if (!thread_get_state( port, x86_DEBUG_STATE32, (thread_state_t)&state, &count ))
|
if (!thread_get_state( port, x86_DEBUG_STATE32, (thread_state_t)&state, &count ))
|
||||||
{
|
{
|
||||||
|
/* work around silly renaming of struct members in OS X 10.5 */
|
||||||
|
#if __DARWIN_UNIX03 && defined(_STRUCT_X86_DEBUG_STATE32)
|
||||||
|
context->Dr0 = state.__dr0;
|
||||||
|
context->Dr1 = state.__dr1;
|
||||||
|
context->Dr2 = state.__dr2;
|
||||||
|
context->Dr3 = state.__dr3;
|
||||||
|
context->Dr6 = state.__dr6;
|
||||||
|
context->Dr7 = state.__dr7;
|
||||||
|
#else
|
||||||
context->Dr0 = state.dr0;
|
context->Dr0 = state.dr0;
|
||||||
context->Dr1 = state.dr1;
|
context->Dr1 = state.dr1;
|
||||||
context->Dr2 = state.dr2;
|
context->Dr2 = state.dr2;
|
||||||
context->Dr3 = state.dr3;
|
context->Dr3 = state.dr3;
|
||||||
context->Dr6 = state.dr6;
|
context->Dr6 = state.dr6;
|
||||||
context->Dr7 = state.dr7;
|
context->Dr7 = state.dr7;
|
||||||
|
#endif
|
||||||
context->ContextFlags |= CONTEXT_DEBUG_REGISTERS;
|
context->ContextFlags |= CONTEXT_DEBUG_REGISTERS;
|
||||||
}
|
}
|
||||||
mach_port_deallocate( mach_task_self(), port );
|
mach_port_deallocate( mach_task_self(), port );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set the thread x86 registers */
|
/* set the thread x86 registers */
|
||||||
void set_thread_context( struct thread *thread, const CONTEXT *context, unsigned int flags )
|
void set_thread_context( struct thread *thread, const CONTEXT *context, unsigned int flags )
|
||||||
{
|
{
|
||||||
struct x86_debug_state32 state;
|
#ifdef __i386__
|
||||||
|
x86_debug_state32_t state;
|
||||||
mach_msg_type_number_t count = sizeof(state) / sizeof(int);
|
mach_msg_type_number_t count = sizeof(state) / sizeof(int);
|
||||||
mach_msg_type_name_t type;
|
mach_msg_type_name_t type;
|
||||||
mach_port_t port, process_port = get_process_port( thread->process );
|
mach_port_t port, process_port = get_process_port( thread->process );
|
||||||
|
@ -210,6 +223,16 @@ void set_thread_context( struct thread *thread, const CONTEXT *context, unsigned
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if __DARWIN_UNIX03 && defined(_STRUCT_X86_DEBUG_STATE32)
|
||||||
|
state.__dr0 = context->Dr0;
|
||||||
|
state.__dr1 = context->Dr1;
|
||||||
|
state.__dr2 = context->Dr2;
|
||||||
|
state.__dr3 = context->Dr3;
|
||||||
|
state.__dr4 = 0;
|
||||||
|
state.__dr5 = 0;
|
||||||
|
state.__dr6 = context->Dr6;
|
||||||
|
state.__dr7 = context->Dr7;
|
||||||
|
#else
|
||||||
state.dr0 = context->Dr0;
|
state.dr0 = context->Dr0;
|
||||||
state.dr1 = context->Dr1;
|
state.dr1 = context->Dr1;
|
||||||
state.dr2 = context->Dr2;
|
state.dr2 = context->Dr2;
|
||||||
|
@ -218,6 +241,7 @@ void set_thread_context( struct thread *thread, const CONTEXT *context, unsigned
|
||||||
state.dr5 = 0;
|
state.dr5 = 0;
|
||||||
state.dr6 = context->Dr6;
|
state.dr6 = context->Dr6;
|
||||||
state.dr7 = context->Dr7;
|
state.dr7 = context->Dr7;
|
||||||
|
#endif
|
||||||
if (!thread_set_state( port, x86_DEBUG_STATE32, (thread_state_t)&state, count ))
|
if (!thread_set_state( port, x86_DEBUG_STATE32, (thread_state_t)&state, count ))
|
||||||
{
|
{
|
||||||
if (thread->context) /* update the cached values */
|
if (thread->context) /* update the cached values */
|
||||||
|
@ -231,6 +255,7 @@ void set_thread_context( struct thread *thread, const CONTEXT *context, unsigned
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mach_port_deallocate( mach_task_self(), port );
|
mach_port_deallocate( mach_task_self(), port );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int send_thread_signal( struct thread *thread, int sig )
|
int send_thread_signal( struct thread *thread, int sig )
|
||||||
|
|
Loading…
Reference in New Issue