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
TeamDebugger::FunctionSourceCodeRequested(FunctionInstance* functionInstance,
bool forceDisassembly)
@@ -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,
@@ -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)
@@ -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);
+8
View File
@@ -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 {
@@ -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,
@@ -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;