[build error] [PATCH] [4.5.20-42-g8044bc1] strace.c:2369: error: PTRACE_GETEVENTMSG undeclared
Douglas Mencken
dougmencken at gmail.com
Sun Dec 12 21:25:54 UTC 2010
powerpc-gnu-linux-uclibc-gcc -DHAVE_CONFIG_H -I. -I./linux/powerpc
-I./linux -Wall -Wwrite-strings -g -O2 -MT strace.o -MD -MP -MF
.deps/strace.Tpo -c -o strace.o strace.c
strace.c: In function 'handle_ptrace_event':
strace.c:2369:17: error: 'PTRACE_GETEVENTMSG' undeclared (first use in
this function)
strace.c:2369:17: note: each undeclared identifier is reported only
once for each function it appears in
make[1]: *** [strace.o] Error 1
make[1]: Leaving directory
`/root/build-farm/strace-v4.5.20-42-g8044bc1.builddir'
make: *** [all] Error 2
Got this on building current git master branch of strace, platform:
GNU/Linux at PowerPC with uClibc std C library.
The last version I tried (strace-v4.5.20-34-g09fa7f8) built
successfully, so I diffed and got that you have added a lot of stuff
into that file:
--- strace-v4.5.20-34-g09fa7f8.srcpkg/strace.c 2010-09-17
21:40:01.000000000 +0200
+++ ./strace.c-42-g8044bc1 2010-12-07 13:50:49.000000000 +0100
<some lines skipped>
+#ifdef LINUX
+static int
+handle_ptrace_event(int status, struct tcb *tcp)
+{
+ if (status >> 16 == PTRACE_EVENT_VFORK ||
+ status >> 16 == PTRACE_EVENT_CLONE ||
+ status >> 16 == PTRACE_EVENT_FORK) {
+ int childpid;
+
+ if (do_ptrace(PTRACE_GETEVENTMSG, tcp, NULL, &childpid) < 0) {
+ if (errno != ESRCH) {
+ fprintf(stderr, "\
+%s: handle_ptrace_event: ptrace cannot get new child's pid\n",
+ progname);
+ cleanup();
+ exit(1);
+ }
+ return -1;
+ }
+ return handle_new_child(tcp, childpid, 0);
+ }
+ return 1;
+}
+#endif
<other lines skipped>
Yes, GNU Std C library includes that define inside <sys/ptrace.h>, but
other libs don't. Diving deeper, I also diffed defs.h:
-- strace-v4.5.20-34-g09fa7f8.srcpkg/defs.h 2010-09-17 21:40:01.000000000 +0200
+++ ./defs.h-42-g8044bc1 2010-12-07 13:50:49.000000000 +0100
@@ -308,6 +308,31 @@
#define PR_FAULTED S_CORE
#endif
+#ifdef LINUX
+# ifndef PTRACE_SETOPTIONS
+# define PTRACE_SETOPTIONS 0x4200
+# endif
+# ifndef PTRACE_O_TRACEFORK
+# define PTRACE_O_TRACEFORK 0x00000002
+# endif
<other lines skipped>
So you added a lot here too, some parts are from that glibc's
sys/ptrace.h. But GETEVENTMSG is missing. So here's the patch, which
solves this build problem (attached to letter): to add such definition
for PTRACE_GETEVENTMSG too.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: strace-v4.5.20-42-g8044bc1-defs.h.patch
Type: application/octet-stream
Size: 359 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20101212/b7fc74cb/attachment.obj>
More information about the Strace-devel
mailing list