diff options
author | Jostein Kjonigsen <jostein@kjonigsen.net> | 2015-03-26 07:51:43 +0000 |
---|---|---|
committer | Jostein Kjønigsen <jostein@kjonigsen.net> | 2015-03-26 15:23:14 +0000 |
commit | 5de0525b094bc2834188ca2838882df3518311a1 (patch) | |
tree | 3003a7ef3be0b5581e111fa0bd8878c16c046209 /src/pal/src/arch | |
parent | 7ede7fe06b22de97381363e1411671d37887481c (diff) | |
download | coreclr-5de0525b094bc2834188ca2838882df3518311a1.tar.gz coreclr-5de0525b094bc2834188ca2838882df3518311a1.tar.bz2 coreclr-5de0525b094bc2834188ca2838882df3518311a1.zip |
Fix ptrace-invocation on FreeBSD.
Unlike in Linux[1] FreeBSD's ptrace does not use an enum[2].
[1] http://linux.die.net/include/sys/ptrace.h
[2] http://www.freebsd.org/cgi/man.cgi?query=ptrace
This fixes compiler errors like this one:
/home/josteink/build/coreclr/src/pal/src/arch/i386/context.cpp:305:21: error: use of undeclared identifier '__ptrace_request'
if (ptrace((__ptrace_request)PT_GETREGS, processId, (caddr_t) &ptrace_registers, 0) == -1)
Diffstat (limited to 'src/pal/src/arch')
-rw-r--r-- | src/pal/src/arch/i386/context.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/pal/src/arch/i386/context.cpp b/src/pal/src/arch/i386/context.cpp index 4cd09373ce..44b5627eb6 100644 --- a/src/pal/src/arch/i386/context.cpp +++ b/src/pal/src/arch/i386/context.cpp @@ -298,11 +298,11 @@ BOOL CONTEXT_GetRegisters(DWORD processId, ucontext_t *registers) { #if HAVE_PT_REGS struct pt_regs ptrace_registers; + if (ptrace((__ptrace_request)PT_GETREGS, processId, (caddr_t) &ptrace_registers, 0) == -1) #elif HAVE_BSD_REGS_T struct reg ptrace_registers; + if (ptrace(PT_GETREGS, processId, (caddr_t) &ptrace_registers, 0) == -1) #endif - - if (ptrace((__ptrace_request)PT_GETREGS, processId, (caddr_t) &ptrace_registers, 0) == -1) { ASSERT("Failed ptrace(PT_GETREGS, processId:%d) errno:%d (%s)\n", processId, errno, strerror(errno)); @@ -447,7 +447,11 @@ CONTEXT_SetThreadContext( if (lpContext->ContextFlags & (CONTEXT_CONTROL | CONTEXT_INTEGER)) { +#if HAVE_PT_REGS if (ptrace((__ptrace_request)PT_GETREGS, dwProcessId, (caddr_t)&ptrace_registers, 0) == -1) +#elif HAVE_BSD_REGS_T + if (ptrace(PT_GETREGS, dwProcessId, (caddr_t)&ptrace_registers, 0) == -1) +#endif { ASSERT("Failed ptrace(PT_GETREGS, processId:%d) errno:%d (%s)\n", dwProcessId, errno, strerror(errno)); @@ -469,8 +473,12 @@ CONTEXT_SetThreadContext( ASSIGN_INTEGER_REGS } #undef ASSIGN_REG - + +#if HAVE_PT_REGS if (ptrace((__ptrace_request)PT_SETREGS, dwProcessId, (caddr_t)&ptrace_registers, 0) == -1) +#elif HAVE_BSD_REGS_T + if (ptrace(PT_SETREGS, dwProcessId, (caddr_t)&ptrace_registers, 0) == -1) +#endif { ASSERT("Failed ptrace(PT_SETREGS, processId:%d) errno:%d (%s)\n", dwProcessId, errno, strerror(errno)); |