[PATCH] warning: passing argument 4 of ‘ptrace’ makes integer from pointer without a cast

Michal Nowak mnowak at redhat.com
Wed Jan 21 17:13:28 UTC 2009


Hi.

Yet another clean-up patch. Compiling on i386 gave me following
warnings:

[...]
strace.c: In function ‘handle_stopped_tcbs’:
strace.c:2539: warning: passing argument 4 of ‘ptrace’ makes integer from pointer without a cast
strace.c:2566: warning: passing argument 4 of ‘ptrace’ makes integer from pointer without a cast
[...]
util.c: In function ‘do_ptrace’:
util.c:260: warning: passing argument 4 of ‘ptrace’ makes integer from pointer without a cast
util.c: In function ‘ptrace_restart’:
util.c:282: warning: passing argument 4 of ‘ptrace’ makes integer from pointer without a cast
[...]

The thing is that the 'Linux/Glibc at i386' prototype of ptrace() [1] is
different from the "expected" one from '<sys/ptrace.h>' [2].

The patch now #ifdefine-s the ptrace(...) functions according to 
architecture. #ifdefine-s were roughly taken from 'defs.h' and
wired into the warnings-emitting code.

Anyway, I pretty wonder whether this part of the patch

[...]
+#endif /* !LINUX */
+#else /* !__STDC__ */
+                               ptrace();
+#endif /* !__STDC__ */
`-------------------------------^^^^^^^^^
[...]

is of some use... (I obviously couldn't test it on current distros 
with glibc.)


Michal

--
[1]  defs.h: 159  extern long ptrace(int, int, char *, long);

[2]  long ptrace(enum __ptrace_request request, pid_t pid,
                void *addr, void *data);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: strace-4.5.18-ptrace-pointer-cast.patch
Type: application/octet-stream
Size: 3390 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20090121/a8736abe/attachment.obj>


More information about the Strace-devel mailing list