summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Maste <emaste@freebsd.org>2018-04-21 11:23:56 +0000
committerEd Maste <emaste@freebsd.org>2018-04-21 11:23:56 +0000
commit592d29a3b9652265ccdfc10bd24f91b85e8a5939 (patch)
tree74578c748ff3fd2cff4a91b837c0b37fdae7324b
parent1264066cd789ff4adf4213b731ce938d7ef5b1a5 (diff)
downloadbcm5719-llvm-592d29a3b9652265ccdfc10bd24f91b85e8a5939.tar.gz
bcm5719-llvm-592d29a3b9652265ccdfc10bd24f91b85e8a5939.zip
FreeBSD: propagate error to user if memory access fails
Previously, an attempt to read an unreadable address reported zeros. Now, if DoReadMemory or DoWriteMemory encounters error then return 0 (bytes read or written) so that the error is reported to the user. llvm.org/pr37190 llvm-svn: 330500
-rw-r--r--lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp b/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
index 839fc33c8d9..feba3af8fcf 100644
--- a/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
+++ b/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
@@ -159,8 +159,10 @@ static size_t DoReadMemory(lldb::pid_t pid, lldb::addr_t vm_addr, void *buf,
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;
}
@@ -173,8 +175,10 @@ static size_t DoWriteMemory(lldb::pid_t pid, lldb::addr_t vm_addr,
pi_desc.piod_addr = (void *)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;
}
OpenPOWER on IntegriCloud