[Lldb-commits] [lldb] r364748 - Fix TestGdbRemoteLibrariesSvr4Support

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 1 05:00:25 PDT 2019

Author: labath
Date: Mon Jul  1 05:00:25 2019
New Revision: 364748

URL: http://llvm.org/viewvc/llvm-project?rev=364748&view=rev
Fix TestGdbRemoteLibrariesSvr4Support

D62502 had a bug (visible only with D62503 reverted), where it would
error out if attempting to read a string from memory and the memory page
after the string happened to be unmapped.

This fixes the problem by checking for whether ReadMemory read *any*
bytes, instead of checking whether it returned an error. A greater
question is whether ReadMemory should even return an error if it read at
least one byte, but I'm leaving that for a separate patch.


Modified: lldb/trunk/source/Plugins/Process/POSIX/NativeProcessELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/NativeProcessELF.cpp?rev=364748&r1=364747&r2=364748&view=diff
--- lldb/trunk/source/Plugins/Process/POSIX/NativeProcessELF.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/NativeProcessELF.cpp Mon Jul  1 05:00:25 2019
@@ -120,7 +120,7 @@ NativeProcessELF::ReadSVR4LibraryInfo(ll
   char name_buffer[PATH_MAX];
   error = ReadMemory(link_map.l_name, &name_buffer, sizeof(name_buffer),
-  if (!error.Success())
+  if (bytes_read == 0)
     return error.ToError();
   name_buffer[PATH_MAX - 1] = '\0';
@@ -176,4 +176,4 @@ NativeProcessELF::GetLoadedSVR4Libraries
   return library_list;
-} // namespace lldb_private
\ No newline at end of file
+} // namespace lldb_private

More information about the lldb-commits mailing list