[Lldb-commits] PtraceWrapper's printf assumes incorrect size for pid for 32-bit linux

Matthew Gardiner mg11 at csr.com
Mon Feb 24 05:33:49 PST 2014


Of course, a better fix logs after the ptrace, and hence can print out the
returned value as below:

Index: ProcessMonitor.cpp
===================================================================
--- ProcessMonitor.cpp    (revision 201779)
+++ ProcessMonitor.cpp    (working copy)
@@ -164,10 +164,6 @@

      Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_PTRACE));

-    if (log)
-        log->Printf("ptrace(%s, %lu, %p, %p, %zu) called from file %s line %d",
-                    reqName, pid, addr, data, data_size, file, line);
-
      PtraceDisplayBytes(req, data, data_size);

      errno = 0;
@@ -176,6 +172,10 @@
      else
          result = ptrace(static_cast<__ptrace_request>(req), pid, addr, data);

+    if (log)
+        log->Printf("ptrace(%s, %lu, %p, %p, %zu)=%lX called from file %s line %d",
+                    reqName, static_cast<long>(pid), addr, data, data_size, result, file, line);
+
      PtraceDisplayBytes(req, data, data_size);

      if (log && errno != 0)





Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Keep up to date with CSR on our technical blog, www.csr.com/blog, CSR people blog, www.csr.com/people, YouTube, www.youtube.com/user/CSRplc, Facebook, www.facebook.com/pages/CSR/191038434253534, or follow us on Twitter at www.twitter.com/CSR_plc.
New for 2014, you can now access the wide range of products powered by aptX at www.aptx.com.



More information about the lldb-commits mailing list