These PTRACE-related enum values are not present everywhere; their presence is 
denoted by certain preprocessor definitions in sys/ptrace.h that we can check.

http://reviews.llvm.org/D4091

Files:
  source/Plugins/Process/Linux/ProcessMonitor.cpp

Index: source/Plugins/Process/Linux/ProcessMonitor.cpp
===================================================================
--- source/Plugins/Process/Linux/ProcessMonitor.cpp
+++ source/Plugins/Process/Linux/ProcessMonitor.cpp
@@ -122,18 +122,22 @@
                 verbose_log->Printf("PTRACE_POKEUSER %s", buf.GetData());
                 break;
             }
+#ifdef PT_SETREGS
         case PTRACE_SETREGS:
             {
                 DisplayBytes(buf, data, data_size);
                 verbose_log->Printf("PTRACE_SETREGS %s", buf.GetData());
                 break;
             }
+#endif
+#ifdef PT_SETFPREGS
         case PTRACE_SETFPREGS:
             {
                 DisplayBytes(buf, data, data_size);
                 verbose_log->Printf("PTRACE_SETFPREGS %s", buf.GetData());
                 break;
             }
+#endif
         case PTRACE_SETSIGINFO:
             {
                 DisplayBytes(buf, data, sizeof(siginfo_t));
@@ -564,10 +568,14 @@
 void
 ReadGPROperation::Execute(ProcessMonitor *monitor)
 {
+#ifdef PT_GETREGS
     if (PTRACE(PTRACE_GETREGS, m_tid, NULL, m_buf, m_buf_size) < 0)
         m_result = false;
     else
         m_result = true;
+#else
+    m_result = false;
+#endif
 }
 
 
//------------------------------------------------------------------------------
@@ -592,10 +600,14 @@
 void
 ReadFPROperation::Execute(ProcessMonitor *monitor)
 {
+#ifdef PT_GETFPREGS
     if (PTRACE(PTRACE_GETFPREGS, m_tid, NULL, m_buf, m_buf_size) < 0)
         m_result = false;
     else
         m_result = true;
+#else
+    m_result = false;
+#endif
 }
 
 
//------------------------------------------------------------------------------
@@ -649,10 +661,14 @@
 void
 WriteGPROperation::Execute(ProcessMonitor *monitor)
 {
+#ifdef PT_SETREGS
     if (PTRACE(PTRACE_SETREGS, m_tid, NULL, m_buf, m_buf_size) < 0)
         m_result = false;
     else
         m_result = true;
+#else
+    m_result = false;
+#endif
 }
 
 
//------------------------------------------------------------------------------
@@ -677,10 +693,14 @@
 void
 WriteFPROperation::Execute(ProcessMonitor *monitor)
 {
+#ifdef PT_SETFPREGS
     if (PTRACE(PTRACE_SETFPREGS, m_tid, NULL, m_buf, m_buf_size) < 0)
         m_result = false;
     else
         m_result = true;
+#else
+    m_result = false;
+#endif
 }
 
 
//------------------------------------------------------------------------------
Index: source/Plugins/Process/Linux/ProcessMonitor.cpp
===================================================================
--- source/Plugins/Process/Linux/ProcessMonitor.cpp
+++ source/Plugins/Process/Linux/ProcessMonitor.cpp
@@ -122,18 +122,22 @@
                 verbose_log->Printf("PTRACE_POKEUSER %s", buf.GetData());
                 break;
             }
+#ifdef PT_SETREGS
         case PTRACE_SETREGS:
             {
                 DisplayBytes(buf, data, data_size);
                 verbose_log->Printf("PTRACE_SETREGS %s", buf.GetData());
                 break;
             }
+#endif
+#ifdef PT_SETFPREGS
         case PTRACE_SETFPREGS:
             {
                 DisplayBytes(buf, data, data_size);
                 verbose_log->Printf("PTRACE_SETFPREGS %s", buf.GetData());
                 break;
             }
+#endif
         case PTRACE_SETSIGINFO:
             {
                 DisplayBytes(buf, data, sizeof(siginfo_t));
@@ -564,10 +568,14 @@
 void
 ReadGPROperation::Execute(ProcessMonitor *monitor)
 {
+#ifdef PT_GETREGS
     if (PTRACE(PTRACE_GETREGS, m_tid, NULL, m_buf, m_buf_size) < 0)
         m_result = false;
     else
         m_result = true;
+#else
+    m_result = false;
+#endif
 }
 
 //------------------------------------------------------------------------------
@@ -592,10 +600,14 @@
 void
 ReadFPROperation::Execute(ProcessMonitor *monitor)
 {
+#ifdef PT_GETFPREGS
     if (PTRACE(PTRACE_GETFPREGS, m_tid, NULL, m_buf, m_buf_size) < 0)
         m_result = false;
     else
         m_result = true;
+#else
+    m_result = false;
+#endif
 }
 
 //------------------------------------------------------------------------------
@@ -649,10 +661,14 @@
 void
 WriteGPROperation::Execute(ProcessMonitor *monitor)
 {
+#ifdef PT_SETREGS
     if (PTRACE(PTRACE_SETREGS, m_tid, NULL, m_buf, m_buf_size) < 0)
         m_result = false;
     else
         m_result = true;
+#else
+    m_result = false;
+#endif
 }
 
 //------------------------------------------------------------------------------
@@ -677,10 +693,14 @@
 void
 WriteFPROperation::Execute(ProcessMonitor *monitor)
 {
+#ifdef PT_SETFPREGS
     if (PTRACE(PTRACE_SETFPREGS, m_tid, NULL, m_buf, m_buf_size) < 0)
         m_result = false;
     else
         m_result = true;
+#else
+    m_result = false;
+#endif
 }
 
 //------------------------------------------------------------------------------
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to