diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp index d9d399c5eff7..f2a74b05fe26 100644 --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -103,11 +103,13 @@ ObjectContainerBSDArchive::Object::Extract (const DataExtractor& data, lldb::off } else { - // Strip off any spaces (if the object file name contains spaces it - // will use the extended format above). - const size_t space_pos = str.find(' '); - if (space_pos != std::string::npos) - str.erase (space_pos); + // Strip off any trailing spaces. + const size_t last_pos = str.find_last_not_of(' '); + if (last_pos != std::string::npos) + { + if (last_pos + 1 < 16) + str.erase (last_pos + 1); + } ar_name.SetCString(str.c_str()); }