* Added classes to represent source code (SourceCode, Statement).
* Added x86 disassembler (via libudis86). * Added Architecture::DisassembleCode() to disassemble a function to SourceCode. * Added virtual DebugInfo::LoadSourceCode() to retrieve the source code for a given function. The implementation in DebuggerDebugInfo disassembles the function. * Added source code info to StackFrame. Also added a listener mechanism to get notified on source code changes. * Added job to load the source code for a stack frame. * Added (very basic) source code view and wired everything so that when a stack frame is selected the source code (respectively disassembly) for the underlying function is retrieved and shown. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31158 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -8,6 +8,10 @@
|
||||
#include "CpuState.h"
|
||||
#include "FunctionDebugInfo.h"
|
||||
#include "Image.h"
|
||||
#include "SourceCode.h"
|
||||
|
||||
|
||||
// #pragma mark - StackFrame
|
||||
|
||||
|
||||
StackFrame::StackFrame(stack_frame_type type, CpuState* cpuState,
|
||||
@@ -18,7 +22,9 @@ StackFrame::StackFrame(stack_frame_type type, CpuState* cpuState,
|
||||
fFrameAddress(frameAddress),
|
||||
fReturnAddress(0),
|
||||
fImage(NULL),
|
||||
fFunction(NULL)
|
||||
fFunction(NULL),
|
||||
fSourceCode(NULL),
|
||||
fSourceCodeState(STACK_SOURCE_NOT_LOADED)
|
||||
{
|
||||
fCpuState->AddReference();
|
||||
}
|
||||
@@ -26,6 +32,7 @@ StackFrame::StackFrame(stack_frame_type type, CpuState* cpuState,
|
||||
|
||||
StackFrame::~StackFrame()
|
||||
{
|
||||
SetSourceCode(NULL, STACK_SOURCE_NOT_LOADED);
|
||||
SetImage(NULL);
|
||||
SetFunction(NULL);
|
||||
fCpuState->RemoveReference();
|
||||
@@ -70,3 +77,51 @@ StackFrame::SetFunction(FunctionDebugInfo* function)
|
||||
if (fFunction != NULL)
|
||||
fFunction->AddReference();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StackFrame::SetSourceCode(SourceCode* source, stack_frame_source_state state)
|
||||
{
|
||||
if (fSourceCode != NULL)
|
||||
fSourceCode->RemoveReference();
|
||||
|
||||
fSourceCode = source;
|
||||
fSourceCodeState = state;
|
||||
|
||||
if (fSourceCode != NULL)
|
||||
fSourceCode->AddReference();
|
||||
|
||||
// notify listeners
|
||||
for (ListenerList::Iterator it = fListeners.GetIterator();
|
||||
Listener* listener = it.Next();) {
|
||||
listener->StackFrameSourceCodeChanged(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StackFrame::AddListener(Listener* listener)
|
||||
{
|
||||
fListeners.Add(listener);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StackFrame::RemoveListener(Listener* listener)
|
||||
{
|
||||
fListeners.Remove(listener);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - Listener
|
||||
|
||||
|
||||
StackFrame::Listener::~Listener()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StackFrame::Listener::StackFrameSourceCodeChanged(StackFrame* frame)
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user