diff options
| author | Greg Clayton <gclayton@apple.com> | 2015-08-14 00:18:52 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2015-08-14 00:18:52 +0000 |
| commit | 5da0dde965f7633bc81699a5a45b634146882bc6 (patch) | |
| tree | 5738769efca4203d6f7a72cbb745838f5fec085e /lldb/source/Plugins/ObjectContainer | |
| parent | 34fa813d9b972ad2743b36e0840b031138b8657d (diff) | |
| download | bcm5719-llvm-5da0dde965f7633bc81699a5a45b634146882bc6.tar.gz bcm5719-llvm-5da0dde965f7633bc81699a5a45b634146882bc6.zip | |
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.
llvm-svn: 244992
Diffstat (limited to 'lldb/source/Plugins/ObjectContainer')
| -rw-r--r-- | lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp index d9d399c5eff..f2a74b05fe2 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()); } |

