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.
This commit is contained in:
Rene Gollent
2014-08-29 11:04:48 -04:00
parent 8ee781bf7b
commit 432da9e337
7 changed files with 40 additions and 2 deletions
@@ -820,6 +820,15 @@ TeamDebugger::SourceEntryLocateRequested(const char* sourcePath,
} }
void
TeamDebugger::SourceEntryInvalidateRequested(LocatableFile* sourceFile)
{
AutoLocker< ::Team> locker(fTeam);
fTeam->DebugInfo()->ClearSourceCode(sourceFile);
}
void void
TeamDebugger::FunctionSourceCodeRequested(FunctionInstance* functionInstance, TeamDebugger::FunctionSourceCodeRequested(FunctionInstance* functionInstance,
bool forceDisassembly) bool forceDisassembly)
@@ -66,6 +66,8 @@ private:
virtual void SourceEntryLocateRequested( virtual void SourceEntryLocateRequested(
const char* sourcePath, const char* sourcePath,
const char* locatedPath); const char* locatedPath);
virtual void SourceEntryInvalidateRequested(
LocatableFile* sourceFile);
virtual void ImageDebugInfoRequested(Image* image); virtual void ImageDebugInfoRequested(Image* image);
virtual void ValueNodeValueRequested(CpuState* cpuState, virtual void ValueNodeValueRequested(CpuState* cpuState,
ValueNodeContainer* container, ValueNodeContainer* container,
@@ -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 status_t
TeamDebugInfo::DisassembleFunction(FunctionInstance* functionInstance, TeamDebugInfo::DisassembleFunction(FunctionInstance* functionInstance,
DisassembledCode*& _sourceCode) DisassembledCode*& _sourceCode)
@@ -62,6 +62,8 @@ public:
status_t LoadSourceCode(LocatableFile* file, status_t LoadSourceCode(LocatableFile* file,
FileSourceCode*& _sourceCode); FileSourceCode*& _sourceCode);
// returns reference // returns reference
void ClearSourceCode(LocatableFile* file);
status_t DisassembleFunction( status_t DisassembleFunction(
FunctionInstance* functionInstance, FunctionInstance* functionInstance,
DisassembledCode*& _sourceCode); DisassembledCode*& _sourceCode);
+8
View File
@@ -646,6 +646,14 @@ FileManager::SourceEntryLocated(const BString& path,
const BString& locatedPath) const BString& locatedPath)
{ {
AutoLocker<FileManager> locker(this); 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); fSourceDomain->EntryLocated(path, locatedPath);
try { try {
@@ -20,6 +20,7 @@ class entry_ref;
class CpuState; class CpuState;
class FunctionInstance; class FunctionInstance;
class Image; class Image;
class LocatableFile;
class StackFrame; class StackFrame;
class Team; class Team;
class TeamUiSettings; class TeamUiSettings;
@@ -92,6 +93,8 @@ public:
virtual void SourceEntryLocateRequested( virtual void SourceEntryLocateRequested(
const char* sourcePath, const char* sourcePath,
const char* locatedPath) = 0; const char* locatedPath) = 0;
virtual void SourceEntryInvalidateRequested(
LocatableFile* sourceFile) = 0;
virtual void ImageDebugInfoRequested(Image* image) = 0; virtual void ImageDebugInfoRequested(Image* image) = 0;
virtual void ValueNodeValueRequested(CpuState* cpuState, virtual void ValueNodeValueRequested(CpuState* cpuState,
ValueNodeContainer* container, ValueNodeContainer* container,
@@ -1620,6 +1620,11 @@ TeamWindow::_HandleResolveMissingSourceFile(entry_ref& locatedPath)
if (choice <= 0) if (choice <= 0)
return; return;
} }
LocatableFile* foundSourceFile = fActiveSourceCode
->GetSourceFile();
if (foundSourceFile != NULL)
fListener->SourceEntryInvalidateRequested(foundSourceFile);
fListener->SourceEntryLocateRequested(sourcePath, fListener->SourceEntryLocateRequested(sourcePath,
targetFilePath.Path()); targetFilePath.Path());
fListener->FunctionSourceCodeRequested(fActiveFunction); fListener->FunctionSourceCodeRequested(fActiveFunction);
@@ -1637,8 +1642,6 @@ TeamWindow::_HandleLocateSourceRequest(BStringList* entries)
return; return;
else if (fActiveSourceCode == NULL) else if (fActiveSourceCode == NULL)
return; return;
else if (fActiveSourceCode->GetSourceFile() != NULL)
return;
else if (fActiveFunction->GetFunction()->SourceCodeState() else if (fActiveFunction->GetFunction()->SourceCodeState()
== FUNCTION_SOURCE_NOT_LOADED) { == FUNCTION_SOURCE_NOT_LOADED) {
return; return;