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.
This commit is contained in:
parent
c848949bf1
commit
efcb3de14e
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user