[oe] [PATCH] Fix compilation error of events.c in ltrace on i386 target

Guo Hongruan camelguo at gmail.com
Fri Dec 25 01:21:45 UTC 2009


Yes, you are right.

In ubuntu-8.04, all PTRACE_EVENT* macroes are defined in  
/usr/include/sys/ptrace.h. The version of glibc in ubuntu 8.04 is 2.7.10.  
But in glibc-2.6.1 of openembedded, sys/ptrace.h does not include  
PTRACE_EVENT* macroes. So I believe it is a bug of glibc-2.6.10 or ltrace.

--- staging/i686-oe-linux/usr/include/sys/ptrace.h	2009-12-24  
19:21:47.000000000 +0800
+++ /usr/include/sys/ptrace.h	2009-08-18 09:02:45.000000000 +0800
@@ -1,5 +1,5 @@
  /* `ptrace' debugger support interface.  Linux version.
-   Copyright (C) 1996-1999,2000,2006 Free Software Foundation, Inc.
+   Copyright (C) 1996-1999,2000,2006,2007 Free Software Foundation, Inc.
     This file is part of the GNU C Library.

     The GNU C Library is free software; you can redistribute it and/or
@@ -129,6 +129,29 @@
  #define PT_SETSIGINFO PTRACE_SETSIGINFO
  };

+
+/* Options set using PTRACE_SETOPTIONS.  */
+enum __ptrace_setoptions {
+  PTRACE_O_TRACESYSGOOD	= 0x00000001,
+  PTRACE_O_TRACEFORK	= 0x00000002,
+  PTRACE_O_TRACEVFORK   = 0x00000004,
+  PTRACE_O_TRACECLONE	= 0x00000008,
+  PTRACE_O_TRACEEXEC	= 0x00000010,
+  PTRACE_O_TRACEVFORKDONE = 0x00000020,
+  PTRACE_O_TRACEEXIT	= 0x00000040,
+  PTRACE_O_MASK		= 0x0000007f
+};
+
+/* Wait extended result codes for the above trace options.  */
+enum __ptrace_eventcodes {
+  PTRACE_EVENT_FORK	= 1,
+  PTRACE_EVENT_VFORK	= 2,
+  PTRACE_EVENT_CLONE	= 3,
+  PTRACE_EVENT_EXEC	= 4,
+  PTRACE_EVENT_VFORK_DONE = 5,
+  PTRACE_EVENT_EXIT	= 6
+};
+
  /* Perform process tracing functions.  REQUEST is one of the values
     above, and determines the action to be taken.
     For all requests except PTRACE_TRACEME, PID specifies the process to be

在 Fri, 25 Dec 2009 01:45:08 +0800,Khem Raj <raj.khem at gmail.com> 写道:

> On Thu, Dec 24, 2009 at 12:17 AM, Guo Hongruan <camelguo at gmail.com>  
> wrote:
>> on qemux86/minimal, the compilation of ltrace error reporting lack of  
>> some macro started with PTRACE_EVENT, this patch fixes this problem.
>
> All PTRACE_EVENT* defines should come from sys/ptrace.h
> which it includes already. If these defines are not there then
> there seems to be a problem either in the libc headers that
> are installed or the way they are getting included.
>
> Can you post the preprocessed output of event.c ?
>
>> ---
>>  .../files/ltrace-fix-ptrace-event-macros.patch     |   12 ++++++++++++
>>  recipes/ltrace/ltrace_0.5.3.bb                     |    4 ++++
>>  2 files changed, 16 insertions(+), 0 deletions(-)
>>  create mode 100644  
>> recipes/ltrace/files/ltrace-fix-ptrace-event-macros.patch
>>
>> diff --git a/recipes/ltrace/files/ltrace-fix-ptrace-event-macros.patch  
>> b/recipes/ltrace/files/ltrace-fix-ptrace-event-macros.patch
>> new file mode 100644
>> index 0000000..7232ca8
>> --- /dev/null
>> +++ b/recipes/ltrace/files/ltrace-fix-ptrace-event-macros.patch
>> @@ -0,0 +1,12 @@
>> +Index: ltrace-0.5.3/sysdeps/linux-gnu/events.c
>> +===================================================================
>> +--- ltrace-0.5.3.orig/sysdeps/linux-gnu/events.c       2009-12-24  
>> 15:58:24.000000000 +0800
>> ++++ ltrace-0.5.3/sysdeps/linux-gnu/events.c    2009-12-24  
>> 15:58:41.000000000 +0800
>> +@@ -8,6 +8,7 @@
>> + #include <signal.h>
>> + #include <string.h>
>> + #include <sys/ptrace.h>
>> ++#include <linux/ptrace.h>
>> +
>> + #include "common.h"
>> +
>> diff --git a/recipes/ltrace/ltrace_0.5.3.bb  
>> b/recipes/ltrace/ltrace_0.5.3.bb
>> index 4130c29..1f70878 100644
>> --- a/recipes/ltrace/ltrace_0.5.3.bb
>> +++ b/recipes/ltrace/ltrace_0.5.3.bb
>> @@ -4,6 +4,8 @@ SECTION = "devel"
>>  DEPENDS = "libelf"
>>  LICENSE = "GPLv2"
>>
>> +PR = "r2"
>> +
>>  SRC_URI = "\
>>   ${DEBIAN_MIRROR}/main/l/ltrace/ltrace_${PV}.orig.tar.gz \
>>   ${DEBIAN_MIRROR}/main/l/ltrace/ltrace_${PV}-2.diff.gz;patch=1 \
>> @@ -12,7 +14,9 @@ SRC_URI = "\
>>   file://ltrace-mips-remove-CP.patch;patch=1 \
>>   file://ltrace-mips.patch;patch=1 \
>>   file://ltrace-ppc.patch;patch=1 \
>> +  file://ltrace-fix-ptrace-event-macros.patch;patch=1 \
>>  "
>> +
>>  inherit autotools
>>
>>  export TARGET_CFLAGS = "${SELECTED_OPTIMIZATION} -isystem  
>> ${STAGING_INCDIR}"
>> --
>> 1.5.4.3
>>
>>
>> _______________________________________________
>> Openembedded-devel mailing list
>> Openembedded-devel at lists.openembedded.org
>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
>>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel at lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel


-- 
Guo Hongruan, Embedded Linux Consultant
Skype: camelguo
Twitter: camelguo
http://www.gulessoft.com




More information about the Openembedded-devel mailing list