Skip to content

Commit

Permalink
Merge pull request #443 from SimonKagstrom/linux_correct_ptrace_calls
Browse files Browse the repository at this point in the history
Linux correct ptrace calls
  • Loading branch information
SimonKagstrom authored Jul 8, 2024
2 parents dbb6be8 + 1c633cc commit 2d7b488
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ set (MACHO_SRCS
)
set (SOLIB_generated )


# Avoid error: invalid conversion from 'int' to '__ptrace_request' on PowerPC
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_TARGET_ARCHITECTURES MATCHES "ppc64")
add_compile_options(-fpermissive)
endif()

# Linux-specific sources
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package (LibElf)
Expand Down
8 changes: 4 additions & 4 deletions src/engines/ptrace_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ static long getRegs(pid_t pid, void *addr, void *regs, size_t len)
return ptrace(PTRACE_GETREGSET, pid, (void *)NT_PRSTATUS, &iov);
#else
(void) len;
return ptrace((__ptrace_request ) PTRACE_GETREGS, pid, NULL, regs);
return ptrace(PTRACE_GETREGS, pid, NULL, regs);
#endif
}

Expand Down Expand Up @@ -361,12 +361,12 @@ static int kill_lwp(unsigned long lwpid, int signo)
unsigned long ptrace_sys::peekWord(pid_t pid, unsigned long aligned_addr)
{

return ptrace((__ptrace_request ) PTRACE_PEEKTEXT, pid, aligned_addr, 0);
return ptrace(PTRACE_PEEKTEXT, pid, aligned_addr, 0);
}

void ptrace_sys::pokeWord(pid_t pid, unsigned long aligned_addr, unsigned long value)
{
ptrace((__ptrace_request ) PTRACE_POKETEXT, pid, aligned_addr, value);
ptrace(PTRACE_POKETEXT, pid, aligned_addr, value);
}

static long setRegs(pid_t pid, void *addr, void *regs, size_t len)
Expand All @@ -377,7 +377,7 @@ static long setRegs(pid_t pid, void *addr, void *regs, size_t len)
return ptrace(PTRACE_SETREGSET, pid, (void *)NT_PRSTATUS, &iov);
#else
(void) len;
return ptrace((__ptrace_request ) PTRACE_SETREGS, pid, NULL, regs);
return ptrace(PTRACE_SETREGS, pid, NULL, regs);
#endif
}

Expand Down

0 comments on commit 2d7b488

Please sign in to comment.