Extend FunctionSourceCodeRequested().
Now takes an optional boolean parameter to indicate that disassembly is explicitly being requested. Adjust TeamDebugger and LoadSourceCodeJob's implementations accordingly.
This commit is contained in:
parent
26a4510e59
commit
442f71a7d9
|
@ -762,22 +762,27 @@ TeamDebugger::SourceEntryLocateRequested(const char* sourcePath,
|
|||
|
||||
|
||||
void
|
||||
TeamDebugger::FunctionSourceCodeRequested(FunctionInstance* functionInstance)
|
||||
TeamDebugger::FunctionSourceCodeRequested(FunctionInstance* functionInstance,
|
||||
bool forceDisassembly)
|
||||
{
|
||||
Function* function = functionInstance->GetFunction();
|
||||
|
||||
// mark loading
|
||||
AutoLocker< ::Team> locker(fTeam);
|
||||
|
||||
if (functionInstance->SourceCodeState() != FUNCTION_SOURCE_NOT_LOADED)
|
||||
if (forceDisassembly && functionInstance->SourceCodeState()
|
||||
!= FUNCTION_SOURCE_NOT_LOADED) {
|
||||
return;
|
||||
if (function->SourceCodeState() == FUNCTION_SOURCE_LOADED)
|
||||
} else if (!forceDisassembly && function->SourceCodeState()
|
||||
== FUNCTION_SOURCE_LOADED) {
|
||||
return;
|
||||
}
|
||||
|
||||
functionInstance->SetSourceCode(NULL, FUNCTION_SOURCE_LOADING);
|
||||
|
||||
bool loadForFunction = false;
|
||||
if (function->SourceCodeState() == FUNCTION_SOURCE_NOT_LOADED) {
|
||||
if (!forceDisassembly && function->SourceCodeState()
|
||||
== FUNCTION_SOURCE_NOT_LOADED) {
|
||||
loadForFunction = true;
|
||||
function->SetSourceCode(NULL, FUNCTION_SOURCE_LOADING);
|
||||
}
|
||||
|
|
|
@ -59,7 +59,8 @@ public:
|
|||
private:
|
||||
// UserInterfaceListener
|
||||
virtual void FunctionSourceCodeRequested(
|
||||
FunctionInstance* function);
|
||||
FunctionInstance* function,
|
||||
bool forceDisassembly = false);
|
||||
virtual void SourceEntryLocateRequested(
|
||||
const char* sourcePath,
|
||||
const char* locatedPath);
|
||||
|
|
|
@ -82,6 +82,18 @@ LoadSourceCodeJob::Do()
|
|||
locker.Lock();
|
||||
if (error == B_OK) {
|
||||
if (fFunctionInstance->SourceCodeState() == FUNCTION_SOURCE_LOADING) {
|
||||
// various parts of the debugger expect functions to have only
|
||||
// one of source or disassembly available. As such, if the current
|
||||
// function had source code previously active, unset it when
|
||||
// explicitly asked for disassembly. This needs to be done first
|
||||
// since Function will clear the disassembled code states of all
|
||||
// its child instances.
|
||||
if (function->SourceCodeState() == FUNCTION_SOURCE_LOADED) {
|
||||
FileSourceCode* sourceCode = function->GetSourceCode();
|
||||
function->SetSourceCode(sourceCode,
|
||||
FUNCTION_SOURCE_NOT_LOADED);
|
||||
}
|
||||
|
||||
fFunctionInstance->SetSourceCode(sourceCode,
|
||||
FUNCTION_SOURCE_LOADED);
|
||||
sourceCode->ReleaseReference();
|
||||
|
|
|
@ -82,7 +82,8 @@ public:
|
|||
virtual ~UserInterfaceListener();
|
||||
|
||||
virtual void FunctionSourceCodeRequested(
|
||||
FunctionInstance* function) = 0;
|
||||
FunctionInstance* function,
|
||||
bool forceDisassembly = false) = 0;
|
||||
virtual void SourceEntryLocateRequested(
|
||||
const char* sourcePath,
|
||||
const char* locatedPath) = 0;
|
||||
|
|
Loading…
Reference in New Issue