added 2 changesets to branch 'refs/remotes/HaikuPM-github/package-management' old head: c848949bf19ed8bd74da1f54428d43a469b58dca new head: 1c521f0b311686a352b2f57aa12bd53dc5dbdced overview: https://github.com/haiku/HaikuPM/compare/c848949...1c521f0 ---------------------------------------------------------------------------- efcb3de: Debugger: Fix #9961. - The previous solution was applying source path mappings too early, with the consequence that the file manager would incorrectly adjust some relocations due to not being aware of the presence of all the possible parent paths yet, leading to the observed "Source not available" behavior when restoring some combinations of mappings. We now lazily apply the mappings at the point when the source code itself is actually requested to be loaded, which doesn't occur until after all image loading, etc. has completed, so the information map is complete. [ Rene Gollent <anevilyak@xxxxxxxxx> ] 1c521f0: BString::Split(): Fix check [ Ingo Weinhold <ingo_weinhold@xxxxxx> ] ---------------------------------------------------------------------------- 2 files changed, 22 insertions(+), 18 deletions(-) src/apps/debugger/files/FileManager.cpp | 38 ++++++++++++++++------------- src/kits/support/String.cpp | 2 +- ############################################################################ Commit: efcb3de14e69170079b8302c5ff204e6aad4752d Author: Rene Gollent <anevilyak@xxxxxxxxx> Date: Thu Sep 19 18:55:18 2013 UTC Ticket: https://dev.haiku-os.org/ticket/9961 Debugger: Fix #9961. - The previous solution was applying source path mappings too early, with the consequence that the file manager would incorrectly adjust some relocations due to not being aware of the presence of all the possible parent paths yet, leading to the observed "Source not available" behavior when restoring some combinations of mappings. We now lazily apply the mappings at the point when the source code itself is actually requested to be loaded, which doesn't occur until after all image loading, etc. has completed, so the information map is complete. ---------------------------------------------------------------------------- diff --git a/src/apps/debugger/files/FileManager.cpp b/src/apps/debugger/files/FileManager.cpp index e389fe9..797437e 100644 --- a/src/apps/debugger/files/FileManager.cpp +++ b/src/apps/debugger/files/FileManager.cpp @@ -627,11 +627,6 @@ FileManager::GetSourceFile(const BString& directory, AutoLocker<FileManager> locker(this); LocatableFile* file = fSourceDomain->GetFile(directory, relativePath); - if (directory.Length() == 0 || relativePath[0] == '/') - _LocateFileIfMapped(relativePath, file); - else - _LocateFileIfMapped(BString(directory) << '/' << relativePath, file); - return file; } @@ -641,7 +636,6 @@ FileManager::GetSourceFile(const BString& path) { AutoLocker<FileManager> locker(this); LocatableFile* file = fSourceDomain->GetFile(path); - _LocateFileIfMapped(path, file); return file; } @@ -671,11 +665,18 @@ FileManager::LoadSourceFile(LocatableFile* file, SourceFile*& _sourceFile) // get the path BString path; - if (!file->GetLocatedPath(path)) - return B_ENTRY_NOT_FOUND; + BString originalPath; + file->GetPath(originalPath); + if (!file->GetLocatedPath(path)) { + // see if this is a file we have a lazy mapping for. + if (!_LocateFileIfMapped(originalPath, file) + || !file->GetLocatedPath(path)) { + return B_ENTRY_NOT_FOUND; + } + } // we might already know the source file - SourceFileEntry* entry = _LookupSourceFile(path); + SourceFileEntry* entry = _LookupSourceFile(originalPath); if (entry != NULL) { entry->file->AcquireReference(); _sourceFile = entry->file; @@ -683,7 +684,7 @@ FileManager::LoadSourceFile(LocatableFile* file, SourceFile*& _sourceFile) } // create the hash table entry - entry = new(std::nothrow) SourceFileEntry(this, path); + entry = new(std::nothrow) SourceFileEntry(this, originalPath); if (entry == NULL) return B_NO_MEMORY; @@ -711,7 +712,6 @@ FileManager::LoadSourceFile(LocatableFile* file, SourceFile*& _sourceFile) status_t FileManager::LoadLocationMappings(TeamFileManagerSettings* settings) { -#if 0 AutoLocker<FileManager> locker(this); for (int32 i = 0; i < settings->CountSourceMappings(); i++) { BString sourcePath; @@ -726,7 +726,7 @@ FileManager::LoadLocationMappings(TeamFileManagerSettings* settings) return B_NO_MEMORY; } } -#endif + return B_OK; } @@ -734,7 +734,6 @@ FileManager::LoadLocationMappings(TeamFileManagerSettings* settings) status_t FileManager::SaveLocationMappings(TeamFileManagerSettings* settings) { -#if 0 AutoLocker<FileManager> locker(this); for (LocatedFileMap::const_iterator it = fSourceLocationMappings.begin(); @@ -743,7 +742,7 @@ FileManager::SaveLocationMappings(TeamFileManagerSettings* settings) if (error != B_OK) return error; } -#endif + return B_OK; } @@ -776,15 +775,20 @@ FileManager::_SourceFileUnused(SourceFileEntry* entry) } -void +bool FileManager::_LocateFileIfMapped(const BString& sourcePath, LocatableFile* file) { // called with lock held + LocatedFileMap::const_iterator it = fSourceLocationMappings.find( sourcePath); if (it != fSourceLocationMappings.end() - && file->State() != LOCATABLE_ENTRY_LOCATED_EXPLICITLY) { - fSourceDomain->EntryLocated(it->first, it->second); + && file->State() != LOCATABLE_ENTRY_LOCATED_EXPLICITLY + && file->State() != LOCATABLE_ENTRY_LOCATED_IMPLICITLY) { + fSourceDomain->EntryLocated(it->first, it->second); + return true; } + + return false; } ############################################################################ Commit: 1c521f0b311686a352b2f57aa12bd53dc5dbdced Author: Ingo Weinhold <ingo_weinhold@xxxxxx> Date: Thu Sep 19 18:55:23 2013 UTC BString::Split(): Fix check ---------------------------------------------------------------------------- diff --git a/src/kits/support/String.cpp b/src/kits/support/String.cpp index e29e082..56b6084 100644 --- a/src/kits/support/String.cpp +++ b/src/kits/support/String.cpp @@ -546,7 +546,7 @@ BString::Split(const char* separator, bool noEmptyStrings, if (endIndex > index || !noEmptyStrings) { BString toAppend(String() + index, endIndex - index); if (toAppend.Length() != endIndex - index - || _list.Add(toAppend)) { + || !_list.Add(toAppend)) { return false; } }