Bug 87861 - ptrace headers make it awkward to call ptrace(PTRACE_GETREGS) from C++
Summary: ptrace headers make it awkward to call ptrace(PTRACE_GETREGS) from C++
Status: RESOLVED INVALID
Alias: None
Product: Platform Specific/Hardware
Classification: Unclassified
Component: PPC-64 (show other bugs)
Hardware: All Linux
: P1 low
Assignee: Anton Blanchard
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-06 09:24 UTC by Jay Foad
Modified: 2014-12-10 17:01 UTC (History)
1 user (show)

See Also:
Kernel Version: 3.14.17
Subsystem:
Regression: No
Bisected commit-id:


Attachments
C++ test case (115 bytes, text/x-c++src)
2014-11-06 09:24 UTC, Jay Foad
Details

Description Jay Foad 2014-11-06 09:24:56 UTC
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...).
Comment 1 Alan 2014-12-10 17:01:37 UTC
C library...

Note You need to log in before you can comment on or make changes to this bug.