Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Apr 2018 00:34:46 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r332849 - head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD
Message-ID:  <201804210034.w3L0Yk1L061067@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Sat Apr 21 00:34:46 2018
New Revision: 332849
URL: https://svnweb.freebsd.org/changeset/base/332849

Log:
  lldb: propagate error to user if memory read fails
  
  Previously, an attempt to read an unreadable access reported zeros:
  
  (lldb) memory read -format hex -size 8 0
  0x00000000: 0x0000000000000000 0x0000000000000000
  0x00000010: 0x0000000000000000 0x0000000000000000
  ...
  
  Now, if DoReadMemory encounters error then return 0 (bytes read) so we
  report the error to the user:
  
  (lldb) memory read -format hex -size 8 0
  error: Bad address
  
  LLVM PR:	37190
  
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp

Modified: head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
==============================================================================
--- head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp	Sat Apr 21 00:27:35 2018	(r332848)
+++ head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp	Sat Apr 21 00:34:46 2018	(r332849)
@@ -163,8 +163,10 @@ static size_t DoReadMemory(lldb::pid_t pid, lldb::addr
   pi_desc.piod_addr = buf;
   pi_desc.piod_len = size;
 
-  if (PTRACE(PT_IO, pid, (caddr_t)&pi_desc, 0) < 0)
+  if (PTRACE(PT_IO, pid, (caddr_t)&pi_desc, 0) < 0) {
     error.SetErrorToErrno();
+    return 0;
+  }
   return pi_desc.piod_len;
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804210034.w3L0Yk1L061067>