hrev47766 adds 1 changeset to branch 'master' old head: 8ee781bf7b60186ca4e6ae8593ad85012d19d80a new head: 432da9e337cd73bf024331fa048e4aec12dcbd5b overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=432da9e+%5E8ee781b ---------------------------------------------------------------------------- 432da9e: Debugger: Implement remaining part of #11033. TeamDebugInfo: - Add function to invalidate a source entry's file mapping. UserInterfaceListener: - Add listener hook to be able to invoke the aforementioned invalidate. Add corresponding implementation in TeamDebugger. FileManager: - When asked to locate a source entry, invalidate any existing mapping first. TeamWindow: - Always allow choosing an alternate source file. - If we already have an existing source mapping, invalidate it first before attempting to establish a new one. [ Rene Gollent <rene@xxxxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev47766 Commit: 432da9e337cd73bf024331fa048e4aec12dcbd5b URL: http://cgit.haiku-os.org/haiku/commit/?id=432da9e Author: Rene Gollent <rene@xxxxxxxxxxx> Date: Fri Aug 29 14:55:45 2014 UTC Ticket: https://dev.haiku-os.org/ticket/11033 ---------------------------------------------------------------------------- 7 files changed, 40 insertions(+), 2 deletions(-) src/apps/debugger/controllers/TeamDebugger.cpp | 9 +++++++++ src/apps/debugger/controllers/TeamDebugger.h | 2 ++ src/apps/debugger/debug_info/TeamDebugInfo.cpp | 11 +++++++++++ src/apps/debugger/debug_info/TeamDebugInfo.h | 2 ++ src/apps/debugger/files/FileManager.cpp | 8 ++++++++ src/apps/debugger/user_interface/UserInterface.h | 3 +++ .../user_interface/gui/team_window/TeamWindow.cpp | 7 +++++-- ---------------------------------------------------------------------------- diff --git a/src/apps/debugger/controllers/TeamDebugger.cpp b/src/apps/debugger/controllers/TeamDebugger.cpp index d084e22..d551bd0 100644 --- a/src/apps/debugger/controllers/TeamDebugger.cpp +++ b/src/apps/debugger/controllers/TeamDebugger.cpp @@ -821,6 +821,15 @@ TeamDebugger::SourceEntryLocateRequested(const char* sourcePath, void +TeamDebugger::SourceEntryInvalidateRequested(LocatableFile* sourceFile) +{ + AutoLocker< ::Team> locker(fTeam); + + fTeam->DebugInfo()->ClearSourceCode(sourceFile); +} + + +void TeamDebugger::FunctionSourceCodeRequested(FunctionInstance* functionInstance, bool forceDisassembly) { diff --git a/src/apps/debugger/controllers/TeamDebugger.h b/src/apps/debugger/controllers/TeamDebugger.h index 46fa880..d48c848 100644 --- a/src/apps/debugger/controllers/TeamDebugger.h +++ b/src/apps/debugger/controllers/TeamDebugger.h @@ -66,6 +66,8 @@ private: virtual void SourceEntryLocateRequested( const char* sourcePath, const char* locatedPath); + virtual void SourceEntryInvalidateRequested( + LocatableFile* sourceFile); virtual void ImageDebugInfoRequested(Image* image); virtual void ValueNodeValueRequested(CpuState* cpuState, ValueNodeContainer* container, diff --git a/src/apps/debugger/debug_info/TeamDebugInfo.cpp b/src/apps/debugger/debug_info/TeamDebugInfo.cpp index 00b174e..1cdb193 100644 --- a/src/apps/debugger/debug_info/TeamDebugInfo.cpp +++ b/src/apps/debugger/debug_info/TeamDebugInfo.cpp @@ -546,6 +546,17 @@ TeamDebugInfo::LoadSourceCode(LocatableFile* file, FileSourceCode*& _sourceCode) } +void +TeamDebugInfo::ClearSourceCode(LocatableFile* sourceFile) +{ + AutoLocker<BLocker> locker(fLock); + + SourceFileEntry* entry = fSourceFiles->Lookup(sourceFile); + if (entry != NULL) + entry->SetSourceCode(NULL); +} + + status_t TeamDebugInfo::DisassembleFunction(FunctionInstance* functionInstance, DisassembledCode*& _sourceCode) diff --git a/src/apps/debugger/debug_info/TeamDebugInfo.h b/src/apps/debugger/debug_info/TeamDebugInfo.h index 884a1a3..b3dff5e 100644 --- a/src/apps/debugger/debug_info/TeamDebugInfo.h +++ b/src/apps/debugger/debug_info/TeamDebugInfo.h @@ -62,6 +62,8 @@ public: status_t LoadSourceCode(LocatableFile* file, FileSourceCode*& _sourceCode); // returns reference + void ClearSourceCode(LocatableFile* file); + status_t DisassembleFunction( FunctionInstance* functionInstance, DisassembledCode*& _sourceCode); diff --git a/src/apps/debugger/files/FileManager.cpp b/src/apps/debugger/files/FileManager.cpp index 797437e..33be50f 100644 --- a/src/apps/debugger/files/FileManager.cpp +++ b/src/apps/debugger/files/FileManager.cpp @@ -646,6 +646,14 @@ FileManager::SourceEntryLocated(const BString& path, const BString& locatedPath) { AutoLocker<FileManager> locker(this); + + // check if we already have this path mapped. If so, + // first clear the mapping, as the user may be attempting + // to correct an existing entry. + SourceFileEntry* entry = _LookupSourceFile(path); + if (entry != NULL) + _SourceFileUnused(entry); + fSourceDomain->EntryLocated(path, locatedPath); try { diff --git a/src/apps/debugger/user_interface/UserInterface.h b/src/apps/debugger/user_interface/UserInterface.h index 5eb9c2b..50e293e 100644 --- a/src/apps/debugger/user_interface/UserInterface.h +++ b/src/apps/debugger/user_interface/UserInterface.h @@ -20,6 +20,7 @@ class entry_ref; class CpuState; class FunctionInstance; class Image; +class LocatableFile; class StackFrame; class Team; class TeamUiSettings; @@ -92,6 +93,8 @@ public: virtual void SourceEntryLocateRequested( const char* sourcePath, const char* locatedPath) = 0; + virtual void SourceEntryInvalidateRequested( + LocatableFile* sourceFile) = 0; virtual void ImageDebugInfoRequested(Image* image) = 0; virtual void ValueNodeValueRequested(CpuState* cpuState, ValueNodeContainer* container, diff --git a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp index c10c694..c554974 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp @@ -1620,6 +1620,11 @@ TeamWindow::_HandleResolveMissingSourceFile(entry_ref& locatedPath) if (choice <= 0) return; } + + LocatableFile* foundSourceFile = fActiveSourceCode + ->GetSourceFile(); + if (foundSourceFile != NULL) + fListener->SourceEntryInvalidateRequested(foundSourceFile); fListener->SourceEntryLocateRequested(sourcePath, targetFilePath.Path()); fListener->FunctionSourceCodeRequested(fActiveFunction); @@ -1637,8 +1642,6 @@ TeamWindow::_HandleLocateSourceRequest(BStringList* entries) return; else if (fActiveSourceCode == NULL) return; - else if (fActiveSourceCode->GetSourceFile() != NULL) - return; else if (fActiveFunction->GetFunction()->SourceCodeState() == FUNCTION_SOURCE_NOT_LOADED) { return;