[DynInst_API:] [PATCH] Just include <sys/ptrace.h>


Date: Mon, 05 Aug 2013 12:24:36 -0400
From: William Cohen <wcohen@xxxxxxxxxx>
Subject: [DynInst_API:] [PATCH] Just include <sys/ptrace.h>
I was reviewing a build failure for fedora 20 mass rebuild:

https://bugzilla.redhat.com/show_bug.cgi?id=991889

I found that dyninst was including <sys/ptrace.h> and <linux/ptrace.h> .  There isn't a need for the <linux/ptrace.h> once some of the define uses are corrected to match up to the current ones in <sys/ptrace.h>

Attached is the patch to address this problem on fedora 19.  I haven't verified that this works on older distributions of linux.

-Will
diff -up dyninst/proccontrol/src/linux.C.orig dyninst/proccontrol/src/linux.C
--- dyninst/proccontrol/src/linux.C.orig	2013-06-18 11:34:02.000000000 -0400
+++ dyninst/proccontrol/src/linux.C	2013-08-05 12:16:35.172000000 -0400
@@ -1970,7 +1970,7 @@ bool linux_thread::plat_getRegister(Dyni
    const unsigned size = i->second.second;
    assert(sizeof(val) >= size);
    val = 0;
-   unsigned long result = do_ptrace((pt_req) PTRACE_PEEKUSR, lwp, (void *) offset, NULL);
+   unsigned long result = do_ptrace((pt_req) PTRACE_PEEKUSER, lwp, (void *) offset, NULL);
    if (errno != 0) {
       perr_printf("Error reading registers from %d: %s\n", lwp, strerror(errno));
       setLastError(err_internal, "Could not read register from thread");
@@ -2184,11 +2184,11 @@ bool linux_thread::plat_setRegister(Dyni
    int result;
    if (size == 4) {
       uint32_t value = (uint32_t) val;
-      result = do_ptrace((pt_req) PTRACE_POKEUSR, lwp, (void *) offset, (void *) value);
+      result = do_ptrace((pt_req) PTRACE_POKEUSER, lwp, (void *) offset, (void *) value);
    }
    else if (size == 8) {
       uint64_t value = (uint64_t) val;
-      result = do_ptrace((pt_req) PTRACE_POKEUSR, lwp, (void *) offset, (void *) value);
+      result = do_ptrace((pt_req) PTRACE_POKEUSER, lwp, (void *) offset, (void *) value);
    }
    else {
       assert(0);
diff -up dyninst/proccontrol/src/linux.h.orig dyninst/proccontrol/src/linux.h
--- dyninst/proccontrol/src/linux.h.orig	2013-06-18 11:34:02.000000000 -0400
+++ dyninst/proccontrol/src/linux.h	2013-08-05 12:16:35.173000000 -0400
@@ -47,7 +47,6 @@
 #include "common/h/dthread.h"
 #include <sys/types.h>
 #include <sys/ptrace.h>
-#include <linux/ptrace.h>
 
 typedef enum __ptrace_request pt_req;
 
diff -up dyninst/stackwalk/src/linux-swk.C.orig dyninst/stackwalk/src/linux-swk.C
--- dyninst/stackwalk/src/linux-swk.C.orig	2013-06-18 11:34:02.000000000 -0400
+++ dyninst/stackwalk/src/linux-swk.C	2013-08-05 12:16:35.175000000 -0400
@@ -73,7 +73,6 @@ using namespace Dyninst::Stackwalker;
 // if porting to some linux-like platform that doesn't support 
 // them.
 #include <sys/ptrace.h>
-#include <linux/ptrace.h>
 typedef enum __ptrace_request pt_req;
 #define cap_ptrace_traceclone
 #define cap_ptrace_setoptions
[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] [PATCH] Just include <sys/ptrace.h>, William Cohen <=