Author: gclayton Date: Thu Aug 13 19:18:52 2015 New Revision: 244992 URL: http://llvm.org/viewvc/llvm-project?rev=244992&view=rev Log: Add a better fix for searching for spaces in BSD archive object names where we only trim trailing spaces.
I made an example where I had a file named "testtesttestt .o" (16 chars) that I was able to put into a .a file and we would previously truncate the object name to "testtesttestt" since we searched for any space in the name. I believe the BSD archive docs say that filenames with spaces will use the extended format, but our current libtool doesn't so I wanted to fix it by only removing trailing spaces. Modified: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp Modified: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp?rev=244992&r1=244991&r2=244992&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp (original) +++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp Thu Aug 13 19:18:52 2015 @@ -103,11 +103,13 @@ ObjectContainerBSDArchive::Object::Extra } 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()); } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits