[Lldb-commits] [lldb] r177176 - Rollback r177173. Some OSs may not have ptrace extensions which lldb expects when building. This needs to be accounted for.

Matt Kopec Matt.Kopec at intel.com
Fri Mar 15 13:00:39 PDT 2013


Author: mkopec
Date: Fri Mar 15 15:00:39 2013
New Revision: 177176

URL: http://llvm.org/viewvc/llvm-project?rev=177176&view=rev
Log:
Rollback r177173. Some OSs may not have ptrace extensions which lldb expects when building. This needs to be accounted for.

Modified:
    lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
    lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h
    lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
    lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp?rev=177176&r1=177175&r2=177176&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Fri Mar 15 15:00:39 2013
@@ -82,10 +82,7 @@ PtraceWrapper(int req, ::pid_t pid, void
     //PtraceDisplayBytes(req, data);
 
     errno = 0;
-    if (req == PTRACE_GETREGSET || req == PTRACE_SETREGSET)
-        result = ptrace(req, pid, *(unsigned int *)addr, data);
-    else
-        result = ptrace(req, pid, (caddr_t) addr, data);
+    result = ptrace(req, pid, (caddr_t) addr, data);
 
     //PtraceDisplayBytes(req, data);
 
@@ -124,10 +121,7 @@ PtraceWrapper(__ptrace_request req, pid_
 {
     long result = 0;
     errno = 0;
-    if (req == PTRACE_GETREGSET || req == PTRACE_SETREGSET)
-        result = ptrace(req, pid, *(unsigned int *)addr, data);
-    else
-        result = ptrace(req, pid, addr, data);
+    result = ptrace(req, pid, addr, data);
     return result;
 }
 
@@ -402,35 +396,6 @@ ReadFPROperation::Execute(ProcessMonitor
 }
 
 //------------------------------------------------------------------------------
-/// @class ReadRegisterSetOperation
-/// @brief Implements ProcessMonitor::ReadRegisterSet.
-class ReadRegisterSetOperation : public Operation
-{
-public:
-    ReadRegisterSetOperation(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset, bool &result)
-        : m_tid(tid), m_buf(buf), m_buf_size(buf_size), m_regset(regset), m_result(result)
-        { }
-
-    void Execute(ProcessMonitor *monitor);
-
-private:
-    lldb::tid_t m_tid;
-    void *m_buf;
-    size_t m_buf_size;
-    const unsigned int m_regset;
-    bool &m_result;
-};
-
-void
-ReadRegisterSetOperation::Execute(ProcessMonitor *monitor)
-{
-    if (PTRACE(PTRACE_GETREGSET, m_tid, (void *)&m_regset, m_buf) < 0)
-        m_result = false;
-    else
-        m_result = true;
-}
-
-//------------------------------------------------------------------------------
 /// @class WriteGPROperation
 /// @brief Implements ProcessMonitor::WriteGPR.
 class WriteGPROperation : public Operation
@@ -483,35 +448,6 @@ WriteFPROperation::Execute(ProcessMonito
 }
 
 //------------------------------------------------------------------------------
-/// @class WriteRegisterSetOperation
-/// @brief Implements ProcessMonitor::WriteRegisterSet.
-class WriteRegisterSetOperation : public Operation
-{
-public:
-    WriteRegisterSetOperation(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset, bool &result)
-        : m_tid(tid), m_buf(buf), m_buf_size(buf_size), m_regset(regset), m_result(result)
-        { }
-
-    void Execute(ProcessMonitor *monitor);
-
-private:
-    lldb::tid_t m_tid;
-    void *m_buf;
-    size_t m_buf_size;
-    const unsigned int m_regset;
-    bool &m_result;
-};
-
-void
-WriteRegisterSetOperation::Execute(ProcessMonitor *monitor)
-{
-    if (PTRACE(PTRACE_SETREGSET, m_tid, (void *)&m_regset, m_buf) < 0)
-        m_result = false;
-    else
-        m_result = true;
-}
-
-//------------------------------------------------------------------------------
 /// @class ResumeOperation
 /// @brief Implements ProcessMonitor::Resume.
 class ResumeOperation : public Operation
@@ -1539,15 +1475,6 @@ ProcessMonitor::ReadFPR(lldb::tid_t tid,
 }
 
 bool
-ProcessMonitor::ReadRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset)
-{
-    bool result;
-    ReadRegisterSetOperation op(tid, buf, buf_size, regset, result);
-    DoOperation(&op);
-    return result;
-}
-
-bool
 ProcessMonitor::WriteGPR(lldb::tid_t tid, void *buf, size_t buf_size)
 {
     bool result;
@@ -1564,15 +1491,6 @@ ProcessMonitor::WriteFPR(lldb::tid_t tid
     DoOperation(&op);
     return result;
 }
-
-bool
-ProcessMonitor::WriteRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset)
-{
-    bool result;
-    WriteRegisterSetOperation op(tid, buf, buf_size, regset, result);
-    DoOperation(&op);
-    return result;
-}
 
 bool
 ProcessMonitor::Resume(lldb::tid_t tid, uint32_t signo)

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h?rev=177176&r1=177175&r2=177176&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h Fri Mar 15 15:00:39 2013
@@ -126,33 +126,23 @@ public:
     bool
     ReadGPR(lldb::tid_t tid, void *buf, size_t buf_size);
 
-    /// Reads generic floating point registers into the specified buffer.
+    /// Reads all floating point registers into the specified buffer.
     /// FIXME: The FreeBSD implementation of this function should use tid in order
     ///        to enable support for debugging threaded programs.
     bool
     ReadFPR(lldb::tid_t tid, void *buf, size_t buf_size);
 
-    /// Reads the specified register set into the specified buffer.
-    /// For instance, the extended floating-point register set.
-    bool
-    ReadRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset);
-
     /// Writes all general purpose registers into the specified buffer.
     /// FIXME: The FreeBSD implementation of this function should use tid in order
     ///        to enable support for debugging threaded programs.
     bool
     WriteGPR(lldb::tid_t tid, void *buf, size_t buf_size);
 
-    /// Writes generic floating point registers into the specified buffer.
+    /// Writes all floating point registers into the specified buffer.
     /// FIXME: The FreeBSD implementation of this function should use tid in order
     ///        to enable support for debugging threaded programs.
     bool
-    WriteFPR(lldb::tid_t tid, void *buf, size_t buf_size);
-
-    /// Writes the specified register set into the specified buffer.
-    /// For instance, the extended floating-point register set.
-    bool
-    WriteRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset);
+    WriteFPR(lldb::tid_t tid, void *buf);
 
     /// Writes a siginfo_t structure corresponding to the given thread ID to the
     /// memory region pointed to by @p siginfo.

Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp?rev=177176&r1=177175&r2=177176&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp Fri Mar 15 15:00:39 2013
@@ -109,13 +109,6 @@ static void PtraceDisplayBytes(__ptrace_
                 verbose_log->Printf("PTRACE_SETSIGINFO %s", buf.GetData());
                 break;
             }
-        case PTRACE_SETREGSET:
-            {
-                // Extract iov_base from data, which is a pointer to the struct IOVEC
-                DisplayBytes(buf, *(void **)data, data_size);
-                verbose_log->Printf("PTRACE_SETREGSET %s", buf.GetData());
-                break;
-            }
         default:
             {
             }
@@ -140,10 +133,7 @@ PtraceWrapper(__ptrace_request req, pid_
     PtraceDisplayBytes(req, data, data_size);
 
     errno = 0;
-    if (req == PTRACE_GETREGSET || req == PTRACE_SETREGSET)
-        result = ptrace(req, pid, *(unsigned int *)addr, data);
-    else
-        result = ptrace(req, pid, addr, data);
+    result = ptrace(req, pid, addr, data);
 
     PtraceDisplayBytes(req, data, data_size);
 
@@ -169,12 +159,8 @@ PtraceWrapper(__ptrace_request req, pid_
 extern long
 PtraceWrapper(__ptrace_request req, pid_t pid, void *addr, void *data, size_t data_size)
 {
-    long result = 0;
     errno = 0;
-    if (req == PTRACE_GETREGSET || req == PTRACE_SETREGSET)
-        result = ptrace(req, pid, *(unsigned int *)addr, data);
-    else
-        result = ptrace(req, pid, addr, data);
+    long result = ptrace(req, pid, addr, data);
     return result;
 }
 
@@ -570,35 +556,6 @@ ReadFPROperation::Execute(ProcessMonitor
 }
 
 //------------------------------------------------------------------------------
-/// @class ReadRegisterSetOperation
-/// @brief Implements ProcessMonitor::ReadRegisterSet.
-class ReadRegisterSetOperation : public Operation
-{
-public:
-    ReadRegisterSetOperation(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset, bool &result)
-        : m_tid(tid), m_buf(buf), m_buf_size(buf_size), m_regset(regset), m_result(result)
-        { }
-
-    void Execute(ProcessMonitor *monitor);
-
-private:
-    lldb::tid_t m_tid;
-    void *m_buf;
-    size_t m_buf_size;
-    const unsigned int m_regset;
-    bool &m_result;
-};
-
-void
-ReadRegisterSetOperation::Execute(ProcessMonitor *monitor)
-{
-    if (PTRACE(PTRACE_GETREGSET, m_tid, (void *)&m_regset, m_buf, m_buf_size) < 0)
-        m_result = false;
-    else
-        m_result = true;
-}
-
-//------------------------------------------------------------------------------
 /// @class WriteGPROperation
 /// @brief Implements ProcessMonitor::WriteGPR.
 class WriteGPROperation : public Operation
@@ -655,35 +612,6 @@ WriteFPROperation::Execute(ProcessMonito
 }
 
 //------------------------------------------------------------------------------
-/// @class WriteRegisterSetOperation
-/// @brief Implements ProcessMonitor::WriteRegisterSet.
-class WriteRegisterSetOperation : public Operation
-{
-public:
-    WriteRegisterSetOperation(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset, bool &result)
-        : m_tid(tid), m_buf(buf), m_buf_size(buf_size), m_regset(regset), m_result(result)
-        { }
-
-    void Execute(ProcessMonitor *monitor);
-
-private:
-    lldb::tid_t m_tid;
-    void *m_buf;
-    size_t m_buf_size;
-    const unsigned int m_regset;
-    bool &m_result;
-};
-
-void
-WriteRegisterSetOperation::Execute(ProcessMonitor *monitor)
-{
-    if (PTRACE(PTRACE_SETREGSET, m_tid, (void *)&m_regset, m_buf, m_buf_size) < 0)
-        m_result = false;
-    else
-        m_result = true;
-}
-
-//------------------------------------------------------------------------------
 /// @class ResumeOperation
 /// @brief Implements ProcessMonitor::Resume.
 class ResumeOperation : public Operation
@@ -1736,15 +1664,6 @@ ProcessMonitor::ReadFPR(lldb::tid_t tid,
 }
 
 bool
-ProcessMonitor::ReadRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset)
-{
-    bool result;
-    ReadRegisterSetOperation op(tid, buf, buf_size, regset, result);
-    DoOperation(&op);
-    return result;
-}
-
-bool
 ProcessMonitor::WriteGPR(lldb::tid_t tid, void *buf, size_t buf_size)
 {
     bool result;
@@ -1761,15 +1680,6 @@ ProcessMonitor::WriteFPR(lldb::tid_t tid
     DoOperation(&op);
     return result;
 }
-
-bool
-ProcessMonitor::WriteRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset)
-{
-    bool result;
-    WriteRegisterSetOperation op(tid, buf, buf_size, regset, result);
-    DoOperation(&op);
-    return result;
-}
 
 bool
 ProcessMonitor::Resume(lldb::tid_t tid, uint32_t signo)

Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h?rev=177176&r1=177175&r2=177176&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h (original)
+++ lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h Fri Mar 15 15:00:39 2013
@@ -122,28 +122,18 @@ public:
     bool
     ReadGPR(lldb::tid_t tid, void *buf, size_t buf_size);
 
-    /// Reads generic floating point registers into the specified buffer.
+    /// Reads all floating point registers into the specified buffer.
     bool
     ReadFPR(lldb::tid_t tid, void *buf, size_t buf_size);
 
-    /// Reads the specified register set into the specified buffer.
-    /// For instance, the extended floating-point register set.
-    bool
-    ReadRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset);
-
     /// Writes all general purpose registers into the specified buffer.
     bool
     WriteGPR(lldb::tid_t tid, void *buf, size_t buf_size);
 
-    /// Writes generic floating point registers into the specified buffer.
+    /// Writes all floating point registers into the specified buffer.
     bool
     WriteFPR(lldb::tid_t tid, void *buf, size_t buf_size);
 
-    /// Writes the specified register set into the specified buffer.
-    /// For instance, the extended floating-point register set.
-    bool
-    WriteRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset);
-
     /// Writes a siginfo_t structure corresponding to the given thread ID to the
     /// memory region pointed to by @p siginfo.
     bool





More information about the lldb-commits mailing list