Bug 87861
Summary: | ptrace headers make it awkward to call ptrace(PTRACE_GETREGS) from C++ | ||
---|---|---|---|
Product: | Platform Specific/Hardware | Reporter: | Jay Foad (jay.foad) |
Component: | PPC-64 | Assignee: | Anton Blanchard (anton) |
Status: | RESOLVED INVALID | ||
Severity: | low | CC: | alan |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 3.14.17 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: | C++ test case |
C library... |
Created attachment 156881 [details] C++ test case With the attached test case, I get the following compiler errors if I try to call ptrace(PTRACE_GETREGS) from C++. This seems like something that should work out of the box, without needing a cast or a -fpermissive. $ g++ p.cc p.cc: In function ‘void f()’: p.cc:4:42: error: invalid conversion from ‘int’ to ‘__ptrace_request’ [-fpermissive] void f() { ptrace(PTRACE_GETREGS, 0, 0, 0); } ^ In file included from p.cc:1:0: /usr/include/sys/ptrace.h:163:17: error: initializing argument 1 of ‘long int ptrace(__ptrace_request, ...)’ [-fpermissive] extern long int ptrace (enum __ptrace_request __request, ...) __THROW; ^ $ uname -a Linux power8-fedora 3.14.17-100.fc19.ppc64p7 #1 SMP Sat Aug 23 04:01:55 UTC 2014 ppc64 ppc64 ppc64 GNU/Linux $ cat /etc/fedora-release Fedora release 19 (Schrödinger’s Cat) This seems like a problem with the kernel headers, but I'm not sure (maybe it's the C library's job to fix this up, or something...).