From a61e0d36a092ee71873c178b13a8688aabcda511 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 3 Jul 2009 14:46:10 +0000 Subject: [PATCH] Apparently the file names in the .debug_line section can be relative paths, not only file names. Changed the FileManager::Get*File() method versions taking directory path and file name to also accept relative file paths. They just join the paths and use the single-argument versions, which now does all the work. Fixes finding source files for which a relative path is given in .debug_line. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31394 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/debugger/files/FileManager.cpp | 35 ++++++++++++++----------- src/apps/debugger/files/FileManager.h | 4 +-- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/apps/debugger/files/FileManager.cpp b/src/apps/debugger/files/FileManager.cpp index 3cf0eb4cc4..3983475b00 100644 --- a/src/apps/debugger/files/FileManager.cpp +++ b/src/apps/debugger/files/FileManager.cpp @@ -124,11 +124,20 @@ public: return B_OK; } - LocatableFile* GetFile(const BString& directoryPath, const BString& name) + LocatableFile* GetFile(const BString& directoryPath, + const BString& relativePath) { - BString normalizedDirectoryPath; - _NormalizePath(directoryPath, normalizedDirectoryPath); - LocatableFile* file = _GetFile(normalizedDirectoryPath, name); + if (directoryPath.Length() == 0) + return GetFile(relativePath); + return GetFile(BString(directoryPath) << '/' << relativePath); + } + + LocatableFile* GetFile(const BString& path) + { + BString directoryPath; + BString name; + _SplitPath(path, directoryPath, name); + LocatableFile* file = _GetFile(directoryPath, name); if (file == NULL) return NULL; @@ -150,14 +159,6 @@ public: return file; } - LocatableFile* GetFile(const BString& path) - { - BString directoryPath; - BString name; - _SplitPath(path, directoryPath, name); - return _GetFile(directoryPath, name); - } - void EntryLocated(const BString& path, const BString& locatedPath) { BString directory; @@ -580,10 +581,11 @@ FileManager::Init(bool targetIsLocal) LocatableFile* -FileManager::GetTargetFile(const BString& directory, const BString& name) +FileManager::GetTargetFile(const BString& directory, + const BString& relativePath) { AutoLocker locker(this); - return fTargetDomain->GetFile(directory, name); + return fTargetDomain->GetFile(directory, relativePath); } @@ -604,10 +606,11 @@ FileManager::TargetEntryLocated(const BString& path, const BString& locatedPath) LocatableFile* -FileManager::GetSourceFile(const BString& directory, const BString& name) +FileManager::GetSourceFile(const BString& directory, + const BString& relativePath) { AutoLocker locker(this); - return fSourceDomain->GetFile(directory, name); + return fSourceDomain->GetFile(directory, relativePath); } diff --git a/src/apps/debugger/files/FileManager.h b/src/apps/debugger/files/FileManager.h index 89d2ff26e1..6ff7edf7ac 100644 --- a/src/apps/debugger/files/FileManager.h +++ b/src/apps/debugger/files/FileManager.h @@ -26,7 +26,7 @@ public: void Unlock() { fLock.Unlock(); } LocatableFile* GetTargetFile(const BString& directory, - const BString& name); + const BString& relativePath); // returns a reference LocatableFile* GetTargetFile(const BString& path); // returns a reference @@ -34,7 +34,7 @@ public: const BString& locatedPath); LocatableFile* GetSourceFile(const BString& directory, - const BString& name); + const BString& relativePath); // returns a reference LocatableFile* GetSourceFile(const BString& path); // returns a reference