diff options
Diffstat (limited to 'lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp b/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp index 50b2d05df3e..6470eca7746 100644 --- a/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp +++ b/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp @@ -118,14 +118,13 @@ NativeProcessELF::ReadSVR4LibraryInfo(lldb::addr_t link_map_addr) { return error.ToError(); char name_buffer[PATH_MAX]; - error = ReadMemory(link_map.l_name, &name_buffer, sizeof(name_buffer), - bytes_read); - if (bytes_read == 0) - return error.ToError(); - name_buffer[PATH_MAX - 1] = '\0'; + llvm::Expected<llvm::StringRef> string_or_error = ReadCStringFromMemory( + link_map.l_name, &name_buffer[0], sizeof(name_buffer), bytes_read); + if (!string_or_error) + return string_or_error.takeError(); SVR4LibraryInfo info; - info.name = std::string(name_buffer); + info.name = string_or_error->str(); info.link_map = link_map_addr; info.base_addr = link_map.l_addr; info.ld_addr = link_map.l_ld; |