mirror of
https://review.haiku-os.org/haiku
synced 2025-02-12 00:28:19 +01:00
* Added a virtual Architecture::CreateStackTrace() and added a basic implementation in ArchitectureX86. Fleshed out StackTrace/StackFrame a bit and added StackFrameX86. This needs to be organized differently, though, so that we can get the maximum available information for each stack frame, depending on what info is available for the respective function. * Added job to get the stack trace for a thread. * Added stack trace related handling in TeamDebugger. Reorganized the thread state/CPU state/stack trace change handling a bit -- we're using a Team::Listener now, and do things asynchronously. * Added a StackTraceView to display the stack trace of the current thread. No function name available yet, otherwise working fine. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31126 a95241bf-73f2-0310-859d-f6bbb57e9c96
109 lines
2.9 KiB
C++
109 lines
2.9 KiB
C++
/*
|
|
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef TEAM_DEBUGGER_H
|
|
#define TEAM_DEBUGGER_H
|
|
|
|
#include <debugger.h>
|
|
#include <Looper.h>
|
|
|
|
#include <debug_support.h>
|
|
|
|
#include "DebugEvent.h"
|
|
#include "Team.h"
|
|
#include "TeamWindow.h"
|
|
#include "Worker.h"
|
|
|
|
|
|
class DebuggerInterface;
|
|
class TeamDebugModel;
|
|
|
|
|
|
class TeamDebugger : private BLooper, private TeamWindow::Listener,
|
|
private JobListener, private Team::Listener {
|
|
public:
|
|
TeamDebugger();
|
|
~TeamDebugger();
|
|
|
|
status_t Init(team_id teamID, thread_id threadID,
|
|
bool stopInMain);
|
|
|
|
team_id TeamID() const { return fTeamID; }
|
|
|
|
private:
|
|
virtual void MessageReceived(BMessage* message);
|
|
|
|
// TeamWindow::Listener
|
|
virtual void ThreadActionRequested(TeamWindow* window,
|
|
thread_id threadID, uint32 action);
|
|
virtual bool TeamWindowQuitRequested(TeamWindow* window);
|
|
|
|
// JobListener
|
|
virtual void JobDone(Job* job);
|
|
virtual void JobFailed(Job* job);
|
|
virtual void JobAborted(Job* job);
|
|
|
|
// Team::Listener
|
|
virtual void ThreadStateChanged(
|
|
const ::Team::ThreadEvent& event);
|
|
virtual void ThreadCpuStateChanged(
|
|
const ::Team::ThreadEvent& event);
|
|
virtual void ThreadStackTraceChanged(
|
|
const ::Team::ThreadEvent& event);
|
|
|
|
private:
|
|
static status_t _DebugEventListenerEntry(void* data);
|
|
status_t _DebugEventListener();
|
|
|
|
void _HandleDebuggerMessage(DebugEvent* event);
|
|
|
|
bool _HandleThreadStopped(thread_id threadID,
|
|
CpuState* cpuState);
|
|
|
|
bool _HandleThreadDebugged(
|
|
ThreadDebuggedEvent* event);
|
|
bool _HandleDebuggerCall(
|
|
DebuggerCallEvent* event);
|
|
bool _HandleBreakpointHit(
|
|
BreakpointHitEvent* event);
|
|
bool _HandleWatchpointHit(
|
|
WatchpointHitEvent* event);
|
|
bool _HandleSingleStep(
|
|
SingleStepEvent* event);
|
|
bool _HandleExceptionOccurred(
|
|
ExceptionOccurredEvent* event);
|
|
bool _HandleThreadCreated(
|
|
ThreadCreatedEvent* event);
|
|
bool _HandleThreadDeleted(
|
|
ThreadDeletedEvent* event);
|
|
bool _HandleImageCreated(
|
|
ImageCreatedEvent* event);
|
|
bool _HandleImageDeleted(
|
|
ImageDeletedEvent* event);
|
|
|
|
void _UpdateThreadState(::Thread* thread);
|
|
void _SetThreadState(::Thread* thread, uint32 state,
|
|
CpuState* cpuState);
|
|
|
|
void _HandleThreadAction(thread_id threadID,
|
|
uint32 action);
|
|
|
|
void _HandleThreadStateChanged(thread_id threadID);
|
|
void _HandleCpuStateChanged(thread_id threadID);
|
|
void _HandleStackTraceChanged(thread_id threadID);
|
|
|
|
private:
|
|
::Team* fTeam;
|
|
TeamDebugModel* fDebugModel;
|
|
team_id fTeamID;
|
|
port_id fNubPort;
|
|
DebuggerInterface* fDebuggerInterface;
|
|
Worker* fWorker;
|
|
thread_id fDebugEventListener;
|
|
TeamWindow* fTeamWindow;
|
|
volatile bool fTerminating;
|
|
};
|
|
|
|
#endif // TEAM_DEBUGGER_H
|