Debugger: Split into core library and application.

- Add subfolder src/kits/debugger which contains the debugger's core
  functionality and lower layers. Correspondingly add headers/private/debugger
  for shared headers to be used by clients such as the Debugger application
  and eventual remote_debug_server. Adjust various files to account for
  differences as a result of the split and moves.
- Add libdebugger.so to minimal Jamfile.
This commit is contained in:
Rene Gollent
2016-06-04 13:18:39 -04:00
parent e6687e8f3d
commit fce4895d18
417 changed files with 492 additions and 390 deletions
@@ -0,0 +1,16 @@
/*
* Copyright 2009-2016, Ingo Weinhold, [email protected].
* Copyright 2011-2016, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef DEBUGGER_GLOBALS_H
#define DEBUGGER_GLOBALS_H
#include "TargetHostInterfaceRoster.h"
status_t debugger_global_init(TargetHostInterfaceRoster::Listener* listener);
void debugger_global_uninit();
#endif // DEBUGGER_GLOBALS_H
+108
View File
@@ -0,0 +1,108 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2013-2015, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef MESSAGE_CODES_H
#define MESSAGE_CODES_H
enum {
MSG_THREAD_RUN = 'run_',
MSG_THREAD_SET_ADDRESS = 'sead',
MSG_THREAD_STOP = 'stop',
MSG_THREAD_STEP_OVER = 'stov',
MSG_THREAD_STEP_INTO = 'stin',
MSG_THREAD_STEP_OUT = 'stou',
MSG_SET_BREAKPOINT = 'sbrk',
MSG_CLEAR_BREAKPOINT = 'cbrk',
MSG_ENABLE_BREAKPOINT = 'ebrk',
MSG_DISABLE_BREAKPOINT = 'dbrk',
MSG_SET_BREAKPOINT_CONDITION = 'sbpc',
MSG_CLEAR_BREAKPOINT_CONDITION = 'cbpc',
MSG_SET_WATCHPOINT = 'swpt',
MSG_CLEAR_WATCHPOINT = 'cwpt',
MSG_ENABLE_WATCHPOINT = 'ewpt',
MSG_DISABLE_WATCHPOINT = 'dwpt',
MSG_STOP_ON_IMAGE_LOAD = 'tsil',
MSG_ADD_STOP_IMAGE_NAME = 'asin',
MSG_REMOVE_STOP_IMAGE_NAME = 'rsin',
MSG_SET_DEFAULT_SIGNAL_DISPOSITION = 'sdsd',
MSG_SET_CUSTOM_SIGNAL_DISPOSITION = 'scsd',
MSG_REMOVE_CUSTOM_SIGNAL_DISPOSITION = 'rcsd',
MSG_TEAM_RENAMED = 'tera',
MSG_THREAD_STATE_CHANGED = 'tsch',
MSG_THREAD_CPU_STATE_CHANGED = 'tcsc',
MSG_THREAD_STACK_TRACE_CHANGED = 'tstc',
MSG_STACK_FRAME_VALUE_RETRIEVED = 'sfvr',
MSG_IMAGE_DEBUG_INFO_CHANGED = 'idic',
MSG_STOP_IMAGE_SETTINGS_CHANGED = 'sisc',
MSG_STOP_IMAGE_NAME_ADDED = 'sina',
MSG_STOP_IMAGE_NAME_REMOVED = 'sinr',
MSG_CONSOLE_OUTPUT_RECEIVED = 'core',
MSG_IMAGE_FILE_CHANGED = 'ifch',
MSG_FUNCTION_SOURCE_CODE_CHANGED = 'fnsc',
MSG_USER_BREAKPOINT_CHANGED = 'ubrc',
MSG_WATCHPOINT_CHANGED = 'wapc',
MSG_MEMORY_DATA_CHANGED = 'mdac',
MSG_DEBUGGER_EVENT = 'dbge',
MSG_LOAD_SETTINGS = 'ldst',
MSG_SETTINGS_MENU_IMPL_ITEM_SELECTED = 'smii',
MSG_SETTINGS_MENU_IMPL_OPTION_ITEM_SELECTED = 'smio',
MSG_TEXTVIEW_AUTOSCROLL = 'tvas',
MSG_VARIABLES_VIEW_CONTEXT_MENU_DONE = 'ctxd',
MSG_VARIABLES_VIEW_NODE_SETTINGS_CHANGED = 'vvns',
MSG_VALUE_NODE_CHANGED = 'vnch',
MSG_VALUE_NODE_CHILDREN_CREATED = 'vncc',
MSG_VALUE_NODE_CHILDREN_DELETED = 'vncd',
MSG_VALUE_NODE_VALUE_CHANGED = 'vnvc',
MSG_TEAM_DEBUGGER_QUIT = 'dbqt',
MSG_TEAM_RESTART_REQUESTED = 'trrq',
MSG_SHOW_TEAMS_WINDOW = 'stew',
MSG_TEAMS_WINDOW_CLOSED = 'tewc',
MSG_SHOW_TEAM_SETTINGS_WINDOW = 'stsw',
MSG_TEAM_SETTINGS_WINDOW_CLOSED = 'tswc',
MSG_SHOW_BREAKPOINT_EDIT_WINDOW = 'sbew',
MSG_BREAKPOINT_EDIT_WINDOW_CLOSED = 'bewc',
MSG_SHOW_SIGNAL_DISPOSITION_EDIT_WINDOW = 'sdew',
MSG_SIGNAL_DISPOSITION_EDIT_WINDOW_CLOSED = 'sdec',
MSG_SHOW_START_TEAM_WINDOW = 'sstw',
MSG_START_TEAM_WINDOW_CLOSED = 'stwc',
MSG_START_NEW_TEAM = 'sttt',
MSG_DEBUG_THIS_TEAM = 'dbtt',
MSG_LOAD_CORE_TEAM = 'lcte',
MSG_SHOW_INSPECTOR_WINDOW = 'sirw',
MSG_INSPECTOR_WINDOW_CLOSED = 'irwc',
MSG_SHOW_EXPRESSION_WINDOW = 'seww',
MSG_EXPRESSION_WINDOW_CLOSED = 'ewwc',
MSG_SHOW_EXPRESSION_PROMPT_WINDOW = 'sepw',
MSG_ADD_NEW_EXPRESSION = 'anex',
MSG_EXPRESSION_PROMPT_WINDOW_CLOSED = 'epwc',
MSG_SHOW_VARIABLE_EDIT_WINDOW = 'svew',
MSG_VARIABLE_EDIT_WINDOW_CLOSED = 'vewc',
MSG_INSPECT_ADDRESS = 'isad',
MSG_WRITE_TARGET_MEMORY = 'wtam',
MSG_EVALUATE_EXPRESSION = 'evex',
MSG_EXPRESSION_EVALUATED = 'exev',
MSG_SHOW_TYPECAST_NODE_PROMPT = 'stnp',
MSG_TYPECAST_TO_ARRAY = 'stta',
MSG_TYPECAST_NODE = 'tyno',
MSG_SHOW_WATCH_VARIABLE_PROMPT = 'swvp',
MSG_SHOW_CONTAINER_RANGE_PROMPT = 'scrp',
MSG_SET_CONTAINER_RANGE = 'chcr',
MSG_GENERATE_DEBUG_REPORT = 'gdrp',
MSG_WRITE_CORE_FILE = 'wrcf',
MSG_WRITE_VARIABLE_VALUE = 'wrvv',
MSG_DEBUG_INFO_NEEDS_USER_INPUT = 'dnui',
MSG_USER_INTERFACE_FILE_CHOSEN = 'uifc'
};
#endif // MESSAGE_CODES_H
+123
View File
@@ -0,0 +1,123 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TRACING_H
#define TRACING_H
#include <stdio.h>
#include "apps_debugger_config.h"
#define WARNING(x...) fprintf(stderr, x)
#define ERROR(x...) fprintf(stderr, x)
#if APPS_DEBUGGER_TRACE_DWARF_DIE
# define TRACE_DIE(x...) printf(x)
# define TRACE_DIE_ONLY(x) x
#else
# define TRACE_DIE(x...) (void)0
# define TRACE_DIE_ONLY(x)
#endif
#if APPS_DEBUGGER_TRACE_DWARF_LINE_INFO
# define TRACE_LINES(x...) printf(x)
# define TRACE_LINES_ONLY(x) x
#else
# define TRACE_LINES(x...) (void)0
# define TRACE_LINES_ONLY(x)
#endif
#if APPS_DEBUGGER_TRACE_DWARF_LINE_INFO >= 2
# define TRACE_LINES2(x...) printf(x)
# define TRACE_LINES2_ONLY(x) x
#else
# define TRACE_LINES2(x...) (void)0
# define TRACE_LINES2_ONLY(x)
#endif
#if APPS_DEBUGGER_TRACE_DWARF_EXPRESSIONS
# define TRACE_EXPR(x...) printf(x)
# define TRACE_EXPR_ONLY(x) x
#else
# define TRACE_EXPR(x...) (void)0
# define TRACE_EXPR_ONLY(x)
#endif
#if APPS_DEBUGGER_TRACE_DWARF_PUBLIC_TYPES
# define TRACE_PUBTYPES(x...) printf(x)
# define TRACE_PUBTYPES_ONLY(x) x
#else
# define TRACE_PUBTYPES(x...) (void)0
# define TRACE_PUBTYPES_ONLY(x)
#endif
#if APPS_DEBUGGER_TRACE_CFI
# define TRACE_CFI(x...) printf(x)
# define TRACE_CFI_ONLY(x) x
#else
# define TRACE_CFI(x...) (void)0
# define TRACE_CFI_ONLY(x)
#endif
#if APPS_DEBUGGER_TRACE_STACK_FRAME_LOCALS
# define TRACE_LOCALS(x...) printf(x)
# define TRACE_LOCALS_ONLY(x) x
#else
# define TRACE_LOCALS(x...) (void)0
# define TRACE_LOCALS_ONLY(x)
#endif
#if APPS_DEBUGGER_TRACE_IMAGES
# define TRACE_IMAGES(x...) printf(x)
# define TRACE_IMAGES_ONLY(x) x
#else
# define TRACE_IMAGES(x...) (void)0
# define TRACE_IMAGES_ONLY(x)
#endif
#if APPS_DEBUGGER_TRACE_CODE
# define TRACE_CODE(x...) printf(x)
# define TRACE_CODE_ONLY(x) x
#else
# define TRACE_CODE(x...) (void)0
# define TRACE_CODE_ONLY(x)
#endif
#if APPS_DEBUGGER_TRACE_JOBS
# define TRACE_JOBS(x...) printf(x)
# define TRACE_JOBS_ONLY(x) x
#else
# define TRACE_JOBS(x...) (void)0
# define TRACE_JOBS_ONLY(x)
#endif
#if APPS_DEBUGGER_TRACE_DEBUG_EVENTS
# define TRACE_EVENTS(x...) printf(x)
# define TRACE_EVENTS_ONLY(x) x
#else
# define TRACE_EVENTS(x...) (void)0
# define TRACE_EVENTS_ONLY(x)
#endif
#if APPS_DEBUGGER_TRACE_TEAM_CONTROL
# define TRACE_CONTROL(x...) printf(x)
# define TRACE_CONTROL_ONLY(x) x
#else
# define TRACE_CONTROL(x...) (void)0
# define TRACE_CONTROL_ONLY(x)
#endif
#if APPS_DEBUGGER_TRACE_GUI
# define TRACE_GUI(x...) printf(x)
# define TRACE_GUI_ONLY(x) x
#else
# define TRACE_GUI(x...) (void)0
# define TRACE_GUI_ONLY(x)
#endif
#endif // TRACING_H
@@ -0,0 +1,150 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2011-2015, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef ARCHITECTURE_H
#define ARCHITECTURE_H
#include <ByteOrder.h>
#include <OS.h>
#include <Referenceable.h>
#include <Variant.h>
#include "ReturnValueInfo.h"
#include "Types.h"
class CfaContext;
class CpuState;
class DisassembledCode;
class FunctionDebugInfo;
class Image;
class ImageDebugInfoProvider;
class InstructionInfo;
class Register;
class RegisterMap;
class StackFrame;
class StackTrace;
class Statement;
class Team;
class TeamMemory;
class ValueLocation;
enum {
STACK_GROWTH_DIRECTION_POSITIVE = 0,
STACK_GROWTH_DIRECTION_NEGATIVE
};
enum {
WATCHPOINT_CAPABILITY_FLAG_READ = 1,
WATCHPOINT_CAPABILITY_FLAG_WRITE = 2,
WATCHPOINT_CAPABILITY_FLAG_READ_WRITE = 4
};
class Architecture : public BReferenceable {
public:
Architecture(TeamMemory* teamMemory,
uint8 addressSize, bool bigEndian);
virtual ~Architecture();
virtual status_t Init();
inline uint8 AddressSize() const { return fAddressSize; }
inline bool IsBigEndian() const { return fBigEndian; }
inline bool IsHostEndian() const;
virtual int32 StackGrowthDirection() const = 0;
virtual int32 CountRegisters() const = 0;
virtual const Register* Registers() const = 0;
virtual status_t InitRegisterRules(CfaContext& context) const;
virtual status_t GetDwarfRegisterMaps(RegisterMap** _toDwarf,
RegisterMap** _fromDwarf) const = 0;
// returns references
virtual status_t GetCpuFeatures(uint32& flags) = 0;
virtual status_t CreateCpuState(CpuState*& _state) = 0;
virtual status_t CreateCpuState(const void* cpuStateData,
size_t size, CpuState*& _state) = 0;
virtual status_t CreateStackFrame(Image* image,
FunctionDebugInfo* function,
CpuState* cpuState, bool isTopFrame,
StackFrame*& _frame,
CpuState*& _previousCpuState) = 0;
// returns reference to previous frame
// and CPU state; returned CPU state
// can be NULL
virtual void UpdateStackFrameCpuState(
const StackFrame* frame,
Image* previousImage,
FunctionDebugInfo* previousFunction,
CpuState* previousCpuState) = 0;
// Called after a CreateStackFrame()
// with the image/function corresponding
// to the CPU state.
virtual status_t ReadValueFromMemory(target_addr_t address,
uint32 valueType, BVariant& _value) const
= 0;
virtual status_t ReadValueFromMemory(target_addr_t addressSpace,
target_addr_t address, uint32 valueType,
BVariant& _value) const = 0;
virtual status_t DisassembleCode(FunctionDebugInfo* function,
const void* buffer, size_t bufferSize,
DisassembledCode*& _sourceCode) = 0;
virtual status_t GetStatement(FunctionDebugInfo* function,
target_addr_t address,
Statement*& _statement) = 0;
virtual status_t GetInstructionInfo(target_addr_t address,
InstructionInfo& _info,
CpuState* state) = 0;
virtual status_t ResolvePICFunctionAddress(target_addr_t
instructionAddress,
CpuState* state,
target_addr_t& _targetAddress) = 0;
status_t CreateStackTrace(Team* team,
ImageDebugInfoProvider* imageInfoProvider,
CpuState* cpuState,
StackTrace*& _stackTrace,
ReturnValueInfoList* returnValueInfos,
int32 maxStackDepth = -1,
bool useExistingTrace = false,
bool getFullFrameInfo = true);
// team is not locked
virtual status_t GetWatchpointDebugCapabilities(
int32& _maxRegisterCount,
int32& _maxBytesPerRegister,
uint8& _watchpointCapabilityFlags) = 0;
virtual status_t GetReturnAddressLocation(
StackFrame* frame, target_size_t valueSize,
ValueLocation*& _location) = 0;
protected:
TeamMemory* fTeamMemory;
uint8 fAddressSize;
bool fBigEndian;
};
bool
Architecture::IsHostEndian() const
{
return fBigEndian == (B_HOST_IS_BENDIAN != 0);
}
#endif // ARCHITECTURE_H
+43
View File
@@ -0,0 +1,43 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2011, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef CPU_STATE_H
#define CPU_STATE_H
#include <OS.h>
#include <Referenceable.h>
#include <Variant.h>
#include "Types.h"
class Register;
class CpuState : public BReferenceable {
public:
virtual ~CpuState();
virtual status_t Clone(CpuState*& _clone) const = 0;
virtual status_t UpdateDebugState(void* state, size_t size)
const = 0;
virtual target_addr_t InstructionPointer() const = 0;
virtual void SetInstructionPointer(
target_addr_t address) = 0;
virtual target_addr_t StackFramePointer() const = 0;
virtual target_addr_t StackPointer() const = 0;
virtual bool GetRegisterValue(const Register* reg,
BVariant& _value) const = 0;
virtual bool SetRegisterValue(const Register* reg,
const BVariant& value) = 0;
};
#endif // CPU_STATE_H
+58
View File
@@ -0,0 +1,58 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2014, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef REGISTER_H
#define REGISTER_H
#include <SupportDefs.h>
enum register_format {
REGISTER_FORMAT_INTEGER,
REGISTER_FORMAT_FLOAT,
REGISTER_FORMAT_SIMD
};
enum register_type {
REGISTER_TYPE_INSTRUCTION_POINTER,
REGISTER_TYPE_STACK_POINTER,
REGISTER_TYPE_RETURN_ADDRESS,
REGISTER_TYPE_GENERAL_PURPOSE,
REGISTER_TYPE_SPECIAL_PURPOSE,
REGISTER_TYPE_EXTENDED
};
class Register {
public:
Register(int32 index, const char* name,
uint32 bitSize, uint32 valueType,
register_type type, bool calleePreserved);
// name will not be cloned
Register(const Register& other);
int32 Index() const { return fIndex; }
const char* Name() const { return fName; }
uint32 ValueType() const { return fValueType; }
register_format Format() const { return fFormat; }
uint32 BitSize() const { return fBitSize; }
register_type Type() const { return fType; }
bool IsCalleePreserved() const
{ return fCalleePreserved; }
private:
int32 fIndex;
const char* fName;
uint32 fBitSize;
uint32 fValueType;
register_format fFormat;
register_type fType;
bool fCalleePreserved;
};
#endif // REGISTER_H
@@ -0,0 +1,298 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2013-2016, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TEAM_DEBUGGER_H
#define TEAM_DEBUGGER_H
#include <debugger.h>
#include <Looper.h>
#include "Team.h"
#include "TeamSettings.h"
#include "ThreadHandler.h"
#include "UserInterface.h"
#include "util/Worker.h"
class DebugEvent;
class DebuggerInterface;
class DebugReportGenerator;
class FileManager;
class ImageCreatedEvent;
class ImageDebugInfoLoadingState;
class ImageDeletedEvent;
class PostSyscallEvent;
class SettingsManager;
class TeamDebugInfo;
class TeamDeletedEvent;
class TeamExecEvent;
class TeamMemoryBlockManager;
class Thread;
class ThreadCreatedEvent;
class ThreadDeletedEvent;
class ThreadRenamedEvent;
class ThreadPriorityChangedEvent;
class WatchpointManager;
class TeamDebugger : public BLooper, private UserInterfaceListener,
private JobListener, private Team::Listener {
public:
class Listener;
public:
TeamDebugger(Listener* listener,
UserInterface* userInterface,
SettingsManager* settingsManager);
~TeamDebugger();
status_t Init(DebuggerInterface* interface,
thread_id threadID, int argc,
const char* const* argv,
bool stopInMain);
void Activate();
team_id TeamID() const { return fTeamID; }
bool IsPostMortem() const { return fIsPostMortem; }
int ArgumentCount() const
{ return fCommandLineArgc; }
const char** Arguments() const
{ return fCommandLineArgv; }
SettingsManager* GetSettingsManager() const
{ return fSettingsManager; }
virtual void MessageReceived(BMessage* message);
private:
// UserInterfaceListener
virtual void FunctionSourceCodeRequested(
FunctionInstance* function,
bool forceDisassembly = false);
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,
ValueNode* valueNode);
virtual void ValueNodeWriteRequested(ValueNode* node,
CpuState* state,
Value* newValue);
virtual void ThreadActionRequested(thread_id threadID,
uint32 action, target_addr_t address);
virtual void SetBreakpointRequested(target_addr_t address,
bool enabled, bool hidden = false);
virtual void SetBreakpointEnabledRequested(
UserBreakpoint* breakpoint,
bool enabled);
virtual void SetBreakpointConditionRequested(
UserBreakpoint* breakpoint,
const char* condition);
virtual void ClearBreakpointConditionRequested(
UserBreakpoint* breakpoint);
virtual void ClearBreakpointRequested(target_addr_t address);
virtual void ClearBreakpointRequested(
UserBreakpoint* breakpoint);
virtual void SetStopOnImageLoadRequested(bool enabled,
bool useImageNames);
virtual void AddStopImageNameRequested(
const char* name);
virtual void RemoveStopImageNameRequested(
const char* name);
virtual void SetDefaultSignalDispositionRequested(
int32 disposition);
virtual void SetCustomSignalDispositionRequested(
int32 signal, int32 disposition);
virtual void RemoveCustomSignalDispositionRequested(
int32 signal);
virtual void SetWatchpointRequested(target_addr_t address,
uint32 type, int32 length, bool enabled);
virtual void SetWatchpointEnabledRequested(
Watchpoint *watchpoint, bool enabled);
virtual void ClearWatchpointRequested(target_addr_t address);
virtual void ClearWatchpointRequested(
Watchpoint* breakpoint);
virtual void InspectRequested(target_addr_t address,
TeamMemoryBlock::Listener* listener);
virtual void MemoryWriteRequested(target_addr_t address,
const void* data, target_size_t size);
virtual void ExpressionEvaluationRequested(
SourceLanguage* language,
ExpressionInfo* info,
StackFrame* frame = NULL,
::Thread* thread = NULL);
virtual void DebugReportRequested(entry_ref* targetPath);
virtual void WriteCoreFileRequested(entry_ref* targetPath);
virtual void TeamRestartRequested();
virtual bool UserInterfaceQuitRequested(
QuitOption quitOption);
// JobListener
virtual void JobStarted(Job* job);
virtual void JobDone(Job* job);
virtual void JobWaitingForInput(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);
virtual void ImageDebugInfoChanged(
const ::Team::ImageEvent& event);
private:
struct ImageHandler;
struct ImageHandlerHashDefinition;
struct ImageInfoPendingThread;
struct ImageInfoPendingThreadHashDefinition;
typedef BOpenHashTable<ImageHandlerHashDefinition> ImageHandlerTable;
typedef BOpenHashTable<ImageInfoPendingThreadHashDefinition>
ImageInfoPendingThreadTable;
private:
static status_t _DebugEventListenerEntry(void* data);
status_t _DebugEventListener();
void _HandleDebuggerMessage(DebugEvent* event);
bool _HandleTeamDeleted(
TeamDeletedEvent* event);
bool _HandleThreadCreated(
ThreadCreatedEvent* event);
bool _HandleThreadRenamed(
ThreadRenamedEvent* event);
bool _HandleThreadPriorityChanged(
ThreadPriorityChangedEvent* event);
bool _HandleThreadDeleted(
ThreadDeletedEvent* event);
bool _HandleImageCreated(
ImageCreatedEvent* event);
bool _HandleImageDeleted(
ImageDeletedEvent* event);
bool _HandlePostSyscall(
PostSyscallEvent* event);
void _PrepareForTeamExec(TeamExecEvent* event);
void _HandleImageDebugInfoChanged(image_id imageID);
void _HandleImageFileChanged(image_id imageID);
void _HandleSetUserBreakpoint(target_addr_t address,
bool enabled, bool hidden);
void _HandleSetUserBreakpoint(
UserBreakpoint* breakpoint, bool enabled);
void _HandleClearUserBreakpoint(
target_addr_t address);
void _HandleClearUserBreakpoint(
UserBreakpoint* breakpoint);
void _HandleSetWatchpoint(target_addr_t address,
uint32 type, int32 length, bool enabled);
void _HandleSetWatchpoint(
Watchpoint* watchpoint, bool enabled);
void _HandleClearWatchpoint( target_addr_t address);
void _HandleClearWatchpoint(Watchpoint* watchpoint);
void _HandleInspectAddress(
target_addr_t address,
TeamMemoryBlock::Listener* listener);
void _HandleWriteMemory(
target_addr_t address, void* data,
target_size_t size);
void _HandleEvaluateExpression(
SourceLanguage* language,
ExpressionInfo* info,
StackFrame* frame,
::Thread* thread);
void _HandleWriteCoreFile(const entry_ref& ref);
status_t _HandleSetArguments(int argc,
const char* const* argv);
void _HandleDebugInfoJobUserInput(
ImageDebugInfoLoadingState* state);
ThreadHandler* _GetThreadHandler(thread_id threadID);
status_t _AddImage(const ImageInfo& imageInfo,
Image** _image = NULL);
void _LoadSettings();
void _SaveSettings();
void _NotifyUser(const char* title,
const char* text,...);
void _ResetUserBackgroundStatusIfNeeded();
// updates user interface to
// ready/completed message
// for background work status
private:
Listener* fListener;
SettingsManager* fSettingsManager;
::Team* fTeam;
team_id fTeamID;
bool fIsPostMortem;
ThreadHandlerTable fThreadHandlers;
// protected by the team lock
ImageHandlerTable* fImageHandlers;
ImageInfoPendingThreadTable* fImageInfoPendingThreads;
DebuggerInterface* fDebuggerInterface;
TeamDebugInfo* fTeamDebugInfo;
FileManager* fFileManager;
Worker* fWorker;
BreakpointManager* fBreakpointManager;
WatchpointManager* fWatchpointManager;
TeamMemoryBlockManager*
fMemoryBlockManager;
DebugReportGenerator*
fReportGenerator;
thread_id fDebugEventListener;
UserInterface* fUserInterface;
volatile bool fTerminating;
bool fKillTeamOnQuit;
TeamSettings fTeamSettings;
int fCommandLineArgc;
const char** fCommandLineArgv;
bool fExecPending;
};
class TeamDebugger::Listener {
public:
virtual ~Listener();
virtual void TeamDebuggerStarted(TeamDebugger* debugger) = 0;
virtual void TeamDebuggerRestartRequested(
TeamDebugger* debugger) = 0;
virtual void TeamDebuggerQuit(TeamDebugger* debugger) = 0;
};
#endif // TEAM_DEBUGGER_H
@@ -0,0 +1,173 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2014-2016, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef THREAD_HANDLER_H
#define THREAD_HANDLER_H
#include <Referenceable.h>
#include <util/OpenHashTable.h>
#include "Breakpoint.h"
#include "ImageDebugInfoProvider.h"
#include "model/Thread.h"
class BreakpointHitEvent;
class BreakpointManager;
class DebugEvent;
class DebuggerCallEvent;
class DebuggerInterface;
class ExceptionOccurredEvent;
class ExpressionResult;
class ImageDebugInfoJobListener;
class JobListener;
class SignalReceivedEvent;
class SingleStepEvent;
class StackFrame;
class Statement;
class ThreadDebuggedEvent;
class WatchpointHitEvent;
class Worker;
class ThreadHandler : public BReferenceable, private ImageDebugInfoProvider,
private BreakpointClient {
public:
ThreadHandler(::Thread* thread, Worker* worker,
DebuggerInterface* debuggerInterface,
JobListener* listener,
BreakpointManager* breakpointManager);
~ThreadHandler();
void Init();
thread_id ThreadID() const { return fThread->ID(); }
::Thread* GetThread() const { return fThread; }
status_t SetBreakpointAndRun(target_addr_t address);
// team lock held
// All Handle*() methods are invoked in team debugger thread,
// looper lock held.
bool HandleThreadDebugged(
ThreadDebuggedEvent* event,
const BString& stoppedReason = BString());
bool HandleDebuggerCall(
DebuggerCallEvent* event);
bool HandleBreakpointHit(
BreakpointHitEvent* event);
bool HandleWatchpointHit(
WatchpointHitEvent* event);
bool HandleSingleStep(
SingleStepEvent* event);
bool HandleExceptionOccurred(
ExceptionOccurredEvent* event);
bool HandleSignalReceived(
SignalReceivedEvent* event);
void HandleThreadAction(uint32 action,
target_addr_t address);
void HandleThreadStateChanged();
void HandleCpuStateChanged();
void HandleStackTraceChanged();
private:
friend class ExpressionEvaluationListener;
private:
// ImageDebugInfoProvider
virtual status_t GetImageDebugInfo(Image* image,
ImageDebugInfo*& _info);
bool _HandleThreadStopped(CpuState* cpuState,
uint32 stoppedReason,
const BString& stoppedReasonInfo
= BString());
bool _HandleSetAddress(CpuState* cpuState,
target_addr_t address);
void _SetThreadState(uint32 state,
CpuState* cpuState, uint32 stoppedReason,
const BString& stoppedReasonInfo);
Statement* _GetStatementAtInstructionPointer(
StackFrame* frame);
void _StepFallback();
bool _DoStepOver(CpuState* cpuState);
status_t _InstallTemporaryBreakpoint(
target_addr_t address);
void _UninstallTemporaryBreakpoint();
void _ClearContinuationState();
void _RunThread(target_addr_t instructionPointer);
void _SingleStepThread(
target_addr_t instructionPointer);
bool _HandleBreakpointConditionIfNeeded(
CpuState* cpuState);
void _HandleBreakpointConditionEvaluated(
ExpressionResult* value);
bool _CheckStopCondition();
bool _HandleBreakpointHitStep(CpuState* cpuState);
bool _HandleSingleStepStep(CpuState* cpuState);
bool _HasExitedFrame(target_addr_t framePointer)
const;
private:
::Thread* fThread;
Worker* fWorker;
DebuggerInterface* fDebuggerInterface;
JobListener* fJobListener;
BreakpointManager* fBreakpointManager;
uint32 fStepMode;
Statement* fStepStatement;
target_addr_t fBreakpointAddress;
target_addr_t fSteppedOverFunctionAddress;
target_addr_t fPreviousInstructionPointer;
target_addr_t fPreviousFrameAddress;
bool fSingleStepping;
sem_id fConditionWaitSem;
ExpressionResult* fConditionResult;
public:
ThreadHandler* fNext;
};
struct ThreadHandlerHashDefinition {
typedef thread_id KeyType;
typedef ThreadHandler ValueType;
size_t HashKey(thread_id key) const
{
return (size_t)key;
}
size_t Hash(const ThreadHandler* value) const
{
return HashKey(value->ThreadID());
}
bool Compare(thread_id key, ThreadHandler* value) const
{
return value->ThreadID() == key;
}
ThreadHandler*& GetLink(ThreadHandler* value) const
{
return value->fNext;
}
};
typedef BOpenHashTable<ThreadHandlerHashDefinition> ThreadHandlerTable;
#endif // THREAD_HANDLER_H
@@ -0,0 +1,92 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2010, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef FUNCTION_H
#define FUNCTION_H
#include <util/DoublyLinkedList.h>
#include <util/OpenHashTable.h>
#include "FunctionInstance.h"
#include "LocatableFile.h"
class FileSourceCode;
class Function : public BReferenceable, private LocatableFile::Listener {
public:
class Listener;
public:
Function();
~Function();
// team must be locked to access the instances
FunctionInstance* FirstInstance() const
{ return fInstances.Head(); }
FunctionInstance* LastInstance() const
{ return fInstances.Tail(); }
const FunctionInstanceList& Instances() const
{ return fInstances; }
const BString& Name() const
{ return FirstInstance()->Name(); }
const BString& PrettyName() const
{ return FirstInstance()->PrettyName(); }
LocatableFile* SourceFile() const
{ return FirstInstance()->SourceFile(); }
SourceLocation GetSourceLocation() const
{ return FirstInstance()
->GetSourceLocation(); }
FunctionID* GetFunctionID() const
{ return FirstInstance()->GetFunctionID(); }
// returns a reference
// mutable attributes follow (locking required)
FileSourceCode* GetSourceCode() const { return fSourceCode; }
function_source_state SourceCodeState() const
{ return fSourceCodeState; }
void SetSourceCode(FileSourceCode* source,
function_source_state state);
void AddListener(Listener* listener);
void RemoveListener(Listener* listener);
// package private
void AddInstance(FunctionInstance* instance);
void RemoveInstance(FunctionInstance* instance);
void NotifySourceCodeChanged();
void LocatableFileChanged(LocatableFile* file);
private:
typedef DoublyLinkedList<Listener> ListenerList;
private:
FunctionInstanceList fInstances;
FileSourceCode* fSourceCode;
function_source_state fSourceCodeState;
ListenerList fListeners;
int32 fNotificationsDisabled;
public:
// BOpenHashTable support
Function* fNext;
};
class Function::Listener : public DoublyLinkedListLinkImpl<Listener> {
public:
virtual ~Listener();
virtual void FunctionSourceCodeChanged(Function* function);
// called with lock held
};
#endif // FUNCTION_H
@@ -0,0 +1,38 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef FUNCTION_DEBUG_INFO_H
#define FUNCTION_DEBUG_INFO_H
#include <Referenceable.h>
#include "SourceLocation.h"
#include "Types.h"
class BString;
class LocatableFile;
class SpecificImageDebugInfo;
class FunctionDebugInfo : public BReferenceable {
public:
FunctionDebugInfo();
virtual ~FunctionDebugInfo();
virtual SpecificImageDebugInfo* GetSpecificImageDebugInfo() const = 0;
virtual target_addr_t Address() const = 0;
virtual target_size_t Size() const = 0;
virtual const BString& Name() const = 0;
virtual const BString& PrettyName() const = 0;
virtual bool IsMain() const = 0;
virtual LocatableFile* SourceFile() const = 0;
virtual SourceLocation SourceStartLocation() const = 0;
virtual SourceLocation SourceEndLocation() const = 0;
};
#endif // FUNCTION_DEBUG_INFO_H
@@ -0,0 +1,82 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef FUNCTION_INSTANCE_H
#define FUNCTION_INSTANCE_H
#include <util/DoublyLinkedList.h>
#include "FunctionDebugInfo.h"
enum function_source_state {
FUNCTION_SOURCE_NOT_LOADED,
FUNCTION_SOURCE_LOADING,
FUNCTION_SOURCE_LOADED,
FUNCTION_SOURCE_UNAVAILABLE
};
class DisassembledCode;
class Function;
class FunctionDebugInfo;
class FunctionID;
class ImageDebugInfo;
class FunctionInstance : public BReferenceable,
public DoublyLinkedListLinkImpl<FunctionInstance> {
public:
FunctionInstance(ImageDebugInfo* imageDebugInfo,
FunctionDebugInfo* functionDebugInfo);
~FunctionInstance();
ImageDebugInfo* GetImageDebugInfo() const
{ return fImageDebugInfo; }
Function* GetFunction() const
{ return fFunction; }
FunctionDebugInfo* GetFunctionDebugInfo() const
{ return fFunctionDebugInfo; }
target_addr_t Address() const
{ return fFunctionDebugInfo->Address(); }
target_size_t Size() const
{ return fFunctionDebugInfo->Size(); }
const BString& Name() const
{ return fFunctionDebugInfo->Name(); }
const BString& PrettyName() const
{ return fFunctionDebugInfo->PrettyName(); }
LocatableFile* SourceFile() const
{ return fFunctionDebugInfo->SourceFile(); }
SourceLocation GetSourceLocation() const
{ return fFunctionDebugInfo
->SourceStartLocation(); }
FunctionID* GetFunctionID() const;
// returns a reference
void SetFunction(Function* function);
// package private
// mutable attributes follow (locking required)
DisassembledCode* GetSourceCode() const
{ return fSourceCode; }
function_source_state SourceCodeState() const
{ return fSourceCodeState; }
void SetSourceCode(DisassembledCode* source,
function_source_state state);
private:
ImageDebugInfo* fImageDebugInfo;
Function* fFunction;
FunctionDebugInfo* fFunctionDebugInfo;
DisassembledCode* fSourceCode;
function_source_state fSourceCodeState;
};
typedef DoublyLinkedList<FunctionInstance> FunctionInstanceList;
#endif // FUNCTION_INSTANCE_H
@@ -0,0 +1,95 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2014, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef GLOBAL_TYPE_LOOKUP_H
#define GLOBAL_TYPE_LOOKUP_H
#include <image.h>
#include <Locker.h>
#include <Referenceable.h>
#include <util/OpenHashTable.h>
class BString;
class Type;
class TypeLookupConstraints;
enum global_type_cache_scope {
GLOBAL_TYPE_CACHE_SCOPE_GLOBAL,
GLOBAL_TYPE_CACHE_SCOPE_COMPILATION_UNIT
};
class GlobalTypeCache : public BReferenceable {
public:
GlobalTypeCache();
~GlobalTypeCache();
status_t Init();
inline bool Lock();
inline void Unlock();
// cache must be locked
Type* GetType(const BString& name,
const TypeLookupConstraints &constraints
) const;
Type* GetTypeByID(const BString& id) const;
status_t AddType(Type* type);
void RemoveType(Type* type);
// cache locked by method
void RemoveTypes(image_id imageID);
private:
struct TypeEntry;
struct TypeEntryHashDefinitionByName;
struct TypeEntryHashDefinitionByID;
typedef BOpenHashTable<TypeEntryHashDefinitionByName> NameTable;
typedef BOpenHashTable<TypeEntryHashDefinitionByID> IDTable;
private:
BLocker fLock;
NameTable* fTypesByName;
IDTable* fTypesByID;
};
class GlobalTypeLookup {
public:
virtual ~GlobalTypeLookup();
virtual status_t GetType(GlobalTypeCache* cache,
const BString& name,
const TypeLookupConstraints& constraints,
Type*& _type) = 0;
// returns a reference
virtual bool HasType(GlobalTypeCache* cache,
const BString& name,
const TypeLookupConstraints& constraints)
= 0;
};
bool
GlobalTypeCache::Lock()
{
return fLock.Lock();
}
void
GlobalTypeCache::Unlock()
{
fLock.Unlock();
}
#endif // GLOBAL_TYPE_LOOKUP_H
@@ -0,0 +1,88 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2010-2013, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef IMAGE_DEBUG_INFO_H
#define IMAGE_DEBUG_INFO_H
#include <String.h>
#include <ObjectList.h>
#include <Referenceable.h>
#include "AddressSectionTypes.h"
#include "ImageInfo.h"
#include "Types.h"
class Architecture;
class DebuggerInterface;
class FileSourceCode;
class FunctionDebugInfo;
class FunctionInstance;
class GlobalTypeCache;
class LocatableFile;
class SpecificImageDebugInfo;
class SymbolInfo;
class Type;
class TypeLookupConstraints;
class ImageDebugInfo : public BReferenceable {
public:
ImageDebugInfo(const ImageInfo& imageInfo);
~ImageDebugInfo();
const ImageInfo& GetImageInfo() const { return fImageInfo; }
bool AddSpecificInfo(SpecificImageDebugInfo* info);
status_t FinishInit(DebuggerInterface* interface);
status_t GetType(GlobalTypeCache* cache,
const BString& name,
const TypeLookupConstraints& constraints,
Type*& _type);
// returns a reference
bool HasType(const BString& name,
const TypeLookupConstraints& constraints)
const;
AddressSectionType GetAddressSectionType(target_addr_t address)
const;
int32 CountFunctions() const;
FunctionInstance* FunctionAt(int32 index) const;
FunctionInstance* FunctionAtAddress(target_addr_t address) const;
FunctionInstance* FunctionByName(const char* name) const;
FunctionInstance* MainFunction() const
{ return fMainFunction; }
status_t AddSourceCodeInfo(LocatableFile* file,
FileSourceCode* sourceCode) const;
private:
typedef BObjectList<SpecificImageDebugInfo> SpecificInfoList;
typedef BObjectList<FunctionInstance> FunctionList;
private:
static int _CompareFunctions(const FunctionInstance* a,
const FunctionInstance* b);
static int _CompareAddressFunction(
const target_addr_t* address,
const FunctionInstance* function);
static int _CompareSymbols(const SymbolInfo* a,
const SymbolInfo* b);
private:
ImageInfo fImageInfo;
SpecificInfoList fSpecificInfos;
FunctionList fFunctions;
FunctionInstance* fMainFunction;
};
#endif // IMAGE_DEBUG_INFO_H
@@ -0,0 +1,25 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef IMAGE_DEBUG_INFO_PROVIDER_H
#define IMAGE_DEBUG_INFO_PROVIDER_H
#include <SupportDefs.h>
class Image;
class ImageDebugInfo;
class ImageDebugInfoProvider {
public:
virtual ~ImageDebugInfoProvider();
virtual status_t GetImageDebugInfo(Image* image,
ImageDebugInfo*& _info) = 0;
// returns a reference
};
#endif // IMAGE_DEBUG_INFO_PROVIDER_H
@@ -0,0 +1,105 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2013-2014, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef SPECIFIC_IMAGE_DEBUG_INFO_H
#define SPECIFIC_IMAGE_DEBUG_INFO_H
#include <ObjectList.h>
#include <Referenceable.h>
#include "AddressSectionTypes.h"
#include "ReturnValueInfo.h"
#include "Types.h"
class Architecture;
class BString;
class CpuState;
class DataMember;
class DebuggerInterface;
class FileSourceCode;
class FunctionDebugInfo;
class FunctionInstance;
class GlobalTypeCache;
class Image;
class ImageInfo;
class LocatableFile;
class SourceLanguage;
class SourceLocation;
class StackFrame;
class Statement;
class SymbolInfo;
class Type;
class TypeLookupConstraints;
class ValueLocation;
class SpecificImageDebugInfo : public BReferenceable {
public:
virtual ~SpecificImageDebugInfo();
virtual status_t GetFunctions(
const BObjectList<SymbolInfo>& symbols,
BObjectList<FunctionDebugInfo>& functions)
= 0;
// returns references
virtual status_t GetType(GlobalTypeCache* cache,
const BString& name,
const TypeLookupConstraints& constraints,
Type*& _type) = 0;
// returns a reference
virtual bool HasType(const BString& name,
const TypeLookupConstraints& constraints)
const = 0;
virtual AddressSectionType GetAddressSectionType(target_addr_t address)
= 0;
virtual status_t CreateFrame(Image* image,
FunctionInstance* functionInstance,
CpuState* cpuState,
bool getFullFrameInfo,
ReturnValueInfoList* returnValueInfos,
StackFrame*& _Frame,
CpuState*& _previousCpuState) = 0;
// returns reference to previous frame
// and CPU state; returned CPU state
// can be NULL; can return B_UNSUPPORTED
// getFullFrameInfo: try to retrieve
// variables/parameters if true
// (and supported)
virtual status_t GetStatement(FunctionDebugInfo* function,
target_addr_t address,
Statement*& _statement) = 0;
// returns reference
virtual status_t GetStatementAtSourceLocation(
FunctionDebugInfo* function,
const SourceLocation& sourceLocation,
Statement*& _statement) = 0;
// returns reference
virtual status_t GetSourceLanguage(FunctionDebugInfo* function,
SourceLanguage*& _language) = 0;
virtual ssize_t ReadCode(target_addr_t address, void* buffer,
size_t size) = 0;
virtual status_t AddSourceCodeInfo(LocatableFile* file,
FileSourceCode* sourceCode) = 0;
protected:
static status_t GetFunctionsFromSymbols(
const BObjectList<SymbolInfo>& symbols,
BObjectList<FunctionDebugInfo>& functions,
DebuggerInterface* interface,
const ImageInfo& imageInfo,
SpecificImageDebugInfo* info);
};
#endif // SPECIFIC_IMAGE_DEBUG_INFO_H
@@ -0,0 +1,29 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2014, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef SPECIFIC_TEAM_DEBUG_INFO_H
#define SPECIFIC_TEAM_DEBUG_INFO_H
#include <SupportDefs.h>
class ImageDebugInfoLoadingState;
class ImageInfo;
class LocatableFile;
class SpecificImageDebugInfo;
class SpecificTeamDebugInfo {
public:
virtual ~SpecificTeamDebugInfo();
virtual status_t CreateImageDebugInfo(const ImageInfo& imageInfo,
LocatableFile* imageFile,
ImageDebugInfoLoadingState& _state,
SpecificImageDebugInfo*& _imageDebugInfo)
= 0;
};
#endif // SPECIFIC_TEAM_DEBUG_INFO_H
@@ -0,0 +1,31 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef STACK_FRAME_DEBUG_INFO_H
#define STACK_FRAME_DEBUG_INFO_H
#include <Referenceable.h>
#include "Types.h"
class ArrayIndexPath;
class ArrayType;
class Architecture;
class BaseType;
class DataMember;
class StackFrame;
class Type;
class ValueLocation;
class StackFrameDebugInfo : public BReferenceable {
public:
StackFrameDebugInfo();
virtual ~StackFrameDebugInfo();
};
#endif // STACK_FRAME_DEBUG_INFO_H
@@ -0,0 +1,118 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2014, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TEAM_DEBUG_INFO_H
#define TEAM_DEBUG_INFO_H
#include <Locker.h>
#include <ObjectList.h>
#include <Referenceable.h>
#include <util/OpenHashTable.h>
#include "GlobalTypeLookup.h"
#include "ImageInfo.h"
#include "TeamTypeInformation.h"
class Architecture;
class DebuggerInterface;
class DisassembledCode;
class FileManager;
class FileSourceCode;
class Function;
class FunctionID;
class FunctionInstance;
class ImageDebugInfo;
class ImageDebugInfoLoadingState;
class ImageInfo;
class LocatableFile;
class SourceCode;
class SourceLocation;
class SpecificTeamDebugInfo;
class TeamDebugInfo : public GlobalTypeLookup, public TeamTypeInformation {
public:
TeamDebugInfo(
DebuggerInterface* debuggerInterface,
Architecture* architecture,
FileManager* fileManager);
~TeamDebugInfo();
status_t Init();
virtual status_t GetType(GlobalTypeCache* cache,
const BString& name,
const TypeLookupConstraints& constraints,
Type*& _type);
virtual bool HasType(GlobalTypeCache* cache,
const BString& name,
const TypeLookupConstraints& constraints);
virtual status_t LookupTypeByName(const BString& name,
const TypeLookupConstraints& constraints,
Type*& _type);
virtual bool TypeExistsByName(const BString& name,
const TypeLookupConstraints& constraints);
status_t LoadImageDebugInfo(const ImageInfo& imageInfo,
LocatableFile* imageFile,
ImageDebugInfoLoadingState& state,
ImageDebugInfo*& _imageDebugInfo);
status_t LoadSourceCode(LocatableFile* file,
FileSourceCode*& _sourceCode);
// returns reference
void ClearSourceCode(LocatableFile* file);
status_t DisassembleFunction(
FunctionInstance* functionInstance,
DisassembledCode*& _sourceCode);
// returns reference
FunctionInstance* MainFunction() const
{ return fMainFunction; }
// team is locked
status_t AddImageDebugInfo(
ImageDebugInfo* imageDebugInfo);
void RemoveImageDebugInfo(
ImageDebugInfo* imageDebugInfo);
ImageDebugInfo* ImageDebugInfoByName(const char* name) const;
Function* FunctionAtSourceLocation(LocatableFile* file,
const SourceLocation& location) const;
Function* FunctionByID(FunctionID* functionID) const;
private:
struct FunctionHashDefinition;
struct SourceFileEntry;
struct SourceFileHashDefinition;
typedef BObjectList<SpecificTeamDebugInfo> SpecificInfoList;
typedef BObjectList<ImageDebugInfo> ImageList;
typedef BOpenHashTable<FunctionHashDefinition> FunctionTable;
typedef BOpenHashTable<SourceFileHashDefinition> SourceFileTable;
private:
status_t _AddFunction(Function* function);
void _RemoveFunction(Function* function);
private:
BLocker fLock;
DebuggerInterface* fDebuggerInterface;
Architecture* fArchitecture;
FileManager* fFileManager;
SpecificInfoList fSpecificInfos;
ImageList fImages;
FunctionTable* fFunctions;
SourceFileTable* fSourceFiles;
GlobalTypeCache* fTypeCache;
FunctionInstance* fMainFunction;
};
#endif // TEAM_DEBUG_INFO_H
@@ -0,0 +1,55 @@
/*
* Copyright 2012-2016, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef VALUE_NODE_MANAGER_H
#define VALUE_NODE_MANAGER_H
#include <Referenceable.h>
#include "ValueNodeContainer.h"
class StackFrame;
class Thread;
class Variable;
class ValueNodeManager : public BReferenceable,
private ValueNodeContainer::Listener {
public:
ValueNodeManager(bool addFrameNodes = true);
virtual ~ValueNodeManager();
status_t SetStackFrame(::Thread* thread,
StackFrame* frame);
bool AddListener(
ValueNodeContainer::Listener* listener);
void RemoveListener(
ValueNodeContainer::Listener* listener);
virtual void ValueNodeChanged(ValueNodeChild* nodeChild,
ValueNode* oldNode, ValueNode* newNode);
virtual void ValueNodeChildrenCreated(ValueNode* node);
virtual void ValueNodeChildrenDeleted(ValueNode* node);
virtual void ValueNodeValueChanged(ValueNode* node);
ValueNodeContainer* GetContainer() const { return fContainer; };
status_t AddChildNodes(ValueNodeChild* nodeChild);
private:
typedef BObjectList<ValueNodeContainer::Listener> ListenerList;
void _AddNode(Variable* variable);
status_t _CreateValueNode(ValueNodeChild* nodeChild);
private:
bool fAddFrameNodes;
ValueNodeContainer* fContainer;
StackFrame* fStackFrame;
::Thread* fThread;
ListenerList fListeners;
};
#endif // VALUE_NODE_MANAGER_H
+219
View File
@@ -0,0 +1,219 @@
/*
* Copyright 2009-2010, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef ELF_FILE_H
#define ELF_FILE_H
#include <sys/types.h>
#include <ByteOrder.h>
#include <SupportDefs.h>
#include <ObjectList.h>
#include <elf_private.h>
#include <util/DoublyLinkedList.h>
#include "Types.h"
class ElfSymbolLookup;
class ElfSymbolLookupSource;
class ElfSection {
public:
ElfSection(const char* name, uint32 type,
int fd, uint64 offset, uint64 size,
target_addr_t loadAddress, uint32 flags,
uint32 linkIndex);
~ElfSection();
const char* Name() const { return fName; }
uint32 Type() const { return fType; }
uint64 Offset() const { return fOffset; }
uint64 Size() const { return fSize; }
const void* Data() const { return fData; }
target_addr_t LoadAddress() const
{ return fLoadAddress; }
bool IsWritable() const
{ return (fFlags & SHF_WRITE) != 0; }
status_t Load();
void Unload();
bool IsLoaded() const { return fLoadCount > 0; }
uint32 LinkIndex() const { return fLinkIndex; }
private:
const char* fName;
uint32 fType;
int fFD;
uint64 fOffset;
uint64 fSize;
void* fData;
target_addr_t fLoadAddress;
uint32 fFlags;
int32 fLoadCount;
uint32 fLinkIndex;
};
class ElfSegment {
public:
ElfSegment(uint32 type, uint64 fileOffset,
uint64 fileSize, target_addr_t loadAddress,
target_size_t loadSize, uint32 flags);
~ElfSegment();
uint32 Type() { return fType; }
uint64 FileOffset() const { return fFileOffset; }
uint64 FileSize() const { return fFileSize; }
target_addr_t LoadAddress() const { return fLoadAddress; }
target_size_t LoadSize() const { return fLoadSize; }
uint32 Flags() const { return fFlags; }
bool IsWritable() const
{ return (fFlags & PF_WRITE) != 0; }
private:
uint64 fFileOffset;
uint64 fFileSize;
target_addr_t fLoadAddress;
target_size_t fLoadSize;
uint32 fType;
uint32 fFlags;
};
struct ElfClass32 {
typedef uint32 Address;
typedef uint32 Size;
typedef Elf32_Ehdr Ehdr;
typedef Elf32_Phdr Phdr;
typedef Elf32_Shdr Shdr;
typedef Elf32_Sym Sym;
typedef Elf32_Nhdr Nhdr;
typedef Elf32_Note_Team NoteTeam;
typedef Elf32_Note_Area_Entry NoteAreaEntry;
typedef Elf32_Note_Image_Entry NoteImageEntry;
typedef Elf32_Note_Thread_Entry NoteThreadEntry;
};
struct ElfClass64 {
typedef uint64 Address;
typedef uint64 Size;
typedef Elf64_Ehdr Ehdr;
typedef Elf64_Phdr Phdr;
typedef Elf64_Shdr Shdr;
typedef Elf64_Sym Sym;
typedef Elf64_Nhdr Nhdr;
typedef Elf64_Note_Team NoteTeam;
typedef Elf64_Note_Area_Entry NoteAreaEntry;
typedef Elf64_Note_Image_Entry NoteImageEntry;
typedef Elf64_Note_Thread_Entry NoteThreadEntry;
};
class ElfFile {
public:
ElfFile();
~ElfFile();
status_t Init(const char* fileName);
int FD() const { return fFD; }
bool Is64Bit() const { return f64Bit; }
bool IsByteOrderSwapped() const
{ return fSwappedByteOrder; }
uint16 Type() const { return fType; }
uint16 Machine() const { return fMachine; }
int32 CountSection() const
{ return fSections.CountItems(); }
ElfSection* SectionAt(int32 index) const
{ return fSections.ItemAt(index); }
ElfSection* GetSection(const char* name);
void PutSection(ElfSection* section);
ElfSection* FindSection(const char* name) const;
ElfSection* FindSection(uint32 type) const;
int32 CountSegments() const
{ return fSegments.CountItems(); }
ElfSegment* SegmentAt(int32 index) const
{ return fSegments.ItemAt(index); }
ElfSegment* TextSegment() const;
ElfSegment* DataSegment() const;
ElfSymbolLookupSource* CreateSymbolLookupSource(uint64 fileOffset,
uint64 fileLength,
uint64 memoryAddress) const;
status_t CreateSymbolLookup(uint64 textDelta,
ElfSymbolLookup*& _lookup) const;
template<typename Value>
Value Get(const Value& value) const
{ return StaticGet(value,
fSwappedByteOrder); }
template<typename Value>
static Value StaticGet(const Value& value,
bool swappedByteOrder);
private:
struct SymbolLookupSource;
typedef BObjectList<ElfSection> SectionList;
typedef BObjectList<ElfSegment> SegmentList;
private:
template<typename ElfClass>
status_t _LoadFile(const char* fileName);
bool _FindSymbolSections(ElfSection*& _symbolSection,
ElfSection*& _stringSection,
uint32 type) const;
bool _CheckRange(uint64 offset, uint64 size) const;
template<typename ElfClass>
bool _CheckElfHeader(
typename ElfClass::Ehdr& elfHeader);
static uint8 _Swap(const uint8& value)
{ return value; }
static uint16 _Swap(const uint16& value)
{ return (uint16)B_SWAP_INT16(value); }
static int32 _Swap(const int32& value)
{ return B_SWAP_INT32(value); }
static uint32 _Swap(const uint32& value)
{ return (uint32)B_SWAP_INT32(value); }
static int64 _Swap(const int64& value)
{ return B_SWAP_INT64(value); }
static uint64 _Swap(const uint64& value)
{ return (uint64)B_SWAP_INT64(value); }
private:
uint64 fFileSize;
int fFD;
uint16 fType;
uint16 fMachine;
bool f64Bit;
bool fSwappedByteOrder;
SectionList fSections;
SegmentList fSegments;
};
template<typename Value>
/*static*/ inline Value
ElfFile::StaticGet(const Value& value, bool swappedByteOrder)
{
if (!swappedByteOrder)
return value;
return _Swap(value);
}
#endif // ELF_FILE_H
@@ -0,0 +1,38 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef LOCATABLE_DIRECTORY_H
#define LOCATABLE_DIRECTORY_H
#include "LocatableEntry.h"
class LocatableDirectory : public LocatableEntry {
public:
LocatableDirectory(LocatableEntryOwner* owner,
LocatableDirectory* parent,
const BString& path);
~LocatableDirectory();
virtual const char* Name() const;
const char* Path() const;
void GetPath(BString& _path) const;
// mutable (requires locking)
virtual bool GetLocatedPath(BString& _path) const;
virtual void SetLocatedPath(const BString& path,
bool implicit);
void AddEntry(LocatableEntry* entry);
void RemoveEntry(LocatableEntry* entry);
const LocatableEntryList& Entries() const { return fEntries; }
private:
BString fPath;
BString fLocatedPath;
LocatableEntryList fEntries;
};
#endif // LOCATABLE_DIRECTORY_H
@@ -0,0 +1,69 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef LOCATABLE_ENTRY_H
#define LOCATABLE_ENTRY_H
#include <String.h>
#include <Referenceable.h>
#include <util/DoublyLinkedList.h>
#include <util/OpenHashTable.h>
enum locatable_entry_state {
LOCATABLE_ENTRY_UNLOCATED,
LOCATABLE_ENTRY_LOCATED_IMPLICITLY,
LOCATABLE_ENTRY_LOCATED_EXPLICITLY
};
class LocatableDirectory;
class LocatableEntry;
class LocatableEntryOwner {
public:
virtual ~LocatableEntryOwner();
virtual bool Lock() = 0;
virtual void Unlock() = 0;
virtual void LocatableEntryUnused(LocatableEntry* entry) = 0;
};
class LocatableEntry : public BReferenceable,
public DoublyLinkedListLinkImpl<LocatableEntry> {
public:
LocatableEntry(LocatableEntryOwner* owner,
LocatableDirectory* parent);
~LocatableEntry();
LocatableDirectory* Parent() const { return fParent; }
virtual const char* Name() const = 0;
// mutable (requires locking)
locatable_entry_state State() const { return fState; }
virtual bool GetLocatedPath(BString& _path) const = 0;
virtual void SetLocatedPath(const BString& path,
bool implicit) = 0;
protected:
virtual void LastReferenceReleased();
protected:
LocatableEntryOwner* fOwner;
LocatableDirectory* fParent;
locatable_entry_state fState;
public:
LocatableEntry* fNext;
};
typedef DoublyLinkedList<LocatableEntry> LocatableEntryList;
#endif // LOCATABLE_ENTRY_H
@@ -0,0 +1,56 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef LOCATABLE_FILE_H
#define LOCATABLE_FILE_H
#include <ObjectList.h>
#include "LocatableEntry.h"
class LocatableFile : public LocatableEntry {
public:
class Listener;
public:
LocatableFile(LocatableEntryOwner* owner,
LocatableDirectory* directory,
const BString& name);
~LocatableFile();
virtual const char* Name() const;
void GetPath(BString& _path) const;
// mutable (requires/does locking)
virtual bool GetLocatedPath(BString& _path) const;
virtual void SetLocatedPath(const BString& path,
bool implicit);
bool AddListener(Listener* listener);
void RemoveListener(Listener* listener);
private:
typedef BObjectList<Listener> ListenerList;
private:
void _NotifyListeners();
private:
BString fName;
BString fLocatedPath;
ListenerList fListeners;
};
class LocatableFile::Listener {
public:
virtual ~Listener();
virtual void LocatableFileChanged(LocatableFile* file) = 0;
// called with lock held
};
#endif // LOCATABLE_FILE_H
@@ -0,0 +1,47 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef SOURCE_FILE_H
#define SOURCE_FILE_H
#include <Referenceable.h>
class SourceFile;
class SourceFileOwner {
public:
virtual ~SourceFileOwner();
virtual void SourceFileUnused(SourceFile* sourceFile) = 0;
virtual void SourceFileDeleted(SourceFile* sourceFile) = 0;
};
class SourceFile : public BReferenceable {
public:
SourceFile(SourceFileOwner* owner);
~SourceFile();
status_t Init(const char* path);
int32 CountLines() const;
const char* LineAt(int32 index) const;
int32 LineLengthAt(int32 index) const;
protected:
virtual void LastReferenceReleased();
private:
SourceFileOwner* fOwner;
char* fFileContent;
int32* fLineOffsets;
int32 fLineCount;
};
#endif // SOURCE_FILE_H
+70
View File
@@ -0,0 +1,70 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef FUNCTION_ID_H
#define FUNCTION_ID_H
#include <Archivable.h>
#include <String.h>
#include "ObjectID.h"
class FunctionID : public ObjectID, public BArchivable {
protected:
FunctionID(const BMessage& archive);
FunctionID(const BString& path,
const BString& functionName);
public:
virtual ~FunctionID();
virtual status_t Archive(BMessage* archive,
bool deep = true) const;
const BString& FunctionName() const { return fFunctionName; }
protected:
virtual uint32 ComputeHashValue() const;
bool IsValid() const;
protected:
BString fPath;
BString fFunctionName;
};
class SourceFunctionID : public FunctionID {
public:
SourceFunctionID(const BMessage& archive);
SourceFunctionID(const BString& sourceFilePath,
const BString& functionName);
virtual ~SourceFunctionID();
static BArchivable* Instantiate(BMessage* archive);
const BString& SourceFilePath() const { return fPath; }
virtual bool operator==(const ObjectID& other) const;
};
class ImageFunctionID : public FunctionID {
public:
ImageFunctionID(const BMessage& archive);
ImageFunctionID(const BString& imageName,
const BString& functionName);
virtual ~ImageFunctionID();
static BArchivable* Instantiate(BMessage* archive);
const BString& ImageName() const { return fPath; }
virtual bool operator==(const ObjectID& other) const;
};
#endif // FUNCTION_ID_H
@@ -0,0 +1,18 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef FUNCTION_PARAMETER_ID_H
#define FUNCTION_PARAMETER_ID_H
#include "ObjectID.h"
class FunctionParameterID : public ObjectID {
public:
virtual ~FunctionParameterID();
};
#endif // FUNCTION_PARAMETER_ID_H
@@ -0,0 +1,18 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef LOCAL_VARIABLE_ID_H
#define LOCAL_VARIABLE_ID_H
#include "ObjectID.h"
class LocalVariableID : public ObjectID {
public:
virtual ~LocalVariableID();
};
#endif // LOCAL_VARIABLE_ID_H
+46
View File
@@ -0,0 +1,46 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef OBJECT_ID_H
#define OBJECT_ID_H
#include <Referenceable.h>
class ObjectID : public BReferenceable {
public:
ObjectID();
virtual ~ObjectID();
inline uint32 HashValue() const;
virtual bool operator==(const ObjectID& other) const = 0;
inline bool operator!=(const ObjectID& other) const;
protected:
virtual uint32 ComputeHashValue() const = 0;
protected:
mutable uint32 fHashValue;
};
uint32
ObjectID::HashValue() const
{
if (fHashValue == 0)
fHashValue = ComputeHashValue();
return fHashValue;
}
bool
ObjectID::operator!=(const ObjectID& other) const
{
return !(*this == other);
}
#endif // OBJECT_ID_H
@@ -0,0 +1,18 @@
/*
* Copyright 2012, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef RETURN_VALUE_ID_H
#define RETURN_VALUE_ID_H
#include "ObjectID.h"
class ReturnValueID : public ObjectID {
public:
virtual ~ReturnValueID();
};
#endif // RETURN_VALUE_ID_H
+51
View File
@@ -0,0 +1,51 @@
/*
* Copyright 2013, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef AREA_INFO_H
#define AREA_INFO_H
#include <OS.h>
#include <String.h>
#include "Types.h"
class AreaInfo {
public:
AreaInfo();
AreaInfo(const AreaInfo& other);
AreaInfo(team_id team, area_id area,
const BString& name, target_addr_t address,
target_size_t size, target_size_t ram_size,
uint32 lock, uint32 protection);
void SetTo(team_id team, area_id area,
const BString& name, target_addr_t address,
target_size_t size, target_size_t ram_size,
uint32 lock, uint32 protection);
team_id TeamID() const { return fTeam; }
area_id AreaID() const { return fArea; }
const BString& Name() const { return fName; }
target_addr_t BaseAddress() const { return fAddress; }
target_size_t Size() const { return fSize; }
target_size_t RamSize() const { return fRamSize; }
uint32 Lock() const { return fLock; }
uint32 Protection() const { return fProtection; }
private:
team_id fTeam;
area_id fArea;
BString fName;
target_addr_t fAddress;
target_size_t fSize;
target_size_t fRamSize;
uint32 fLock;
uint32 fProtection;
};
#endif // AREA_INFO_H
@@ -0,0 +1,68 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef BREAKPOINT_H
#define BREAKPOINT_H
#include "UserBreakpoint.h"
class Image;
class BreakpointClient {
public:
virtual ~BreakpointClient();
};
class Breakpoint : public BReferenceable {
public:
Breakpoint(Image* image, target_addr_t address);
~Breakpoint();
Image* GetImage() const { return fImage; }
target_addr_t Address() const { return fAddress; }
bool IsInstalled() const { return fInstalled; }
void SetInstalled(bool installed);
bool ShouldBeInstalled() const;
bool IsUnused() const;
bool HasEnabledUserBreakpoint() const;
UserBreakpointInstance* FirstUserBreakpoint() const
{ return fUserBreakpoints.Head(); }
UserBreakpointInstance* LastUserBreakpoint() const
{ return fUserBreakpoints.Tail(); }
const UserBreakpointInstanceList& UserBreakpoints() const
{ return fUserBreakpoints; }
void AddUserBreakpoint(
UserBreakpointInstance* instance);
void RemoveUserBreakpoint(
UserBreakpointInstance* instance);
bool AddClient(BreakpointClient* client);
void RemoveClient(BreakpointClient* client);
static int CompareBreakpoints(const Breakpoint* a,
const Breakpoint* b);
static int CompareAddressBreakpoint(
const target_addr_t* address,
const Breakpoint* breakpoint);
private:
typedef BObjectList<BreakpointClient> ClientList;
private:
target_addr_t fAddress;
Image* fImage;
UserBreakpointInstanceList fUserBreakpoints;
ClientList fClients;
bool fInstalled;
};
#endif // BREAKPOINT_H
@@ -0,0 +1,72 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef DISASSEMBLED_CODE_H
#define DISASSEMBLED_CODE_H
#include <ObjectList.h>
#include "SourceCode.h"
class BString;
class ContiguousStatement;
class DisassembledCode : public SourceCode {
public:
DisassembledCode(SourceLanguage* language);
~DisassembledCode();
virtual bool Lock();
virtual void Unlock();
virtual SourceLanguage* GetSourceLanguage() const;
virtual bool GetStatementLocationRange(
const SourceLocation& location,
SourceLocation& _start,
SourceLocation& _end) const;
virtual LocatableFile* GetSourceFile() const;
Statement* StatementAtAddress(target_addr_t address) const;
Statement* StatementAtLocation(
const SourceLocation& location) const;
TargetAddressRange StatementAddressRange() const;
// LineDataSource
virtual int32 CountLines() const;
virtual const char* LineAt(int32 index) const;
virtual int32 LineLengthAt(int32 index) const;
public:
bool AddCommentLine(const BString& line);
bool AddInstructionLine(const BString& line,
target_addr_t address, target_size_t size);
// instructions must be added in
// ascending address order
private:
struct Line;
typedef BObjectList<Line> LineList;
typedef BObjectList<ContiguousStatement> StatementList;
private:
bool _AddLine(const BString& line,
ContiguousStatement* statement);
static int _CompareAddressStatement(
const target_addr_t* address,
const ContiguousStatement* statement);
private:
SourceLanguage* fLanguage;
LineList fLines;
StatementList fStatements;
};
#endif // DISASSEMBLED_CODE_H
@@ -0,0 +1,97 @@
/*
* Copyright 2014, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef EXPRESSION_INFO_H
#define EXPRESSION_INFO_H
#include <String.h>
#include <Referenceable.h>
#include <util/DoublyLinkedList.h>
#include <Variant.h>
class Type;
class Value;
class ValueNodeChild;
enum expression_result_kind {
EXPRESSION_RESULT_KIND_UNKNOWN = 0,
EXPRESSION_RESULT_KIND_PRIMITIVE,
EXPRESSION_RESULT_KIND_VALUE_NODE,
EXPRESSION_RESULT_KIND_TYPE
};
class ExpressionResult : public BReferenceable {
public:
ExpressionResult();
virtual ~ExpressionResult();
expression_result_kind Kind() const { return fResultKind; }
Value* PrimitiveValue() const
{ return fPrimitiveValue; }
ValueNodeChild* ValueNodeValue() const
{ return fValueNodeValue; }
Type* GetType() const
{ return fTypeResult; }
void SetToPrimitive(Value* value);
void SetToValueNode(ValueNodeChild* child);
void SetToType(Type* type);
private:
void _Unset();
private:
expression_result_kind fResultKind;
Value* fPrimitiveValue;
ValueNodeChild* fValueNodeValue;
Type* fTypeResult;
};
class ExpressionInfo : public BReferenceable {
public:
class Listener;
public:
ExpressionInfo();
ExpressionInfo(const ExpressionInfo& other);
ExpressionInfo(const BString& expression);
virtual ~ExpressionInfo();
void SetTo(const BString& expression);
const BString& Expression() const { return fExpression; }
void AddListener(Listener* listener);
void RemoveListener(Listener* listener);
void NotifyExpressionEvaluated(status_t result,
ExpressionResult* value);
private:
typedef DoublyLinkedList<Listener> ListenerList;
private:
BString fExpression;
ListenerList fListeners;
};
class ExpressionInfo::Listener : public DoublyLinkedListLinkImpl<Listener> {
public:
virtual ~Listener();
virtual void ExpressionEvaluated(ExpressionInfo* info,
status_t result,
ExpressionResult* value) = 0;
};
#endif // EXPRESSION_INFO_H
@@ -0,0 +1,82 @@
/*
* Copyright 2014, Rene Gollent, [email protected].
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef EXPRESSION_VALUES_H
#define EXPRESSION_VALUES_H
#include <String.h>
#include <Referenceable.h>
#include <util/OpenHashTable.h>
#include <Variant.h>
class FunctionID;
class Thread;
class ExpressionValues : public BReferenceable {
public:
ExpressionValues();
ExpressionValues(const ExpressionValues& other);
// throws std::bad_alloc
virtual ~ExpressionValues();
status_t Init();
bool GetValue(FunctionID* function,
Thread* thread,
const BString* expression,
BVariant& _value) const;
inline bool GetValue(FunctionID* function,
Thread* thread,
const BString& expression,
BVariant& _value) const;
bool HasValue(FunctionID* function,
Thread* thread,
const BString* expression) const;
inline bool HasValue(FunctionID* function,
Thread* thread,
const BString& expression) const;
status_t SetValue(FunctionID* function,
Thread* thread,
const BString& expression,
const BVariant& value);
private:
struct Key;
struct ValueEntry;
struct ValueEntryHashDefinition;
typedef BOpenHashTable<ValueEntryHashDefinition> ValueTable;
private:
ExpressionValues& operator=(const ExpressionValues& other);
void _Cleanup();
private:
ValueTable* fValues;
};
bool
ExpressionValues::GetValue(FunctionID* function, Thread* thread,
const BString& expression, BVariant& _value) const
{
return GetValue(function, thread, &expression, _value);
}
bool
ExpressionValues::HasValue(FunctionID* function, Thread* thread,
const BString& expression) const
{
return HasValue(function, thread, &expression);
}
#endif // EXPRESSION_VALUES_H
@@ -0,0 +1,62 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef FILE_SOURCE_CODE_H
#define FILE_SOURCE_CODE_H
#include <Locker.h>
#include <Array.h>
#include "SourceCode.h"
class LocatableFile;
class SourceFile;
class FileSourceCode : public SourceCode {
public:
FileSourceCode(LocatableFile* file,
SourceFile* sourceFile,
SourceLanguage* language);
virtual ~FileSourceCode();
status_t Init();
status_t AddSourceLocation(
const SourceLocation& location);
virtual bool Lock();
virtual void Unlock();
virtual SourceLanguage* GetSourceLanguage() const;
virtual bool GetStatementLocationRange(
const SourceLocation& location,
SourceLocation& _start,
SourceLocation& _end) const;
virtual LocatableFile* GetSourceFile() const;
// LineDataSource
virtual int32 CountLines() const;
virtual const char* LineAt(int32 index) const;
virtual int32 LineLengthAt(int32 index) const;
private:
int32 _FindSourceLocationIndex(
const SourceLocation& location,
bool& _foundMatch) const;
private:
BLocker fLock;
LocatableFile* fFile;
SourceFile* fSourceFile;
SourceLanguage* fLanguage;
Array<SourceLocation> fSourceLocations;
};
#endif // FILE_BASED_SOURCE_CODE_H
+66
View File
@@ -0,0 +1,66 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef IMAGE_H
#define IMAGE_H
#include <image.h>
#include <Referenceable.h>
#include <util/DoublyLinkedList.h>
#include "ImageInfo.h"
enum image_debug_info_state {
IMAGE_DEBUG_INFO_NOT_LOADED,
IMAGE_DEBUG_INFO_LOADING,
IMAGE_DEBUG_INFO_LOADED,
IMAGE_DEBUG_INFO_UNAVAILABLE
};
class ImageDebugInfo;
class LocatableFile;
class Team;
class Image : public BReferenceable, public DoublyLinkedListLinkImpl<Image> {
public:
Image(Team* team, const ImageInfo& imageInfo,
LocatableFile* imageFile);
~Image();
status_t Init();
Team* GetTeam() const { return fTeam; }
image_id ID() const { return fInfo.ImageID(); }
const BString& Name() const { return fInfo.Name(); }
const ImageInfo& Info() const { return fInfo; }
image_type Type() const { return fInfo.Type(); }
LocatableFile* ImageFile() const { return fImageFile; }
bool ContainsAddress(target_addr_t address) const;
// mutable attributes follow (locking required)
ImageDebugInfo* GetImageDebugInfo() const { return fDebugInfo; }
image_debug_info_state ImageDebugInfoState() const
{ return fDebugInfoState; }
status_t SetImageDebugInfo(ImageDebugInfo* debugInfo,
image_debug_info_state state);
private:
Team* fTeam;
ImageInfo fInfo;
LocatableFile* fImageFile;
// mutable
ImageDebugInfo* fDebugInfo;
image_debug_info_state fDebugInfoState;
};
typedef DoublyLinkedList<Image> ImageList;
#endif // IMAGE_H
@@ -0,0 +1,54 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef IMAGE_INFO_H
#define IMAGE_INFO_H
#include <image.h>
#include <String.h>
#include "Types.h"
class ImageInfo {
public:
ImageInfo();
ImageInfo(const ImageInfo& other);
ImageInfo(team_id team, image_id image,
const BString& name, image_type type,
target_addr_t textBase,
target_size_t textSize,
target_addr_t dataBase,
target_size_t dataSize);
void SetTo(team_id team, image_id image,
const BString& name, image_type type,
target_addr_t textBase,
target_size_t textSize,
target_addr_t dataBase,
target_size_t dataSize);
team_id TeamID() const { return fTeam; }
image_id ImageID() const { return fImage; }
const BString& Name() const { return fName; }
image_type Type() const { return fType; }
target_addr_t TextBase() const { return fTextBase; }
target_size_t TextSize() const { return fTextSize; }
target_addr_t DataBase() const { return fDataBase; }
target_size_t DataSize() const { return fDataSize; }
private:
thread_id fTeam;
image_id fImage;
BString fName;
image_type fType;
target_addr_t fTextBase;
target_size_t fTextSize;
target_addr_t fDataBase;
target_size_t fDataSize;
};
#endif // IMAGE_INFO_H
@@ -0,0 +1,22 @@
/*
* Copyright 2014, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef LINE_DATA_SOURCE_H
#define LINE_DATA_SOURCE_H
#include <Referenceable.h>
class LineDataSource : public BReferenceable {
public:
virtual ~LineDataSource();
virtual int32 CountLines() const = 0;
virtual const char* LineAt(int32 index) const = 0;
virtual int32 LineLengthAt(int32 index) const = 0;
};
#endif // LINE_DATA_SOURCE_H
@@ -0,0 +1,39 @@
/*
* Copyright 2013, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef RETURN_VALUE_INFO_H
#define RETURN_VALUE_INFO_H
#include "ObjectList.h"
#include "Referenceable.h"
#include "Types.h"
class CpuState;
class ReturnValueInfo : public BReferenceable {
public:
ReturnValueInfo();
ReturnValueInfo(target_addr_t address,
CpuState* state);
~ReturnValueInfo();
void SetTo(target_addr_t address, CpuState* state);
target_addr_t SubroutineAddress() const
{ return fAddress; }
CpuState* State() const { return fState; }
private:
target_addr_t fAddress;
CpuState* fState;
};
typedef BObjectList<ReturnValueInfo> ReturnValueInfoList;
#endif // RETURN_VALUE_INFO_H
@@ -0,0 +1,42 @@
/*
* Copyright 2013, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef SEMAPHORE_INFO_H
#define SEMAPHORE_INFO_H
#include <OS.h>
#include <String.h>
#include "Types.h"
class SemaphoreInfo {
public:
SemaphoreInfo();
SemaphoreInfo(const SemaphoreInfo& other);
SemaphoreInfo(team_id team, sem_id semaphore,
const BString& name, int32 count,
thread_id latestHolder);
void SetTo(team_id team, sem_id semaphore,
const BString& name, int32 count,
thread_id latestHolder);
team_id TeamID() const { return fTeam; }
area_id SemID() const { return fSemaphore; }
const BString& Name() const { return fName; }
int32 Count() const { return fCount; }
thread_id LatestHolder() const
{ return fLatestHolder; }
private:
team_id fTeam;
sem_id fSemaphore;
BString fName;
int32 fCount;
thread_id fLatestHolder;
};
#endif // AREA_INFO_H
@@ -0,0 +1,35 @@
/*
* Copyright 2015, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef SIGNAL_INFO_H
#define SIGNAL_INFO_H
#include <signal.h>
#include "Types.h"
class SignalInfo {
public:
SignalInfo();
SignalInfo(const SignalInfo& other);
SignalInfo(int signal,
const struct sigaction& handler,
bool deadly);
void SetTo(int signal,
const struct sigaction& handler,
bool deadly);
int Signal() const { return fSignal; }
const struct sigaction& Handler() const { return fHandler; }
bool Deadly() const { return fDeadly; }
private:
int fSignal;
struct sigaction fHandler;
bool fDeadly;
};
#endif // SIGNAL_INFO_H
@@ -0,0 +1,41 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef SOURCE_CODE_H
#define SOURCE_CODE_H
#include <Referenceable.h>
#include "LineDataSource.h"
#include "TargetAddressRange.h"
class LocatableFile;
class SourceLanguage;
class SourceLocation;
class Statement;
class SourceCode : public LineDataSource {
public:
virtual ~SourceCode();
// Locking needed for GetStatementLocationRange(), since that might use
// mutable data.
virtual bool Lock() = 0;
virtual void Unlock() = 0;
virtual SourceLanguage* GetSourceLanguage() const = 0;
virtual bool GetStatementLocationRange(
const SourceLocation& location,
SourceLocation& _start,
SourceLocation& _end) const = 0;
virtual LocatableFile* GetSourceFile() const = 0;
};
#endif // SOURCE_CODE_H
+122
View File
@@ -0,0 +1,122 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef STACK_FRAME_H
#define STACK_FRAME_H
#include <OS.h>
#include <ObjectList.h>
#include <Referenceable.h>
#include <util/DoublyLinkedList.h>
#include "Types.h"
enum stack_frame_type {
STACK_FRAME_TYPE_SYSCALL, // syscall frame
STACK_FRAME_TYPE_STANDARD, // standard frame
STACK_FRAME_TYPE_SIGNAL, // signal handler frame
STACK_FRAME_TYPE_FRAMELESS // dummy frame for a frameless function
};
class CpuState;
class Image;
class FunctionInstance;
class StackFrameDebugInfo;
class StackFrameValueInfos;
class StackFrameValues;
class TypeComponentPath;
class Variable;
class StackFrame : public BReferenceable {
public:
class Listener;
public:
StackFrame(stack_frame_type type,
CpuState* cpuState,
target_addr_t frameAddress,
target_addr_t instructionPointer,
StackFrameDebugInfo* debugInfo);
~StackFrame();
status_t Init();
stack_frame_type Type() const { return fType; }
CpuState* GetCpuState() const { return fCpuState; }
target_addr_t FrameAddress() const { return fFrameAddress; }
StackFrameDebugInfo* DebugInfo() const { return fDebugInfo; }
target_addr_t InstructionPointer() const
{ return fInstructionPointer; }
CpuState* PreviousCpuState() const
{ return fPreviousCpuState; }
void SetPreviousCpuState(CpuState* state);
target_addr_t ReturnAddress() const { return fReturnAddress; }
void SetReturnAddress(target_addr_t address);
Image* GetImage() const { return fImage; }
void SetImage(Image* image);
FunctionInstance* Function() const { return fFunction; }
void SetFunction(FunctionInstance* function);
int32 CountParameters() const;
Variable* ParameterAt(int32 index) const;
bool AddParameter(Variable* parameter);
int32 CountLocalVariables() const;
Variable* LocalVariableAt(int32 index) const;
bool AddLocalVariable(Variable* variable);
StackFrameValues* Values() const { return fValues; }
StackFrameValueInfos* ValueInfos() const { return fValueInfos; }
// team lock must be held
void AddListener(Listener* listener);
void RemoveListener(Listener* listener);
void NotifyValueRetrieved(Variable* variable,
TypeComponentPath* path);
private:
typedef BObjectList<Variable> VariableList;
typedef DoublyLinkedList<Listener> ListenerList;
private:
stack_frame_type fType;
CpuState* fCpuState;
CpuState* fPreviousCpuState;
target_addr_t fFrameAddress;
target_addr_t fInstructionPointer;
target_addr_t fReturnAddress;
StackFrameDebugInfo* fDebugInfo;
Image* fImage;
FunctionInstance* fFunction;
VariableList fParameters;
VariableList fLocalVariables;
StackFrameValues* fValues;
StackFrameValueInfos* fValueInfos;
ListenerList fListeners;
};
class StackFrame::Listener : public DoublyLinkedListLinkImpl<Listener> {
public:
virtual ~Listener();
virtual void StackFrameValueRetrieved(StackFrame* stackFrame,
Variable* variable,
TypeComponentPath* path);
// called with lock held
};
#endif // STACK_FRAME_H
@@ -0,0 +1,78 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef STACK_FRAME_VALUE_INFOS_H
#define STACK_FRAME_VALUE_INFOS_H
#include <Referenceable.h>
#include <util/OpenHashTable.h>
#include <Variant.h>
class ObjectID;
class Type;
class TypeComponentPath;
class ValueLocation;
class StackFrameValueInfos : public BReferenceable {
public:
StackFrameValueInfos();
virtual ~StackFrameValueInfos();
status_t Init();
bool GetInfo(ObjectID* variable,
const TypeComponentPath* path,
Type** _type, ValueLocation** _location)
const;
// returns references
inline bool GetInfo(ObjectID* variable,
const TypeComponentPath& path,
Type** _type, ValueLocation** _location)
const;
// returns references
bool HasInfo(ObjectID* variable,
const TypeComponentPath* path) const;
inline bool HasInfo(ObjectID* variable,
const TypeComponentPath& path) const;
status_t SetInfo(ObjectID* variable,
TypeComponentPath* path, Type* type,
ValueLocation* location);
private:
struct Key;
struct InfoEntry;
struct InfoEntryHashDefinition;
typedef BOpenHashTable<InfoEntryHashDefinition> ValueTable;
private:
StackFrameValueInfos& operator=(const StackFrameValueInfos& other);
void _Cleanup();
private:
ValueTable* fValues;
};
bool
StackFrameValueInfos::GetInfo(ObjectID* variable, const TypeComponentPath& path,
Type** _type, ValueLocation** _location) const
{
return GetInfo(variable, &path, _type, _location);
}
bool
StackFrameValueInfos::HasInfo(ObjectID* variable, const TypeComponentPath& path)
const
{
return HasInfo(variable, &path);
}
#endif // STACK_FRAME_VALUE_INFOS_H
@@ -0,0 +1,74 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef STACK_FRAME_VALUES_H
#define STACK_FRAME_VALUES_H
#include <Referenceable.h>
#include <util/OpenHashTable.h>
#include <Variant.h>
class ObjectID;
class TypeComponentPath;
class StackFrameValues : public BReferenceable {
public:
StackFrameValues();
StackFrameValues(const StackFrameValues& other);
// throws std::bad_alloc
virtual ~StackFrameValues();
status_t Init();
bool GetValue(ObjectID* variable,
const TypeComponentPath* path,
BVariant& _value) const;
inline bool GetValue(ObjectID* variable,
const TypeComponentPath& path,
BVariant& _value) const;
bool HasValue(ObjectID* variable,
const TypeComponentPath* path) const;
inline bool HasValue(ObjectID* variable,
const TypeComponentPath& path) const;
status_t SetValue(ObjectID* variable,
TypeComponentPath* path,
const BVariant& value);
private:
struct Key;
struct ValueEntry;
struct ValueEntryHashDefinition;
typedef BOpenHashTable<ValueEntryHashDefinition> ValueTable;
private:
StackFrameValues& operator=(const StackFrameValues& other);
void _Cleanup();
private:
ValueTable* fValues;
};
bool
StackFrameValues::GetValue(ObjectID* variable, const TypeComponentPath& path,
BVariant& _value) const
{
return GetValue(variable, &path, _value);
}
bool
StackFrameValues::HasValue(ObjectID* variable, const TypeComponentPath& path)
const
{
return HasValue(variable, &path);
}
#endif // STACK_FRAME_VALUES_H
@@ -0,0 +1,32 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef STACK_TRACE_H
#define STACK_TRACE_H
#include <ObjectList.h>
#include "StackFrame.h"
class StackTrace : public BReferenceable {
public:
StackTrace();
virtual ~StackTrace();
bool AddFrame(StackFrame* frame);
// takes over reference (also on error)
int32 CountFrames() const;
StackFrame* FrameAt(int32 index) const;
private:
typedef BObjectList<StackFrame> StackFrameList;
private:
StackFrameList fStackFrames;
};
#endif // STACK_TRACE_H
@@ -0,0 +1,62 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef STATEMENT_H
#define STATEMENT_H
#include <Referenceable.h>
#include "SourceLocation.h"
#include "TargetAddressRange.h"
#include "Types.h"
class Statement : public BReferenceable {
public:
virtual ~Statement();
virtual SourceLocation StartSourceLocation() const = 0;
virtual TargetAddressRange CoveringAddressRange() const = 0;
virtual int32 CountAddressRanges() const = 0;
virtual TargetAddressRange AddressRangeAt(int32 index) const = 0;
virtual bool ContainsAddress(target_addr_t address)
const = 0;
};
class AbstractStatement : public Statement {
public:
AbstractStatement(const SourceLocation& start);
virtual SourceLocation StartSourceLocation() const;
protected:
SourceLocation fStart;
};
class ContiguousStatement : public AbstractStatement {
public:
ContiguousStatement(const SourceLocation& start,
const TargetAddressRange& range);
const TargetAddressRange& AddressRange() const
{ return fRange; }
virtual TargetAddressRange CoveringAddressRange() const;
virtual int32 CountAddressRanges() const;
virtual TargetAddressRange AddressRangeAt(int32 index) const;
virtual bool ContainsAddress(target_addr_t address) const;
protected:
TargetAddressRange fRange;
};
#endif // STATEMENT_H
@@ -0,0 +1,37 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef SYMBOL_INFO_H
#define SYMBOL_INFO_H
#include <String.h>
#include "Types.h"
class SymbolInfo {
public:
SymbolInfo();
SymbolInfo(target_addr_t address,
target_size_t size, uint32 type,
const BString& name);
~SymbolInfo();
void SetTo(target_addr_t address, target_size_t size,
uint32 type, const BString& name);
target_addr_t Address() const { return fAddress; }
target_size_t Size() const { return fSize; }
uint32 Type() const { return fType; }
const char* Name() const { return fName.String(); }
private:
target_addr_t fAddress;
target_size_t fSize;
uint32 fType;
BString fName;
};
#endif // SYMBOL_INFO_H
@@ -0,0 +1,44 @@
/*
* Copyright 2014, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef SYNTHETIC_PRIMITIVE_TYPE_H
#define SYNTHETIC_PRIMITIVE_TYPE_H
#include "Type.h"
#include <String.h>
class SyntheticPrimitiveType : public PrimitiveType {
public:
SyntheticPrimitiveType(uint32 typeConstant);
virtual ~SyntheticPrimitiveType();
virtual uint32 TypeConstant() const;
virtual image_id ImageID() const;
virtual const BString& ID() const;
virtual const BString& Name() const;
virtual type_kind Kind() const;
virtual target_size_t ByteSize() const;
virtual status_t ResolveObjectDataLocation(
const ValueLocation& objectLocation,
ValueLocation*& _location);
virtual status_t ResolveObjectDataLocation(
target_addr_t objectAddress,
ValueLocation*& _location);
private:
void _Init();
private:
uint32 fTypeConstant;
BString fID;
BString fName;
};
#endif // SYNTHETIC_PRIMITIVE_TYPE
@@ -0,0 +1,43 @@
/*
* Copyright 2013, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef SYSCALL_INFO_H
#define SYSCALL_INFO_H
#include "Types.h"
class SyscallInfo {
public:
SyscallInfo();
SyscallInfo(const SyscallInfo& other);
SyscallInfo(bigtime_t startTime,
bigtime_t endTime,
uint64 returnValue,
uint32 syscall,
const uint8* args);
void SetTo(bigtime_t startTime,
bigtime_t endTime,
uint64 returnValue,
uint32 syscall,
const uint8* args);
bigtime_t StartTime() const { return fStartTime; }
bigtime_t EndTime() const { return fEndTime; }
uint64 ReturnValue() const { return fReturnValue; }
uint32 Syscall() const { return fSyscall; }
const uint8* Arguments() const { return fArguments; }
private:
bigtime_t fStartTime;
bigtime_t fEndTime;
uint64 fReturnValue;
uint32 fSyscall;
uint8 fArguments[128];
};
#endif // SYSCALL_INFO_H
@@ -0,0 +1,40 @@
/*
* Copyright 2013, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef SYSTEM_INFO_H
#define SYSTEM_INFO_H
#include <sys/utsname.h>
#include <OS.h>
#include <String.h>
#include "Types.h"
class SystemInfo {
public:
SystemInfo();
SystemInfo(const SystemInfo& other);
SystemInfo(team_id team,
const system_info& info,
const utsname& name);
void SetTo(team_id team, const system_info& info,
const utsname& name);
team_id TeamID() const { return fTeam; }
const system_info& GetSystemInfo() const { return fSystemInfo; }
const utsname& GetSystemName() const { return fSystemName; }
private:
team_id fTeam;
system_info fSystemInfo;
utsname fSystemName;
};
#endif // SYSTEM_INFO_H
@@ -0,0 +1,74 @@
/*
* Copyright 2016, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TARGET_HOST_H
#define TARGET_HOST_H
#include <Locker.h>
#include <OS.h>
#include <String.h>
#include <ObjectList.h>
#include <Referenceable.h>
#include <util/DoublyLinkedList.h>
class TeamInfo;
class TargetHost : public BReferenceable {
public:
class Listener;
public:
TargetHost(const BString& name);
virtual ~TargetHost();
bool Lock() { return fLock.Lock(); }
void Unlock() { fLock.Unlock(); }
const BString& Name() const { return fName; }
void AddListener(Listener* listener);
void RemoveListener(Listener* listener);
int32 CountTeams() const;
status_t AddTeam(const team_info& info);
void RemoveTeam(team_id team);
void UpdateTeam(const team_info& info);
TeamInfo* TeamInfoAt(int32 index) const;
TeamInfo* TeamInfoByID(team_id team) const;
private:
typedef DoublyLinkedList<Listener> ListenerList;
typedef BObjectList<TeamInfo> TeamInfoList;
private:
static int _CompareTeams(const TeamInfo* a,
const TeamInfo* b);
static int _FindTeamByKey(const team_id* id,
const TeamInfo* info);
void _NotifyTeamAdded(TeamInfo* info);
void _NotifyTeamRemoved(team_id team);
void _NotifyTeamRenamed(TeamInfo* info);
private:
BString fName;
BLocker fLock;
ListenerList fListeners;
TeamInfoList fTeams;
};
class TargetHost::Listener
: public DoublyLinkedListLinkImpl<TargetHost::Listener> {
public:
virtual ~Listener();
virtual void TeamAdded(TeamInfo* info);
virtual void TeamRemoved(team_id team);
virtual void TeamRenamed(TeamInfo* info);
};
#endif // TARGET_HOST_H
+561
View File
@@ -0,0 +1,561 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2013-2016, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TEAM_H
#define TEAM_H
#include <map>
#include <Locker.h>
#include <StringList.h>
#include <ObjectList.h>
#include "Image.h"
#include "ImageInfo.h"
#include "TargetAddressRange.h"
#include "Thread.h"
#include "ThreadInfo.h"
#include "UserBreakpoint.h"
#include "Watchpoint.h"
// team event types
enum {
TEAM_EVENT_TEAM_RENAMED,
TEAM_EVENT_THREAD_ADDED,
TEAM_EVENT_THREAD_REMOVED,
TEAM_EVENT_IMAGE_ADDED,
TEAM_EVENT_IMAGE_REMOVED,
TEAM_EVENT_THREAD_STATE_CHANGED,
TEAM_EVENT_THREAD_CPU_STATE_CHANGED,
TEAM_EVENT_THREAD_STACK_TRACE_CHANGED,
TEAM_EVENT_IMAGE_DEBUG_INFO_CHANGED,
TEAM_EVENT_IMAGE_LOAD_SETTINGS_CHANGED,
TEAM_EVENT_IMAGE_LOAD_NAME_ADDED,
TEAM_EVENT_IMAGE_LOAD_NAME_REMOVED,
TEAM_EVENT_DEFAULT_SIGNAL_DISPOSITION_CHANGED,
TEAM_EVENT_CUSTOM_SIGNAL_DISPOSITION_CHANGED,
TEAM_EVENT_CUSTOM_SIGNAL_DISPOSITION_REMOVED,
TEAM_EVENT_CONSOLE_OUTPUT_RECEIVED,
TEAM_EVENT_BREAKPOINT_ADDED,
TEAM_EVENT_BREAKPOINT_REMOVED,
TEAM_EVENT_USER_BREAKPOINT_CHANGED,
TEAM_EVENT_WATCHPOINT_ADDED,
TEAM_EVENT_WATCHPOINT_REMOVED,
TEAM_EVENT_WATCHPOINT_CHANGED,
TEAM_EVENT_DEBUG_REPORT_CHANGED,
TEAM_EVENT_CORE_FILE_CHANGED,
TEAM_EVENT_MEMORY_CHANGED
};
class Architecture;
class Breakpoint;
class BStringList;
class Function;
class FunctionID;
class FunctionInstance;
class LocatableFile;
class SourceCode;
class SourceLocation;
class Statement;
class TeamDebugInfo;
class TeamMemory;
class TeamTypeInformation;
class UserBreakpoint;
class Value;
typedef std::map<int32, int32> SignalDispositionMappings;
class Team {
public:
class Event;
class BreakpointEvent;
class ConsoleOutputEvent;
class DebugReportEvent;
class MemoryChangedEvent;
class ImageEvent;
class ImageLoadEvent;
class ImageLoadNameEvent;
class DefaultSignalDispositionEvent;
class CustomSignalDispositionEvent;
class ThreadEvent;
class UserBreakpointEvent;
class WatchpointEvent;
class CoreFileChangedEvent;
class Listener;
public:
Team(team_id teamID, TeamMemory* teamMemory,
Architecture* architecture,
TeamDebugInfo* debugInfo,
TeamTypeInformation* typeInformation);
~Team();
status_t Init();
bool Lock() { return fLock.Lock(); }
void Unlock() { fLock.Unlock(); }
team_id ID() const { return fID; }
TeamMemory* GetTeamMemory() const
{ return fTeamMemory; }
Architecture* GetArchitecture() const
{ return fArchitecture; }
TeamDebugInfo* DebugInfo() const { return fDebugInfo; }
TeamTypeInformation*
GetTeamTypeInformation() const
{ return fTypeInformation; }
const char* Name() const { return fName.String(); }
void SetName(const BString& name);
void AddThread(::Thread* thread);
status_t AddThread(const ThreadInfo& threadInfo,
::Thread** _thread = NULL);
void RemoveThread(::Thread* thread);
bool RemoveThread(thread_id threadID);
::Thread* ThreadByID(thread_id threadID) const;
const ThreadList& Threads() const;
status_t AddImage(const ImageInfo& imageInfo,
LocatableFile* imageFile,
Image** _image = NULL);
void RemoveImage(Image* image);
bool RemoveImage(image_id imageID);
Image* ImageByID(image_id imageID) const;
Image* ImageByAddress(target_addr_t address) const;
const ImageList& Images() const;
void ClearImages();
bool AddStopImageName(const BString& name);
void RemoveStopImageName(const BString& name);
const BStringList& StopImageNames() const;
void SetStopOnImageLoad(bool enabled,
bool useImageNameList);
bool StopOnImageLoad() const
{ return fStopOnImageLoad; }
bool StopImageNameListEnabled() const
{ return fStopImageNameListEnabled; }
void SetDefaultSignalDisposition(int32 disposition);
int32 DefaultSignalDisposition() const
{ return fDefaultSignalDisposition; }
bool SetCustomSignalDisposition(int32 signal,
int32 disposition);
void RemoveCustomSignalDisposition(int32 signal);
int32 SignalDispositionFor(int32 signal) const;
// if no custom disposition is found,
// returns default
const SignalDispositionMappings&
GetSignalDispositionMappings() const;
void ClearSignalDispositionMappings();
bool AddBreakpoint(Breakpoint* breakpoint);
// takes over reference (also on error)
void RemoveBreakpoint(Breakpoint* breakpoint);
// releases its own reference
int32 CountBreakpoints() const;
Breakpoint* BreakpointAt(int32 index) const;
Breakpoint* BreakpointAtAddress(
target_addr_t address) const;
void GetBreakpointsInAddressRange(
TargetAddressRange range,
BObjectList<UserBreakpoint>& breakpoints)
const;
void GetBreakpointsForSourceCode(
SourceCode* sourceCode,
BObjectList<UserBreakpoint>& breakpoints)
const;
void AddUserBreakpoint(
UserBreakpoint* userBreakpoint);
void RemoveUserBreakpoint(
UserBreakpoint* userBreakpoint);
const UserBreakpointList& UserBreakpoints() const
{ return fUserBreakpoints; }
bool AddWatchpoint(Watchpoint* watchpoint);
// takes over reference (also on error)
void RemoveWatchpoint(Watchpoint* watchpoint);
// releases its own reference
int32 CountWatchpoints() const;
Watchpoint* WatchpointAt(int32 index) const;
Watchpoint* WatchpointAtAddress(
target_addr_t address) const;
void GetWatchpointsInAddressRange(
TargetAddressRange range,
BObjectList<Watchpoint>& watchpoints)
const;
const WatchpointList& Watchpoints() const
{ return fWatchpoints; }
status_t GetStatementAtAddress(target_addr_t address,
FunctionInstance*& _function,
Statement*& _statement);
// returns a reference to the statement,
// not to the functions instance, though,
// caller must lock
status_t GetStatementAtSourceLocation(
SourceCode* sourceCode,
const SourceLocation& location,
Statement*& _statement);
// returns a reference to the statement
// (any matching statement!),
// caller must lock,
Function* FunctionByID(FunctionID* functionID) const;
void AddListener(Listener* listener);
void RemoveListener(Listener* listener);
// service methods for Thread
void NotifyThreadStateChanged(::Thread* thread);
void NotifyThreadCpuStateChanged(::Thread* thread);
void NotifyThreadStackTraceChanged(
::Thread* thread);
// service methods for Image
void NotifyImageDebugInfoChanged(Image* image);
// service methods for Image load settings
void NotifyStopOnImageLoadChanged(bool enabled,
bool useImageNameList);
void NotifyStopImageNameAdded(const BString& name);
void NotifyStopImageNameRemoved(
const BString& name);
// service methods for Signal Disposition settings
void NotifyDefaultSignalDispositionChanged(
int32 newDisposition);
void NotifyCustomSignalDispositionChanged(
int32 signal, int32 disposition);
void NotifyCustomSignalDispositionRemoved(
int32 signal);
// service methods for console output
void NotifyConsoleOutputReceived(
int32 fd, const BString& output);
// breakpoint related service methods
void NotifyUserBreakpointChanged(
UserBreakpoint* breakpoint);
// watchpoint related service methods
void NotifyWatchpointChanged(
Watchpoint* watchpoint);
// debug report related service methods
void NotifyDebugReportChanged(
const char* reportPath);
// core file related service methods
void NotifyCoreFileChanged(
const char* targetPath);
// memory write related service methods
void NotifyMemoryChanged(target_addr_t address,
target_size_t size);
private:
struct BreakpointByAddressPredicate;
struct WatchpointByAddressPredicate;
typedef BObjectList<Breakpoint> BreakpointList;
typedef DoublyLinkedList<Listener> ListenerList;
private:
void _NotifyTeamRenamed();
void _NotifyThreadAdded(::Thread* thread);
void _NotifyThreadRemoved(::Thread* thread);
void _NotifyImageAdded(Image* image);
void _NotifyImageRemoved(Image* image);
private:
BLocker fLock;
team_id fID;
TeamMemory* fTeamMemory;
TeamTypeInformation*
fTypeInformation;
Architecture* fArchitecture;
TeamDebugInfo* fDebugInfo;
BString fName;
ThreadList fThreads;
ImageList fImages;
bool fStopOnImageLoad;
bool fStopImageNameListEnabled;
BStringList fStopImageNames;
int32 fDefaultSignalDisposition;
SignalDispositionMappings
fCustomSignalDispositions;
BreakpointList fBreakpoints;
WatchpointList fWatchpoints;
UserBreakpointList fUserBreakpoints;
ListenerList fListeners;
};
class Team::Event {
public:
Event(uint32 type, Team* team);
uint32 EventType() const { return fEventType; }
Team* GetTeam() const { return fTeam; }
protected:
uint32 fEventType;
Team* fTeam;
};
class Team::ThreadEvent : public Event {
public:
ThreadEvent(uint32 type, ::Thread* thread);
::Thread* GetThread() const { return fThread; }
protected:
::Thread* fThread;
};
class Team::ImageEvent : public Event {
public:
ImageEvent(uint32 type, Image* image);
Image* GetImage() const { return fImage; }
protected:
Image* fImage;
};
class Team::ImageLoadEvent : public Event {
public:
ImageLoadEvent(uint32 type, Team* team,
bool stopOnImageLoad,
bool stopImageNameListEnabled);
bool StopOnImageLoad() const
{ return fStopOnImageLoad; }
bool StopImageNameListEnabled() const
{ return fStopImageNameListEnabled; }
private:
bool fStopOnImageLoad;
bool fStopImageNameListEnabled;
};
class Team::ImageLoadNameEvent : public Event {
public:
ImageLoadNameEvent(uint32 type, Team* team,
const BString& name);
const BString& ImageName() const { return fImageName; }
private:
BString fImageName;
};
class Team::DefaultSignalDispositionEvent : public Event {
public:
DefaultSignalDispositionEvent(uint32 type,
Team* team, int32 disposition);
int32 DefaultDisposition() const
{ return fDefaultDisposition; }
private:
int32 fDefaultDisposition;
};
class Team::CustomSignalDispositionEvent : public Event {
public:
CustomSignalDispositionEvent(uint32 type,
Team* team, int32 signal,
int32 disposition);
int32 Signal() const { return fSignal; }
int32 Disposition() const { return fDisposition; }
private:
int32 fSignal;
int32 fDisposition;
};
class Team::BreakpointEvent : public Event {
public:
BreakpointEvent(uint32 type, Team* team,
Breakpoint* breakpoint);
Breakpoint* GetBreakpoint() const { return fBreakpoint; }
protected:
Breakpoint* fBreakpoint;
};
class Team::ConsoleOutputEvent : public Event {
public:
ConsoleOutputEvent(uint32 type, Team* team,
int32 fd, const BString& output);
int32 Descriptor() const { return fDescriptor; }
const BString& Output() const { return fOutput; }
protected:
int32 fDescriptor;
BString fOutput;
};
class Team::DebugReportEvent : public Event {
public:
DebugReportEvent(uint32 type, Team* team,
const char* reportPath);
const char* GetReportPath() const { return fReportPath; }
protected:
const char* fReportPath;
};
class Team::CoreFileChangedEvent : public Event {
public:
CoreFileChangedEvent(uint32 type, Team* team,
const char* targetPath);
const char* GetTargetPath() const { return fTargetPath; }
protected:
const char* fTargetPath;
};
class Team::MemoryChangedEvent : public Event {
public:
MemoryChangedEvent(uint32 type, Team* team,
target_addr_t address, target_size_t size);
target_addr_t GetTargetAddress() const
{ return fTargetAddress; }
target_size_t GetSize() const { return fSize; }
protected:
target_addr_t fTargetAddress;
target_size_t fSize;
};
class Team::WatchpointEvent : public Event {
public:
WatchpointEvent(uint32 type, Team* team,
Watchpoint* watchpoint);
Watchpoint* GetWatchpoint() const { return fWatchpoint; }
protected:
Watchpoint* fWatchpoint;
};
class Team::UserBreakpointEvent : public Event {
public:
UserBreakpointEvent(uint32 type, Team* team,
UserBreakpoint* breakpoint);
UserBreakpoint* GetBreakpoint() const { return fBreakpoint; }
protected:
UserBreakpoint* fBreakpoint;
};
class Team::Listener : public DoublyLinkedListLinkImpl<Team::Listener> {
public:
virtual ~Listener();
virtual void TeamRenamed(
const Team::Event& event);
virtual void ThreadAdded(const Team::ThreadEvent& event);
virtual void ThreadRemoved(const Team::ThreadEvent& event);
virtual void ImageAdded(const Team::ImageEvent& event);
virtual void ImageRemoved(const Team::ImageEvent& event);
virtual void ThreadStateChanged(
const Team::ThreadEvent& event);
virtual void ThreadCpuStateChanged(
const Team::ThreadEvent& event);
virtual void ThreadStackTraceChanged(
const Team::ThreadEvent& event);
virtual void ImageDebugInfoChanged(
const Team::ImageEvent& event);
virtual void StopOnImageLoadSettingsChanged(
const Team::ImageLoadEvent& event);
virtual void StopOnImageLoadNameAdded(
const Team::ImageLoadNameEvent& event);
virtual void StopOnImageLoadNameRemoved(
const Team::ImageLoadNameEvent& event);
virtual void DefaultSignalDispositionChanged(
const Team::DefaultSignalDispositionEvent&
event);
virtual void CustomSignalDispositionChanged(
const Team::CustomSignalDispositionEvent&
event);
virtual void CustomSignalDispositionRemoved(
const Team::CustomSignalDispositionEvent&
event);
virtual void ConsoleOutputReceived(
const Team::ConsoleOutputEvent& event);
virtual void BreakpointAdded(
const Team::BreakpointEvent& event);
virtual void BreakpointRemoved(
const Team::BreakpointEvent& event);
virtual void UserBreakpointChanged(
const Team::UserBreakpointEvent& event);
virtual void WatchpointAdded(
const Team::WatchpointEvent& event);
virtual void WatchpointRemoved(
const Team::WatchpointEvent& event);
virtual void WatchpointChanged(
const Team::WatchpointEvent& event);
virtual void DebugReportChanged(
const Team::DebugReportEvent& event);
virtual void CoreFileChanged(
const Team::CoreFileChangedEvent& event);
virtual void MemoryChanged(
const Team::MemoryChangedEvent& event);
};
#endif // TEAM_H
+34
View File
@@ -0,0 +1,34 @@
/*
* Copyright 2013, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TEAM_INFO_H
#define TEAM_INFO_H
#include <OS.h>
#include <String.h>
#include "Types.h"
class TeamInfo {
public:
TeamInfo();
TeamInfo(const TeamInfo& other);
TeamInfo(team_id team,
const team_info& info);
void SetTo(team_id team, const team_info& info);
void SetTo(team_id team, const BString& arguments);
team_id TeamID() const { return fTeam; }
const BString& Arguments() const { return fArguments; }
private:
team_id fTeam;
BString fArguments;
};
#endif // TEAM_INFO_H
@@ -0,0 +1,35 @@
/*
* Copyright 2015, Rene Gollent, [email protected].
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TEAM_MEMORY_H
#define TEAM_MEMORY_H
#include <Referenceable.h>
#include "TargetAddressRange.h"
class BString;
class TeamMemory : public BReferenceable {
public:
virtual ~TeamMemory();
virtual status_t GetMemoryProperties(target_addr_t baseAddress,
uint32& protection, uint32& locking) = 0;
virtual ssize_t ReadMemory(target_addr_t address, void* buffer,
size_t size) = 0;
virtual status_t ReadMemoryString(target_addr_t address,
size_t maxLength, BString& _string);
virtual ssize_t WriteMemory(target_addr_t address,
void* buffer, size_t size) = 0;
};
#endif // TEAM_MEMORY_H
@@ -0,0 +1,79 @@
/*
* Copyright 2011, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TEAM_MEMORY_BLOCK_H
#define TEAM_MEMORY_BLOCK_H
#include <OS.h>
#include <Locker.h>
#include <Referenceable.h>
#include <util/DoublyLinkedList.h>
#include "Types.h"
class TeamMemoryBlockOwner;
class TeamMemoryBlock : public BReferenceable,
public DoublyLinkedListLinkImpl<TeamMemoryBlock> {
public:
class Listener;
public:
TeamMemoryBlock(target_addr_t baseAddress,
TeamMemoryBlockOwner* owner);
~TeamMemoryBlock();
void AddListener(Listener* listener);
bool HasListener(Listener* listener);
void RemoveListener(Listener* listener);
bool IsValid() const { return fValid; };
void MarkValid();
void Invalidate();
target_addr_t BaseAddress() const { return fBaseAddress; };
uint8* Data() { return fData; };
size_t Size() const { return sizeof(fData); };
bool Contains(target_addr_t address) const;
bool IsWritable() const { return fWritable; }
void SetWritable(bool writable);
void NotifyDataRetrieved(status_t result = B_OK);
protected:
virtual void LastReferenceReleased();
private:
typedef DoublyLinkedList<Listener> ListenerList;
private:
bool fValid;
bool fWritable;
target_addr_t fBaseAddress;
uint8 fData[B_PAGE_SIZE];
ListenerList fListeners;
TeamMemoryBlockOwner*
fBlockOwner;
BLocker fLock;
};
class TeamMemoryBlock::Listener : public DoublyLinkedListLinkImpl<Listener> {
public:
virtual ~Listener();
virtual void MemoryBlockRetrieved(TeamMemoryBlock* block);
virtual void MemoryBlockRetrievalFailed(TeamMemoryBlock* block,
status_t result);
};
#endif // TEAM_MEMORY_BLOCK_H
@@ -0,0 +1,34 @@
/*
* Copyright 2011-2014, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TEAM_TYPE_INFORMATION_H
#define TEAM_TYPE_INFORMATION_H
#include <Referenceable.h>
#include <SupportDefs.h>
class BString;
class Type;
class TypeLookupConstraints;
class TeamTypeInformation : public BReferenceable {
public:
virtual ~TeamTypeInformation();
virtual status_t LookupTypeByName(const BString& name,
const TypeLookupConstraints& constraints,
Type*& _type) = 0;
// returns reference
virtual bool TypeExistsByName(const BString& name,
const TypeLookupConstraints& constraints)
= 0;
};
#endif // TEAM_TYPE_INFORMATION_H
+103
View File
@@ -0,0 +1,103 @@
/*
* Copyright 2013-2016, Rene Gollent, [email protected].
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef THREAD_H
#define THREAD_H
#include <OS.h>
#include <String.h>
#include <Referenceable.h>
#include <util/DoublyLinkedList.h>
#include "ReturnValueInfo.h"
#include "types/Types.h"
class CpuState;
class StackTrace;
class Team;
// general thread state
enum {
THREAD_STATE_UNKNOWN,
THREAD_STATE_RUNNING,
THREAD_STATE_STOPPED
};
// reason why stopped
enum {
THREAD_STOPPED_UNKNOWN,
THREAD_STOPPED_DEBUGGED,
THREAD_STOPPED_DEBUGGER_CALL,
THREAD_STOPPED_BREAKPOINT,
THREAD_STOPPED_WATCHPOINT,
THREAD_STOPPED_SINGLE_STEP,
THREAD_STOPPED_EXCEPTION
};
class Thread : public BReferenceable,
public DoublyLinkedListLinkImpl< ::Thread> {
public:
Thread(Team* team, thread_id threadID);
~Thread();
status_t Init();
Team* GetTeam() const { return fTeam; }
thread_id ID() const { return fID; }
bool IsMainThread() const;
const char* Name() const { return fName.String(); }
void SetName(const BString& name);
uint32 State() const { return fState; }
void SetState(uint32 state,
uint32 reason = THREAD_STOPPED_UNKNOWN,
const BString& info = BString());
uint32 StoppedReason() const
{ return fStoppedReason; }
const BString& StoppedReasonInfo() const
{ return fStoppedReasonInfo; }
CpuState* GetCpuState() const { return fCpuState; }
void SetCpuState(CpuState* state);
StackTrace* GetStackTrace() const { return fStackTrace; }
void SetStackTrace(StackTrace* trace);
bool StopRequestPending() const
{ return fStopRequestPending; }
void SetStopRequestPending();
ReturnValueInfoList*
ReturnValueInfos() const
{ return fReturnValueInfos; }
status_t AddReturnValueInfo(ReturnValueInfo* info);
void ClearReturnValueInfos();
private:
Team* fTeam;
thread_id fID;
BString fName;
uint32 fState;
ReturnValueInfoList*
fReturnValueInfos;
bool fStopRequestPending;
uint32 fStoppedReason;
BString fStoppedReasonInfo;
CpuState* fCpuState;
StackTrace* fStackTrace;
};
typedef DoublyLinkedList< ::Thread> ThreadList;
#endif // THREAD_H
@@ -0,0 +1,33 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef THREAD_INFO_H
#define THREAD_INFO_H
#include <OS.h>
#include <String.h>
class ThreadInfo {
public:
ThreadInfo();
ThreadInfo(const ThreadInfo& other);
ThreadInfo(team_id team, thread_id thread,
const BString& name);
void SetTo(team_id team, thread_id thread,
const BString& name);
team_id TeamID() const { return fTeam; }
thread_id ThreadID() const { return fThread; }
const char* Name() const { return fName.String(); }
private:
team_id fTeam;
thread_id fThread;
BString fName;
};
#endif // THREAD_INFO_H
+319
View File
@@ -0,0 +1,319 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TYPE_H
#define TYPE_H
#include <image.h>
#include <Referenceable.h>
#include <Variant.h>
#include "Types.h"
enum type_kind {
TYPE_PRIMITIVE,
TYPE_COMPOUND,
TYPE_MODIFIED,
TYPE_TYPEDEF,
TYPE_ADDRESS,
TYPE_ENUMERATION,
TYPE_SUBRANGE,
TYPE_ARRAY,
TYPE_UNSPECIFIED,
TYPE_FUNCTION,
TYPE_POINTER_TO_MEMBER
};
enum compound_type_kind {
COMPOUND_TYPE_CLASS,
COMPOUND_TYPE_STRUCT,
COMPOUND_TYPE_UNION,
COMPOUND_TYPE_INTERFACE
};
enum address_type_kind {
DERIVED_TYPE_POINTER,
DERIVED_TYPE_REFERENCE
};
enum template_type_kind {
TEMPLATE_TYPE_TYPE,
TEMPLATE_TYPE_VALUE
};
enum {
TYPE_MODIFIER_CONST = 0x01,
TYPE_MODIFIER_VOLATILE = 0x02,
TYPE_MODIFIER_RESTRICT = 0x04,
TYPE_MODIFIER_PACKED = 0x08,
TYPE_MODIFIER_SHARED = 0x10
};
class AddressType;
class ArrayIndexPath;
class ArrayType;
class BString;
class Type;
class ValueLocation;
class BaseType : public BReferenceable {
public:
virtual ~BaseType();
virtual Type* GetType() const = 0;
};
class DataMember : public BReferenceable {
public:
virtual ~DataMember();
virtual const char* Name() const = 0;
virtual Type* GetType() const = 0;
};
class EnumeratorValue : public BReferenceable {
public:
virtual ~EnumeratorValue();
virtual const char* Name() const = 0;
virtual BVariant Value() const = 0;
};
class ArrayDimension : public BReferenceable {
public:
virtual ~ArrayDimension();
virtual Type* GetType() const = 0;
// subrange or enumeration
virtual uint64 CountElements() const;
// returns 0, if unknown
};
class FunctionParameter : public BReferenceable {
public:
virtual ~FunctionParameter();
virtual const char* Name() const = 0;
virtual Type* GetType() const = 0;
};
class TemplateParameter : public BReferenceable {
public:
virtual ~TemplateParameter();
virtual template_type_kind Kind() const = 0;
virtual Type* GetType() const = 0;
virtual BVariant Value() const = 0;
};
class Type : public BReferenceable {
public:
virtual ~Type();
virtual image_id ImageID() const = 0;
virtual const BString& ID() const = 0;
virtual const BString& Name() const = 0;
virtual type_kind Kind() const = 0;
virtual target_size_t ByteSize() const = 0;
virtual Type* ResolveRawType(bool nextOneOnly) const;
// strips modifiers and typedefs (only one,
// if requested)
virtual status_t CreateDerivedAddressType(
address_type_kind kind,
AddressType*& _resultType);
virtual status_t CreateDerivedArrayType(
int64 lowerBound,
int64 elementCount,
bool extendExisting,
// if the current object is already
// an array type, attach an extra
// dimension to it rather than
// creating a new encapsulating
// type object
ArrayType*& _resultType);
virtual status_t ResolveObjectDataLocation(
const ValueLocation& objectLocation,
ValueLocation*& _location) = 0;
// returns a reference
virtual status_t ResolveObjectDataLocation(
target_addr_t objectAddress,
ValueLocation*& _location) = 0;
// returns a reference
};
class PrimitiveType : public virtual Type {
public:
virtual ~PrimitiveType();
virtual type_kind Kind() const;
virtual uint32 TypeConstant() const = 0;
};
class CompoundType : public virtual Type {
public:
virtual ~CompoundType();
virtual type_kind Kind() const;
virtual compound_type_kind CompoundKind() const = 0;
virtual int32 CountBaseTypes() const = 0;
virtual BaseType* BaseTypeAt(int32 index) const = 0;
virtual int32 CountDataMembers() const = 0;
virtual DataMember* DataMemberAt(int32 index) const = 0;
virtual int32 CountTemplateParameters() const = 0;
virtual TemplateParameter* TemplateParameterAt(int32 index) const = 0;
virtual status_t ResolveBaseTypeLocation(BaseType* baseType,
const ValueLocation& parentLocation,
ValueLocation*& _location) = 0;
// returns a reference
virtual status_t ResolveDataMemberLocation(DataMember* member,
const ValueLocation& parentLocation,
ValueLocation*& _location) = 0;
// returns a reference
};
class ModifiedType : public virtual Type {
public:
virtual ~ModifiedType();
virtual type_kind Kind() const;
virtual uint32 Modifiers() const = 0;
virtual Type* BaseType() const = 0;
virtual Type* ResolveRawType(bool nextOneOnly) const;
};
class TypedefType : public virtual Type {
public:
virtual ~TypedefType();
virtual type_kind Kind() const;
virtual Type* BaseType() const = 0;
virtual Type* ResolveRawType(bool nextOneOnly) const;
};
class AddressType : public virtual Type {
public:
virtual ~AddressType();
virtual type_kind Kind() const;
virtual address_type_kind AddressKind() const = 0;
virtual Type* BaseType() const = 0;
};
class EnumerationType : public virtual Type {
public:
virtual ~EnumerationType();
virtual type_kind Kind() const;
virtual Type* BaseType() const = 0;
// may return NULL
virtual int32 CountValues() const = 0;
virtual EnumeratorValue* ValueAt(int32 index) const = 0;
virtual EnumeratorValue* ValueFor(const BVariant& value) const;
};
class SubrangeType : public virtual Type {
public:
virtual ~SubrangeType();
virtual type_kind Kind() const;
virtual Type* BaseType() const = 0;
virtual BVariant LowerBound() const = 0;
virtual BVariant UpperBound() const = 0;
};
class ArrayType : public virtual Type {
public:
virtual ~ArrayType();
virtual type_kind Kind() const;
virtual Type* BaseType() const = 0;
virtual int32 CountDimensions() const = 0;
virtual ArrayDimension* DimensionAt(int32 index) const = 0;
virtual status_t ResolveElementLocation(
const ArrayIndexPath& indexPath,
const ValueLocation& parentLocation,
ValueLocation*& _location) = 0;
// returns a reference
};
class UnspecifiedType : public virtual Type {
public:
virtual ~UnspecifiedType();
virtual type_kind Kind() const;
};
class FunctionType : public virtual Type {
public:
virtual ~FunctionType();
virtual type_kind Kind() const;
virtual Type* ReturnType() const = 0;
virtual int32 CountParameters() const = 0;
virtual FunctionParameter* ParameterAt(int32 index) const = 0;
virtual bool HasVariableArguments() const = 0;
};
class PointerToMemberType : public virtual Type {
public:
virtual ~PointerToMemberType();
virtual type_kind Kind() const;
virtual CompoundType* ContainingType() const = 0;
virtual Type* BaseType() const = 0;
};
#endif // TYPE_H
@@ -0,0 +1,148 @@
/*
* Copyright 2009-2012, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TYPE_COMPONENT_PATH_H
#define TYPE_COMPONENT_PATH_H
#include <String.h>
#include <ObjectList.h>
#include <Referenceable.h>
#include "ArrayIndexPath.h"
#include "Type.h"
enum type_component_kind {
TYPE_COMPONENT_UNDEFINED,
TYPE_COMPONENT_BASE_TYPE,
TYPE_COMPONENT_DATA_MEMBER,
TYPE_COMPONENT_ARRAY_ELEMENT
};
struct TypeComponent {
uint64 index;
BString name;
type_component_kind componentKind;
type_kind typeKind;
TypeComponent()
:
componentKind(TYPE_COMPONENT_UNDEFINED)
{
}
TypeComponent(const TypeComponent& other)
:
index(other.index),
name(other.name),
componentKind(other.componentKind),
typeKind(other.typeKind)
{
}
bool IsValid() const
{
return componentKind != TYPE_COMPONENT_UNDEFINED;
}
void SetToBaseType(type_kind typeKind, uint64 index = 0,
const BString& name = BString())
{
this->componentKind = TYPE_COMPONENT_BASE_TYPE;
this->typeKind = typeKind;
this->index = index;
this->name = name;
}
void SetToDataMember(type_kind typeKind, uint64 index,
const BString& name)
{
this->componentKind = TYPE_COMPONENT_DATA_MEMBER;
this->typeKind = typeKind;
this->index = index;
this->name = name;
}
void SetToArrayElement(type_kind typeKind, const BString& indexPath)
{
this->componentKind = TYPE_COMPONENT_ARRAY_ELEMENT;
this->typeKind = typeKind;
this->index = 0;
this->name = indexPath;
}
bool SetToArrayElement(type_kind typeKind, const ArrayIndexPath& indexPath)
{
this->componentKind = TYPE_COMPONENT_ARRAY_ELEMENT;
this->typeKind = typeKind;
this->index = 0;
return indexPath.GetPathString(this->name);
}
bool HasPrefix(const TypeComponent& other) const;
uint32 HashValue() const;
void Dump() const;
TypeComponent& operator=(const TypeComponent& other)
{
index = other.index;
name = other.name;
componentKind = other.componentKind;
typeKind = other.typeKind;
return *this;
}
bool operator==(const TypeComponent& other) const;
bool operator!=(const TypeComponent& other) const
{
return !(*this == other);
}
};
class TypeComponentPath : public BReferenceable {
public:
TypeComponentPath();
TypeComponentPath(
const TypeComponentPath& other);
virtual ~TypeComponentPath();
int32 CountComponents() const;
TypeComponent ComponentAt(int32 index) const;
bool AddComponent(const TypeComponent& component);
void Clear();
TypeComponentPath* CreateSubPath(int32 componentCount) const;
// returns a new object (or NULL when out
// of memory)
uint32 HashValue() const;
void Dump() const;
TypeComponentPath& operator=(const TypeComponentPath& other);
bool operator==(const TypeComponentPath& other) const;
bool operator!=(const TypeComponentPath& other) const
{ return !(*this == other); }
private:
typedef BObjectList<TypeComponent> ComponentList;
private:
ComponentList fComponents;
};
#endif // TYPE_COMPONENT_PATH_H
@@ -0,0 +1,45 @@
/*
* Copyright 2011, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TYPE_LOOKUP_CONSTRAINTS_H
#define TYPE_LOOKUP_CONSTRAINTS_H
#include <String.h>
#include "Type.h"
class TypeLookupConstraints {
public:
TypeLookupConstraints();
// no constraints
TypeLookupConstraints(type_kind typeKind);
// constrain on type only
TypeLookupConstraints(type_kind typeKind,
int32 subtypeKind);
bool HasTypeKind() const;
bool HasSubtypeKind() const;
bool HasBaseTypeName() const;
type_kind TypeKind() const;
int32 SubtypeKind() const;
// TODO: This should be further generalized to being able to
// pass a full set of constraints for the base type, not just the name
const BString& BaseTypeName() const;
void SetTypeKind(type_kind typeKind);
void SetSubtypeKind(int32 subtypeKind);
void SetBaseTypeName(const BString& name);
private:
type_kind fTypeKind;
int32 fSubtypeKind;
bool fTypeKindGiven;
bool fSubtypeKindGiven;
BString fBaseTypeName;
};
#endif // TYPE_LOOKUP_CONSTRAINTS_H
@@ -0,0 +1,131 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2013-2014, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef USER_BREAKPOINT_H
#define USER_BREAKPOINT_H
#include <ObjectList.h>
#include <Referenceable.h>
#include <util/DoublyLinkedList.h>
#include "SourceLocation.h"
#include "String.h"
#include "Types.h"
class Breakpoint;
class Function;
class FunctionID;
class LocatableFile;
class UserBreakpoint;
class UserBreakpointLocation {
public:
UserBreakpointLocation(FunctionID* functionID,
LocatableFile* sourceFile,
const SourceLocation& sourceLocation,
target_addr_t relativeAddress);
UserBreakpointLocation(
const UserBreakpointLocation& other);
virtual ~UserBreakpointLocation();
FunctionID* GetFunctionID() const { return fFunctionID; }
LocatableFile* SourceFile() const { return fSourceFile; }
SourceLocation GetSourceLocation() const
{ return fSourceLocation; }
target_addr_t RelativeAddress() const
{ return fRelativeAddress; }
UserBreakpointLocation& operator=(
const UserBreakpointLocation& other);
private:
FunctionID* fFunctionID;
LocatableFile* fSourceFile;
SourceLocation fSourceLocation;
target_addr_t fRelativeAddress;
};
class UserBreakpointInstance
: public DoublyLinkedListLinkImpl<UserBreakpointInstance> {
public:
UserBreakpointInstance(
UserBreakpoint* userBreakpoint,
target_addr_t address);
UserBreakpoint* GetUserBreakpoint() const
{ return fUserBreakpoint; }
target_addr_t Address() const { return fAddress; }
Breakpoint* GetBreakpoint() const { return fBreakpoint; }
void SetBreakpoint(Breakpoint* breakpoint);
private:
target_addr_t fAddress;
UserBreakpoint* fUserBreakpoint;
Breakpoint* fBreakpoint;
};
typedef DoublyLinkedList<UserBreakpointInstance> UserBreakpointInstanceList;
class UserBreakpoint : public BReferenceable,
public DoublyLinkedListLinkImpl<UserBreakpoint> {
public:
UserBreakpoint(
const UserBreakpointLocation& location);
~UserBreakpoint();
const UserBreakpointLocation& Location() const { return fLocation; }
int32 CountInstances() const;
UserBreakpointInstance* InstanceAt(int32 index) const;
// Note: After known to the BreakpointManager, those can only be
// invoked with the breakpoint manager lock held.
bool AddInstance(UserBreakpointInstance* instance);
void RemoveInstance(
UserBreakpointInstance* instance);
UserBreakpointInstance* RemoveInstanceAt(int32 index);
bool IsValid() const { return fValid; }
void SetValid(bool valid);
// BreakpointManager only
bool IsEnabled() const { return fEnabled; }
void SetEnabled(bool enabled);
// BreakpointManager only
bool IsHidden() const { return fHidden; }
void SetHidden(bool hidden);
bool HasCondition() const
{ return !fConditionExpression.IsEmpty(); }
const BString& Condition() const
{ return fConditionExpression; }
void SetCondition(
const BString& conditionExpression);
private:
typedef BObjectList<UserBreakpointInstance> InstanceList;
private:
UserBreakpointLocation fLocation;
InstanceList fInstances;
bool fValid;
bool fEnabled;
bool fHidden;
BString fConditionExpression;
};
typedef DoublyLinkedList<UserBreakpoint> UserBreakpointList;
#endif // USER_BREAKPOINT_H
+42
View File
@@ -0,0 +1,42 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef VARIABLE_H
#define VARIABLE_H
#include <String.h>
#include <Referenceable.h>
class CpuState;
class ObjectID;
class Type;
class ValueLocation;
class Variable : public BReferenceable {
public:
Variable(ObjectID* id, const BString& name,
Type* type, ValueLocation* location,
CpuState* state = NULL);
~Variable();
ObjectID* ID() const { return fID; }
const BString& Name() const { return fName; }
Type* GetType() const { return fType; }
ValueLocation* Location() const { return fLocation; }
CpuState* GetCpuState() const { return fCpuState; }
private:
ObjectID* fID;
BString fName;
Type* fType;
ValueLocation* fLocation;
CpuState* fCpuState;
};
#endif // VARIABLE_H
@@ -0,0 +1,56 @@
/*
* Copyright 2012, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef WATCHPOINT_H
#define WATCHPOINT_H
#include <ObjectList.h>
#include <Referenceable.h>
#include "types/Types.h"
class Watchpoint : public BReferenceable {
public:
Watchpoint(target_addr_t address, uint32 type,
int32 length);
~Watchpoint();
target_addr_t Address() const { return fAddress; }
uint32 Type() const { return fType; }
int32 Length() const { return fLength; }
bool IsInstalled() const { return fInstalled; }
void SetInstalled(bool installed);
bool IsEnabled() const { return fEnabled; }
void SetEnabled(bool enabled);
// WatchpointManager only
bool ShouldBeInstalled() const
{ return fEnabled && !fInstalled; }
bool Contains(target_addr_t address) const;
static int CompareWatchpoints(const Watchpoint* a,
const Watchpoint* b);
static int CompareAddressWatchpoint(
const target_addr_t* address,
const Watchpoint* watchpoint);
private:
target_addr_t fAddress;
uint32 fType;
int32 fLength;
bool fInstalled;
bool fEnabled;
};
typedef BObjectList<Watchpoint> WatchpointList;
#endif // WATCHPOINT_H
@@ -0,0 +1,27 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2016, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef SETTINGS_MANAGER_H
#define SETTINGS_MANAGER_H
#include <SupportDefs.h>
class TeamSettings;
class SettingsManager {
public:
virtual ~SettingsManager();
virtual status_t LoadTeamSettings(const char* teamName,
TeamSettings& settings) = 0;
virtual status_t SaveTeamSettings(const TeamSettings& settings)
= 0;
};
#endif // SETTINGS_MANAGER_H
@@ -0,0 +1,75 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2013-2015, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TEAM_SETTINGS_H
#define TEAM_SETTINGS_H
#include <String.h>
#include <ObjectList.h>
class BMessage;
class BreakpointSetting;
class Team;
class TeamFileManagerSettings;
class TeamSignalSettings;
class TeamUiSettings;
class TeamUiSettingsFactory;
class TeamSettings {
public:
TeamSettings();
TeamSettings(const TeamSettings& other);
// throws std::bad_alloc
~TeamSettings();
status_t SetTo(Team* team);
status_t SetTo(const BMessage& archive,
const TeamUiSettingsFactory& factory);
status_t WriteTo(BMessage& archive) const;
const BString& TeamName() const { return fTeamName; }
int32 CountBreakpoints() const;
const BreakpointSetting* BreakpointAt(int32 index) const;
int32 CountUiSettings() const;
const TeamUiSettings* UiSettingAt(int32 index) const;
const TeamUiSettings* UiSettingFor(const char* id) const;
status_t AddUiSettings(TeamUiSettings* settings);
TeamSettings& operator=(const TeamSettings& other);
// throws std::bad_alloc
TeamFileManagerSettings*
FileManagerSettings() const;
status_t SetFileManagerSettings(
TeamFileManagerSettings* settings);
TeamSignalSettings* SignalSettings() const;
status_t SetSignalSettings(
TeamSignalSettings* settings);
private:
typedef BObjectList<BreakpointSetting> BreakpointList;
typedef BObjectList<TeamUiSettings> UiSettingsList;
private:
void _Unset();
private:
BreakpointList fBreakpoints;
UiSettingsList fUiSettings;
TeamFileManagerSettings*
fFileManagerSettings;
TeamSignalSettings* fSignalSettings;
BString fTeamName;
};
#endif // TEAM_SETTINGS_H
@@ -0,0 +1,37 @@
/*
* Copyright 2011, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TEAM_UI_SETTINGS_H
#define TEAM_UI_SETTINGS_H
#include <String.h>
class BMessage;
enum team_ui_settings_type {
TEAM_UI_SETTINGS_TYPE_GUI,
TEAM_UI_SETTINGS_TYPE_CLI
};
class TeamUiSettings {
public:
TeamUiSettings();
virtual ~TeamUiSettings();
virtual team_ui_settings_type Type() const = 0;
virtual const char* ID() const = 0;
virtual status_t SetTo(const BMessage& archive) = 0;
virtual status_t WriteTo(BMessage& archive) const = 0;
virtual TeamUiSettings* Clone() const = 0;
// throws std::bad_alloc
};
#endif // TEAM_UI_SETTINGS_H
@@ -0,0 +1,23 @@
/*
* Copyright 2011, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TEAM_UI_SETTINGS_FACTORY_H
#define TEAM_UI_SETTINGS_FACTORY_H
#include <SupportDefs.h>
class BMessage;
class TeamUiSettings;
class TeamUiSettingsFactory {
public:
virtual ~TeamUiSettingsFactory();
virtual status_t Create(const BMessage& archive,
TeamUiSettings*& settings) const = 0;
};
#endif // TEAM_UI_SETTINGS_FACTORY_H
@@ -0,0 +1,233 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2011-2013, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef SETTING_H
#define SETTING_H
#include <String.h>
#include <ObjectList.h>
#include <Referenceable.h>
#include <Variant.h>
enum setting_type {
SETTING_TYPE_BOOL,
SETTING_TYPE_FLOAT,
SETTING_TYPE_OPTIONS,
SETTING_TYPE_BOUNDED,
SETTING_TYPE_RANGE,
SETTING_TYPE_RECT
};
class Setting : public BReferenceable {
public:
virtual ~Setting();
virtual setting_type Type() const = 0;
virtual const char* ID() const = 0;
virtual const char* Name() const = 0;
virtual BVariant DefaultValue() const = 0;
};
class BoolSetting : public virtual Setting {
public:
virtual setting_type Type() const;
virtual BVariant DefaultValue() const;
virtual bool DefaultBoolValue() const = 0;
};
class FloatSetting : public virtual Setting {
public:
virtual setting_type Type() const;
virtual BVariant DefaultValue() const;
virtual float DefaultFloatValue() const = 0;
};
class SettingsOption : public BReferenceable {
public:
virtual ~SettingsOption();
virtual const char* ID() const = 0;
virtual const char* Name() const = 0;
};
class OptionsSetting : public virtual Setting {
public:
virtual setting_type Type() const;
virtual BVariant DefaultValue() const;
virtual int32 CountOptions() const = 0;
virtual SettingsOption* OptionAt(int32 index) const = 0;
virtual SettingsOption* OptionByID(const char* id) const = 0;
virtual SettingsOption* DefaultOption() const = 0;
};
class BoundedSetting : public virtual Setting {
public:
virtual setting_type Type() const;
virtual BVariant LowerBound() const = 0;
virtual BVariant UpperBound() const = 0;
};
class RangeSetting : public virtual BoundedSetting {
virtual setting_type Type() const;
virtual BVariant LowerValue() const = 0;
virtual BVariant UpperValue() const = 0;
};
class RectSetting : public virtual Setting {
public:
virtual setting_type Type() const;
virtual BVariant DefaultValue() const;
virtual BRect DefaultRectValue() const = 0;
};
class AbstractSetting : public virtual Setting {
public:
AbstractSetting(const BString& id,
const BString& name);
virtual const char* ID() const;
virtual const char* Name() const;
private:
BString fID;
BString fName;
};
class BoolSettingImpl : public AbstractSetting, public BoolSetting {
public:
BoolSettingImpl(const BString& id,
const BString& name, bool defaultValue);
virtual bool DefaultBoolValue() const;
private:
bool fDefaultValue;
};
class FloatSettingImpl : public AbstractSetting, public FloatSetting {
public:
FloatSettingImpl(const BString& id,
const BString& name, float defaultValue);
virtual float DefaultFloatValue() const;
private:
float fDefaultValue;
};
class OptionsSettingImpl : public AbstractSetting, public OptionsSetting {
public:
OptionsSettingImpl(const BString& id,
const BString& name);
virtual ~OptionsSettingImpl();
virtual SettingsOption* DefaultOption() const;
virtual int32 CountOptions() const;
virtual SettingsOption* OptionAt(int32 index) const;
virtual SettingsOption* OptionByID(const char* id) const;
bool AddOption(SettingsOption* option);
bool AddOption(const BString& id,
const BString& name);
void SetDefaultOption(SettingsOption* option);
private:
class Option;
typedef BObjectList<SettingsOption> OptionList;
private:
OptionList fOptions;
SettingsOption* fDefaultOption;
};
class BoundedSettingImpl : public AbstractSetting, public BoundedSetting {
public:
BoundedSettingImpl(const BString& id,
const BString& name,
const BVariant& lowerBound,
const BVariant& upperBound,
const BVariant& defaultValue);
virtual BVariant DefaultValue() const;
virtual BVariant LowerBound() const;
virtual BVariant UpperBound() const;
private:
BVariant fLowerBound;
BVariant fUpperBound;
BVariant fDefaultValue;
};
class RangeSettingImpl : public AbstractSetting, public RangeSetting {
public:
RangeSettingImpl(const BString& id,
const BString& name,
const BVariant& lowerBound,
const BVariant& upperBound,
const BVariant& lowerValue,
const BVariant& upperValue);
virtual BVariant DefaultValue() const;
virtual BVariant LowerBound() const;
virtual BVariant UpperBound() const;
virtual BVariant LowerValue() const;
virtual BVariant UpperValue() const;
private:
BVariant fLowerBound;
BVariant fUpperBound;
BVariant fLowerValue;
BVariant fUpperValue;
};
class RectSettingImpl : public AbstractSetting, public RectSetting {
public:
RectSettingImpl(const BString& id,
const BString& name,
const BRect& defaultValue);
virtual BRect DefaultRectValue() const;
private:
BRect fDefaultValue;
};
#endif // SETTING_H
@@ -0,0 +1,74 @@
/*
* Copyright 2013, Rene Gollent, [email protected].
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef SETTINGS_H
#define SETTINGS_H
#include <Locker.h>
#include <Message.h>
#include <ObjectList.h>
#include <Referenceable.h>
#include <Variant.h>
#include "Setting.h"
class SettingsDescription;
class Settings : public BReferenceable {
public:
class Listener;
public:
Settings(SettingsDescription* description);
virtual ~Settings();
status_t Init();
bool Lock() { return fLock.Lock(); }
void Unlock() { fLock.Unlock(); }
SettingsDescription* Description() const { return fDescription; }
const BMessage& Message() const { return fValues; }
BVariant Value(Setting* setting) const;
BVariant Value(const char* settingID) const;
bool SetValue(Setting* setting,
const BVariant& value);
bool RestoreValues(const BMessage& message);
bool BoolValue(BoolSetting* setting) const
{ return Value(setting).ToBool(); }
SettingsOption* OptionValue(OptionsSetting* setting) const;
BVariant RangeValue(RangeSetting* setting) const
{ return Value(setting); }
bool AddListener(Listener* listener);
void RemoveListener(Listener* listener);
private:
typedef BObjectList<Listener> ListenerList;
private:
mutable BLocker fLock;
SettingsDescription* fDescription;
BMessage fValues;
ListenerList fListeners;
};
class Settings::Listener {
public:
virtual ~Listener();
virtual void SettingValueChanged(Setting* setting) = 0;
};
#endif // SETTINGS_H
@@ -0,0 +1,35 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef SETTINGS_DESCRIPTION_H
#define SETTINGS_DESCRIPTION_H
#include <ObjectList.h>
#include <Referenceable.h>
class Setting;
class SettingsDescription : public BReferenceable {
public:
SettingsDescription();
virtual ~SettingsDescription();
int32 CountSettings() const;
Setting* SettingAt(int32 index) const;
Setting* SettingByID(const char* id) const;
bool AddSetting(Setting* setting);
private:
typedef BObjectList<Setting> SettingsList;
private:
SettingsList fSettings;
};
#endif // SETTINGS_DESCRIPTION_H
@@ -0,0 +1,40 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2014, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef SOURCE_LANGUAGE_H
#define SOURCE_LANGUAGE_H
#include <Referenceable.h>
class BString;
class ExpressionResult;
class SyntaxHighlighter;
class TeamTypeInformation;
class Type;
class ValueNode;
class ValueNodeManager;
class SourceLanguage : public BReferenceable {
public:
virtual ~SourceLanguage();
virtual const char* Name() const = 0;
virtual SyntaxHighlighter* GetSyntaxHighlighter() const;
// returns a reference,
// may return NULL, if not available
virtual status_t EvaluateExpression(const BString& expression,
ValueNodeManager* manager,
TeamTypeInformation* info,
ExpressionResult*& _output,
ValueNode*& _neededNode);
};
#endif // SOURCE_LANGUAGE_H
@@ -0,0 +1,58 @@
/*
* Copyright 2014, Rene Gollent, [email protected].
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef SYNTAX_HIGHLIGHTER_H
#define SYNTAX_HIGHLIGHTER_H
#include <String.h>
#include <Referenceable.h>
class LineDataSource;
class TeamTypeInformation;
enum syntax_highlight_type {
SYNTAX_HIGHLIGHT_NONE = 0,
SYNTAX_HIGHLIGHT_KEYWORD,
SYNTAX_HIGHLIGHT_PREPROCESSOR_KEYWORD,
SYNTAX_HIGHLIGHT_IDENTIFIER,
SYNTAX_HIGHLIGHT_OPERATOR,
SYNTAX_HIGHLIGHT_TYPE,
SYNTAX_HIGHLIGHT_NUMERIC_LITERAL,
SYNTAX_HIGHLIGHT_STRING_LITERAL,
SYNTAX_HIGHLIGHT_COMMENT
};
class SyntaxHighlightInfo {
public:
virtual ~SyntaxHighlightInfo();
virtual int32 GetLineHighlightRanges(int32 line,
int32* _columns,
syntax_highlight_type* _types,
int32 maxCount) = 0;
// Returns number of filled in
// (column, type) pairs.
// Default is (0, SYNTAX_HIGHLIGHT_NONE)
// and can be omitted.
};
class SyntaxHighlighter : public BReferenceable {
public:
virtual ~SyntaxHighlighter();
virtual status_t ParseText(LineDataSource* source,
TeamTypeInformation* typeInfo,
SyntaxHighlightInfo*& _info) = 0;
// caller owns the returned info
};
#endif // SYNTAX_HIGHLIGHTER_H
@@ -0,0 +1,28 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2014, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef C_LANGUAGE_FAMILY_H
#define C_LANGUAGE_FAMILY_H
#include "SourceLanguage.h"
class CLanguageFamily : public SourceLanguage {
public:
CLanguageFamily();
virtual ~CLanguageFamily();
virtual SyntaxHighlighter* GetSyntaxHighlighter() const;
virtual status_t EvaluateExpression(const BString& expression,
ValueNodeManager* manager,
TeamTypeInformation* info,
ExpressionResult*& _output,
ValueNode*& _neededNode);
};
#endif // C_LANGUAGE_FAMILY_H
@@ -0,0 +1,21 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef CPP_LANGUAGE_H
#define CPP_LANGUAGE_H
#include "CLanguageFamily.h"
class CppLanguage : public CLanguageFamily {
public:
CppLanguage();
virtual ~CppLanguage();
virtual const char* Name() const;
};
#endif // CPP_LANGUAGE_H
@@ -0,0 +1,129 @@
/*
* Copyright 2016, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TARGET_HOST_INTERFACE_H
#define TARGET_HOST_INTERFACE_H
#include <OS.h>
#include <Looper.h>
#include <ObjectList.h>
#include <util/DoublyLinkedList.h>
#include "controllers/TeamDebugger.h"
class DebuggerInterface;
class Settings;
class SettingsManager;
class TargetHost;
struct TeamDebuggerOptions;
class UserInterface;
class TargetHostInterface : public BLooper, private TeamDebugger::Listener {
public:
class Listener;
TargetHostInterface();
virtual ~TargetHostInterface();
status_t StartTeamDebugger(const TeamDebuggerOptions& options);
int32 CountTeamDebuggers() const;
TeamDebugger* TeamDebuggerAt(int32 index) const;
TeamDebugger* FindTeamDebugger(team_id team) const;
status_t AddTeamDebugger(TeamDebugger* debugger);
void RemoveTeamDebugger(TeamDebugger* debugger);
virtual status_t Init(Settings* settings) = 0;
virtual void Close() = 0;
virtual bool IsLocal() const = 0;
virtual bool Connected() const = 0;
virtual TargetHost* GetTargetHost() = 0;
virtual status_t Attach(team_id id, thread_id threadID,
DebuggerInterface*& _interface) const = 0;
virtual status_t CreateTeam(int commandLineArgc,
const char* const* arguments,
team_id& _teamID) const = 0;
virtual status_t LoadCore(const char* coreFilePath,
DebuggerInterface*& _interface,
thread_id& _thread) const = 0;
virtual status_t FindTeamByThread(thread_id thread,
team_id& _teamID) const = 0;
void AddListener(Listener* listener);
void RemoveListener(Listener* listener);
// BLooper
virtual void Quit();
virtual void MessageReceived(BMessage* message);
private:
// TeamDebugger::Listener
virtual void TeamDebuggerStarted(TeamDebugger* debugger);
virtual void TeamDebuggerRestartRequested(
TeamDebugger* debugger);
virtual void TeamDebuggerQuit(TeamDebugger* debugger);
private:
status_t _StartTeamDebugger(team_id teamID,
const TeamDebuggerOptions& options,
bool stopInMain);
void _NotifyTeamDebuggerStarted(
TeamDebugger* debugger);
void _NotifyTeamDebuggerQuit(
TeamDebugger* debugger);
static int _CompareDebuggers(const TeamDebugger* a,
const TeamDebugger* b);
private:
typedef DoublyLinkedList<Listener> ListenerList;
typedef BObjectList<TeamDebugger> TeamDebuggerList;
private:
ListenerList fListeners;
TeamDebuggerList fTeamDebuggers;
};
class TargetHostInterface::Listener
: public DoublyLinkedListLinkImpl<Listener> {
public:
virtual ~Listener();
virtual void TeamDebuggerStarted(TeamDebugger* debugger);
virtual void TeamDebuggerQuit(TeamDebugger* debugger);
virtual void TargetHostInterfaceQuit(
TargetHostInterface* interface);
};
enum {
TEAM_DEBUGGER_REQUEST_UNKNOWN = 0,
TEAM_DEBUGGER_REQUEST_CREATE,
TEAM_DEBUGGER_REQUEST_ATTACH,
TEAM_DEBUGGER_REQUEST_LOAD_CORE
};
struct TeamDebuggerOptions {
TeamDebuggerOptions();
int requestType;
int commandLineArgc;
const char* const* commandLineArgv;
team_id team;
thread_id thread;
SettingsManager* settingsManager;
UserInterface* userInterface;
const char* coreFilePath;
};
#endif // TARGET_HOST_INTERFACE_H
@@ -0,0 +1,40 @@
/*
* Copyright 2016, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TARGET_HOST_INTERFACE_INFO_H
#define TARGET_HOST_INTERFACE_INFO_H
#include <String.h>
#include <Referenceable.h>
#include <util/DoublyLinkedList.h>
class Settings;
class SettingsDescription;
class TargetHostInterface;
class TargetHostInterfaceInfo : public BReferenceable {
public:
TargetHostInterfaceInfo(const BString& name);
virtual ~TargetHostInterfaceInfo();
const BString& Name() const { return fName; }
virtual status_t Init() = 0;
virtual bool IsLocal() const = 0;
virtual bool IsConfigured(Settings* settings) const = 0;
virtual SettingsDescription* GetSettingsDescription() const = 0;
virtual status_t CreateInterface(Settings* settings,
TargetHostInterface*& _interface) const
= 0;
private:
BString fName;
};
#endif // TARGET_HOST_INTERFACE_INFO_H
@@ -0,0 +1,79 @@
/*
* Copyright 2016, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TARGET_HOST_INTERFACE_ROSTER_H
#define TARGET_HOST_INTERFACE_ROSTER_H
#include <OS.h>
#include <Locker.h>
#include <ObjectList.h>
#include "TargetHostInterface.h"
class Settings;
class TargetHostInterfaceInfo;
class TargetHostInterfaceRoster : private TargetHostInterface::Listener {
public:
class Listener;
TargetHostInterfaceRoster();
virtual ~TargetHostInterfaceRoster();
static TargetHostInterfaceRoster* Default();
static status_t CreateDefault(Listener* listener);
static void DeleteDefault();
bool Lock() { return fLock.Lock(); }
void Unlock() { fLock.Unlock(); }
status_t Init(Listener* listener);
status_t RegisterInterfaceInfos();
int32 CountInterfaceInfos() const;
TargetHostInterfaceInfo*
InterfaceInfoAt(int32 index) const;
status_t CreateInterface(TargetHostInterfaceInfo* info,
Settings* settings,
TargetHostInterface*& _interface);
int32 CountActiveInterfaces() const;
TargetHostInterface* ActiveInterfaceAt(int32 index) const;
int32 CountRunningTeamDebuggers() const
{ return fRunningTeamDebuggers; }
// TargetHostInterface::Listener
virtual void TeamDebuggerStarted(TeamDebugger* debugger);
virtual void TeamDebuggerQuit(TeamDebugger* debugger);
virtual void TargetHostInterfaceQuit(
TargetHostInterface* interface);
private:
typedef BObjectList<TargetHostInterfaceInfo> InfoList;
typedef BObjectList<TargetHostInterface> InterfaceList;
private:
BLocker fLock;
static TargetHostInterfaceRoster* sDefaultInstance;
int32 fRunningTeamDebuggers;
InfoList fInterfaceInfos;
InterfaceList fActiveInterfaces;
Listener* fListener;
};
class TargetHostInterfaceRoster::Listener {
public:
virtual ~Listener();
virtual void TeamDebuggerCountChanged(int32 newCount);
};
#endif // TARGET_HOST_INTERFACE_ROSTER_H
@@ -0,0 +1,16 @@
/*
* Copyright 2010, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef ADDRESS_SECTION_TYPES_H
#define ADDRESS_SECTION_TYPES_H
enum AddressSectionType {
ADDRESS_SECTION_TYPE_UNKNOWN = 0,
ADDRESS_SECTION_TYPE_FUNCTION,
ADDRESS_SECTION_TYPE_PLT
};
#endif // ADDRESS_SECTION_TYPES_H
@@ -0,0 +1,73 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef ARRAY_INDEX_PATH_H
#define ARRAY_INDEX_PATH_H
#include <Array.h>
#include "Types.h"
class BString;
class ArrayIndexPath {
public:
ArrayIndexPath();
ArrayIndexPath(const ArrayIndexPath& other);
~ArrayIndexPath();
status_t SetTo(const char* path);
void Clear();
bool GetPathString(BString& path) const;
inline int32 CountIndices() const;
inline int64 IndexAt(int32 index) const;
inline bool AddIndex(int64 index);
inline void SetIndexAt(int32 at, int64 newIndex);
ArrayIndexPath& operator=(const ArrayIndexPath& other);
private:
typedef Array<int64> IndexArray;
private:
IndexArray fIndices;
};
int32
ArrayIndexPath::CountIndices() const
{
return fIndices.Count();
}
int64
ArrayIndexPath::IndexAt(int32 index) const
{
return index >= 0 && index < fIndices.Count()
? fIndices.ElementAt(index) : -1;
}
bool
ArrayIndexPath::AddIndex(int64 index)
{
return fIndices.Add(index);
}
void
ArrayIndexPath::SetIndexAt(int32 at, int64 newIndex)
{
if (at >= 0 && at < fIndices.Count())
fIndices[at] = newIndex;
}
#endif // ARRAY_INDEX_PATH_H
@@ -0,0 +1,20 @@
/*
* Copyright 2015, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef SIGNAL_DISPOSITION_TYPES_H
#define SIGNAL_DISPOSITION_TYPES_H
enum SignalDisposition {
SIGNAL_DISPOSITION_IGNORE = 0,
SIGNAL_DISPOSITION_STOP_AT_RECEIPT,
SIGNAL_DISPOSITION_STOP_AT_SIGNAL_HANDLER,
// NB: if the team has no signal handler installed for
// the corresponding signal, this implies stop at receipt.
SIGNAL_DISPOSITION_MAX
};
#endif // SIGNAL_DISPOSITION_TYPES_H
@@ -0,0 +1,72 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef SOURCE_LOCATION_H
#define SOURCE_LOCATION_H
#include <SupportDefs.h>
class SourceLocation {
public:
SourceLocation(int32 line = 0, int32 column = 0)
:
fLine(line),
fColumn(column)
{
}
SourceLocation(const SourceLocation& other)
:
fLine(other.fLine),
fColumn(other.fColumn)
{
}
SourceLocation& operator=(const SourceLocation& other)
{
fLine = other.fLine;
fColumn = other.fColumn;
return *this;
}
bool operator==(const SourceLocation& other) const
{
return fLine == other.fLine && fColumn == other.fColumn;
}
bool operator!=(const SourceLocation& other) const
{
return !(*this == other);
}
bool operator<(const SourceLocation& other) const
{
return fLine < other.fLine
|| (fLine == other.fLine && fColumn < other.fColumn);
}
bool operator<=(const SourceLocation& other) const
{
return fLine < other.fLine
|| (fLine == other.fLine && fColumn <= other.fColumn);
}
int32 Line() const
{
return fLine;
}
int32 Column() const
{
return fColumn;
}
private:
int32 fLine;
int32 fColumn;
};
#endif // SOURCE_LOCATION_H
@@ -0,0 +1,103 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TARGET_ADDRESS_RANGE_H
#define TARGET_ADDRESS_RANGE_H
#include <algorithm>
#include "Types.h"
class TargetAddressRange {
public:
TargetAddressRange()
:
fStart(0),
fSize(0)
{
}
TargetAddressRange(target_addr_t start, target_size_t size)
:
fStart(start),
fSize(size)
{
}
TargetAddressRange(const TargetAddressRange& other)
:
fStart(other.fStart),
fSize(other.fSize)
{
}
TargetAddressRange& operator=(const TargetAddressRange& other)
{
fStart = other.fStart;
fSize = other.fSize;
return *this;
}
bool operator==(const TargetAddressRange& other) const
{
return fStart == other.fStart && fSize == other.fSize;
}
bool operator!=(const TargetAddressRange& other) const
{
return !(*this == other);
}
target_addr_t Start() const
{
return fStart;
}
target_size_t Size() const
{
return fSize;
}
target_addr_t End() const
{
return fStart + fSize;
}
bool Contains(target_addr_t address) const
{
return address >= Start() && address < End();
}
bool Contains(const TargetAddressRange& other) const
{
return Start() <= other.Start() && End() >= other.End();
}
bool IntersectsWith(const TargetAddressRange& other) const
{
return Contains(other.Start()) || other.Contains(Start());
}
TargetAddressRange& operator|=(const TargetAddressRange& other)
{
if (fSize == 0)
return *this = other;
if (other.fSize > 0) {
target_addr_t end = std::max(End(), other.End());
fStart = std::min(fStart, other.fStart);
fSize = end - fStart;
}
return *this;
}
private:
target_addr_t fStart;
target_size_t fSize;
};
#endif // TARGET_ADDRESS_RANGE_H
@@ -0,0 +1,54 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TARGET_ADDRESS_RANGE_LIST_H
#define TARGET_ADDRESS_RANGE_LIST_H
#include <Array.h>
#include <Referenceable.h>
#include "TargetAddressRange.h"
class TargetAddressRangeList : public BReferenceable {
public:
TargetAddressRangeList();
TargetAddressRangeList(
const TargetAddressRange& range);
TargetAddressRangeList(
const TargetAddressRangeList& other);
void Clear();
bool AddRange(const TargetAddressRange& range);
inline bool AddRange(target_addr_t start,
target_size_t size);
int32 CountRanges() const;
TargetAddressRange RangeAt(int32 index) const;
target_addr_t LowestAddress() const;
TargetAddressRange CoveringRange() const;
bool Contains(target_addr_t address) const;
TargetAddressRangeList& operator=(
const TargetAddressRangeList& other);
private:
typedef Array<TargetAddressRange> RangeArray;
private:
RangeArray fRanges;
};
bool
TargetAddressRangeList::AddRange(target_addr_t start, target_size_t size)
{
return AddRange(TargetAddressRange(start, size));
}
#endif // TARGET_ADDRESS_RANGE_LIST_H
+16
View File
@@ -0,0 +1,16 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef ARCHITECTURE_TYPES_H
#define ARCHITECTURE_TYPES_H
#include <SupportDefs.h>
typedef uint64 target_addr_t;
typedef uint64 target_size_t;
#endif // ARCHITECTURE_TYPES_H
@@ -0,0 +1,185 @@
/*
* Copyright 2009-2012, Ingo Weinhold, [email protected].
* Copyright 2013, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef VALUE_LOCATION_H
#define VALUE_LOCATION_H
#include <vector>
#include <stdlib.h>
#include <string.h>
#include <Referenceable.h>
#include "Types.h"
enum value_piece_location_type {
VALUE_PIECE_LOCATION_INVALID, // structure is invalid
VALUE_PIECE_LOCATION_UNKNOWN, // location unknown, but size is valid
VALUE_PIECE_LOCATION_MEMORY, // piece is in memory
VALUE_PIECE_LOCATION_REGISTER, // piece is in a register
VALUE_PIECE_LOCATION_IMPLICIT // value isn't stored anywhere in memory but is known
};
struct ValuePieceLocation {
union {
target_addr_t address; // memory address
uint32 reg; // register number
};
target_size_t size; // size in bytes (including
// incomplete ones)
uint64 bitSize; // total size in bits
uint64 bitOffset; // bit offset (to the most
// significant bit)
value_piece_location_type type;
void* value; // used for storing implicit values
bool writable; // indicates if the piece is in a
// location in the target team
// where it can be modified
ValuePieceLocation()
:
type(VALUE_PIECE_LOCATION_INVALID),
value(NULL),
writable(false)
{
}
ValuePieceLocation(const ValuePieceLocation& other)
{
if (!Copy(other))
throw std::bad_alloc();
}
~ValuePieceLocation()
{
if (value != NULL)
free(value);
}
ValuePieceLocation& operator=(const ValuePieceLocation& other)
{
if (!Copy(other))
throw std::bad_alloc();
return *this;
}
bool Copy(const ValuePieceLocation& other)
{
memcpy(this, &other, sizeof(ValuePieceLocation));
if (type == VALUE_PIECE_LOCATION_IMPLICIT) {
void* tempValue = malloc(size);
if (tempValue == NULL) {
type = VALUE_PIECE_LOCATION_INVALID;
return false;
}
memcpy(tempValue, value, other.size);
value = tempValue;
}
return true;
}
bool IsValid() const
{
return type != VALUE_PIECE_LOCATION_INVALID;
}
void SetToUnknown()
{
type = VALUE_PIECE_LOCATION_UNKNOWN;
}
void SetToMemory(target_addr_t address)
{
type = VALUE_PIECE_LOCATION_MEMORY;
this->address = address;
this->writable = true;
}
void SetToRegister(uint32 reg)
{
type = VALUE_PIECE_LOCATION_REGISTER;
this->reg = reg;
this->writable = true;
}
void SetSize(target_size_t size)
{
this->size = size;
this->bitSize = size * 8;
this->bitOffset = 0;
}
void SetSize(uint64 bitSize, uint64 bitOffset)
{
this->size = (bitOffset + bitSize + 7) / 8;
this->bitSize = bitSize;
this->bitOffset = bitOffset;
}
bool SetToValue(const void* data, target_size_t size)
{
char* valueData = (char*)malloc(size);
if (valueData == NULL)
return false;
memcpy(valueData, data, size);
SetSize(size);
type = VALUE_PIECE_LOCATION_IMPLICIT;
value = valueData;
writable = false;
return true;
}
ValuePieceLocation& Normalize(bool bigEndian);
};
class ValueLocation : public BReferenceable {
public:
ValueLocation();
ValueLocation(bool bigEndian);
ValueLocation(bool bigEndian,
const ValuePieceLocation& piece);
ValueLocation(const ValueLocation& other);
bool SetToByteOffset(const ValueLocation& other,
uint64 byteffset, uint64 Size);
bool SetTo(const ValueLocation& other,
uint64 bitOffset, uint64 bitSize);
void Clear();
bool IsBigEndian() const { return fBigEndian; }
bool IsWritable() const { return fWritable; }
bool AddPiece(const ValuePieceLocation& piece);
int32 CountPieces() const;
ValuePieceLocation PieceAt(int32 index) const;
bool SetPieceAt(int32 index,
const ValuePieceLocation& piece);
ValueLocation& operator=(const ValueLocation& other);
void Dump() const;
private:
typedef std::vector<ValuePieceLocation> PieceVector;
private:
PieceVector fPieces;
bool fBigEndian;
bool fWritable;
};
#endif // VALUE_LOCATION_H
@@ -0,0 +1,186 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2013-2016, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef USER_INTERFACE_H
#define USER_INTERFACE_H
#include <OS.h>
#include <Referenceable.h>
#include "TeamMemoryBlock.h"
#include "Types.h"
class entry_ref;
class CpuState;
class ExpressionInfo;
class FunctionInstance;
class Image;
class LocatableFile;
class SourceLanguage;
class StackFrame;
class Team;
class TeamUiSettings;
class Thread;
class TypeComponentPath;
class UserBreakpoint;
class UserInterfaceListener;
class Value;
class ValueNode;
class ValueNodeContainer;
class Watchpoint;
enum user_notification_type {
USER_NOTIFICATION_INFO,
USER_NOTIFICATION_WARNING,
USER_NOTIFICATION_ERROR
};
class UserInterface : public BReferenceable {
public:
virtual ~UserInterface();
virtual const char* ID() const = 0;
virtual status_t Init(Team* team,
UserInterfaceListener* listener) = 0;
virtual void Show() = 0;
virtual void Terminate() = 0;
// shut down the UI *now* -- no more user
// feedback
virtual bool IsInteractive() const = 0;
virtual status_t LoadSettings(const TeamUiSettings* settings)
= 0;
virtual status_t SaveSettings(TeamUiSettings*& settings)
const = 0;
virtual void NotifyUser(const char* title,
const char* message,
user_notification_type type) = 0;
virtual void NotifyBackgroundWorkStatus(const char* message)
= 0;
// this is used to inform the user about
// background processing work, but doesn't
// otherwise require any form of
// user interaction, i.e. for a status bar
// to indicate that debug information is
// being parsed.
virtual int32 SynchronouslyAskUser(const char* title,
const char* message, const char* choice1,
const char* choice2, const char* choice3)
= 0;
// returns -1, if not implemented or user
// cannot be asked
virtual status_t SynchronouslyAskUserForFile(entry_ref* _ref)
= 0;
};
class UserInterfaceListener {
public:
enum QuitOption {
QUIT_OPTION_ASK_USER,
QUIT_OPTION_ASK_KILL_TEAM,
QUIT_OPTION_ASK_RESUME_TEAM
};
public:
virtual ~UserInterfaceListener();
virtual void FunctionSourceCodeRequested(
FunctionInstance* function,
bool forceDisassembly = false) = 0;
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,
ValueNode* valueNode) = 0;
virtual void ValueNodeWriteRequested(ValueNode* node,
CpuState* state, Value* newValue) = 0;
virtual void ThreadActionRequested(thread_id threadID,
uint32 action,
target_addr_t address = 0) = 0;
virtual void SetBreakpointRequested(target_addr_t address,
bool enabled, bool hidden = false) = 0;
virtual void SetBreakpointEnabledRequested(
UserBreakpoint* breakpoint,
bool enabled) = 0;
virtual void SetBreakpointConditionRequested(
UserBreakpoint* breakpoint,
const char* condition) = 0;
virtual void ClearBreakpointConditionRequested(
UserBreakpoint* breakpoint) = 0;
virtual void ClearBreakpointRequested(
target_addr_t address) = 0;
virtual void ClearBreakpointRequested(
UserBreakpoint* breakpoint) = 0;
// TODO: Consolidate those!
virtual void SetStopOnImageLoadRequested(bool enabled,
bool useImageNames) = 0;
virtual void AddStopImageNameRequested(
const char* name) = 0;
virtual void RemoveStopImageNameRequested(
const char* name) = 0;
virtual void SetDefaultSignalDispositionRequested(
int32 disposition) = 0;
virtual void SetCustomSignalDispositionRequested(
int32 signal, int32 disposition) = 0;
virtual void RemoveCustomSignalDispositionRequested(
int32 signal) = 0;
virtual void SetWatchpointRequested(target_addr_t address,
uint32 type, int32 length,
bool enabled) = 0;
virtual void SetWatchpointEnabledRequested(
Watchpoint* watchpoint,
bool enabled) = 0;
virtual void ClearWatchpointRequested(
target_addr_t address) = 0;
virtual void ClearWatchpointRequested(
Watchpoint* watchpoint) = 0;
virtual void InspectRequested(
target_addr_t address,
TeamMemoryBlock::Listener* listener) = 0;
virtual void MemoryWriteRequested(
target_addr_t address,
const void* data,
target_size_t length) = 0;
virtual void ExpressionEvaluationRequested(
SourceLanguage* language,
ExpressionInfo* info,
StackFrame* frame = NULL,
::Thread* thread = NULL) = 0;
virtual void DebugReportRequested(entry_ref* path) = 0;
virtual void WriteCoreFileRequested(entry_ref* path) = 0;
virtual void TeamRestartRequested() = 0;
virtual bool UserInterfaceQuitRequested(
QuitOption quitOption
= QUIT_OPTION_ASK_USER) = 0;
};
#endif // USER_INTERFACE_H
@@ -0,0 +1,87 @@
/*
* Copyright 2014-2016, Rene Gollent, [email protected].
* Copyright 2012, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef UI_UTILS_H
#define UI_UTILS_H
#include <size_t.h>
#include <image.h>
#include "Types.h"
class BString;
class BVariant;
class RangeList;
class StackFrame;
class Team;
class TeamMemoryBlock;
class ValueNodeChild;
enum {
SIMD_RENDER_FORMAT_INT8 = 0,
SIMD_RENDER_FORMAT_INT16,
SIMD_RENDER_FORMAT_INT32,
SIMD_RENDER_FORMAT_INT64,
SIMD_RENDER_FORMAT_FLOAT,
SIMD_RENDER_FORMAT_DOUBLE
};
class UiUtils {
public:
static const char* ThreadStateToString(int state,
int stoppedReason);
static const char* VariantToString(const BVariant& value,
char* buffer, size_t bufferSize);
static const char* FunctionNameForFrame(StackFrame* frame,
char* buffer, size_t bufferSize);
static const char* ImageTypeToString(image_type type,
char* buffer, size_t bufferSize);
static const char* AreaLockingFlagsToString(uint32 flags,
char* buffer, size_t bufferSize);
static const BString& AreaProtectionFlagsToString(uint32 protection,
BString& _output);
static const char* ReportNameForTeam(::Team* team,
char* buffer, size_t bufferSize);
static const char* CoreFileNameForTeam(::Team* team,
char* buffer, size_t bufferSize);
// this function assumes the value nodes have already been resolved
// (if possible).
static void PrintValueNodeGraph(BString& _output,
ValueNodeChild* child,
int32 indentLevel, int32 maxDepth);
static void DumpMemory(BString& _output,
int32 indentLevel,
TeamMemoryBlock* block,
target_addr_t address, int32 itemSize,
int32 displayWidth, int32 count);
static status_t ParseRangeExpression(
const BString& rangeString,
int32 lowerBound, int32 upperBound,
bool fixedRange,
RangeList& _output);
static const char* TypeCodeToString(type_code type);
static const BString& FormatSIMDValue(const BVariant& value,
uint32 bitSize, uint32 format,
BString& _output);
static const char* SignalNameToString(int32 signal,
BString& _output);
static const char* SignalDispositionToString(int disposition);
};
#endif // UI_UTILS_H
@@ -0,0 +1,32 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef INTEGER_FORMATTER_H
#define INTEGER_FORMATTER_H
#include <Variant.h>
enum integer_format {
INTEGER_FORMAT_DEFAULT = 0,
INTEGER_FORMAT_SIGNED = 1,
INTEGER_FORMAT_UNSIGNED = 2,
INTEGER_FORMAT_HEX_DEFAULT = 3,
INTEGER_FORMAT_HEX_8 = 8,
INTEGER_FORMAT_HEX_16 = 16,
INTEGER_FORMAT_HEX_32 = 32,
INTEGER_FORMAT_HEX_64 = 64
};
class IntegerFormatter {
public:
static bool FormatValue(const BVariant& value,
integer_format format, char* buffer,
size_t bufferSize);
};
#endif // INTEGER_FORMATTER_H
+55
View File
@@ -0,0 +1,55 @@
/*
* Copyright 2013, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef RANGE_LIST_H
#define RANGE_LIST_H
#include <ObjectList.h>
#include <SupportDefs.h>
struct Range {
int32 lowerBound;
int32 upperBound;
Range()
:
lowerBound(-1),
upperBound(-1)
{
}
Range(int32 lowValue, int32 highValue)
:
lowerBound(lowValue),
upperBound(highValue)
{
}
};
class RangeList : private BObjectList<Range>
{
public:
RangeList();
virtual ~RangeList();
status_t AddRange(int32 lowValue, int32 highValue);
status_t AddRange(const Range& range);
void RemoveRangeAt(int32 index);
int32 CountRanges() const;
const Range* RangeAt(int32 index) const;
bool Contains(int32 value) const;
private:
void _CollapseOverlappingRanges(int32 startIndex,
int32 highValue);
};
#endif // RANGE_LIST_H
@@ -0,0 +1,25 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected]. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef STRING_UTILS_H
#define STRING_UTILS_H
#include <String.h>
class StringUtils {
public:
static uint32 HashValue(const char* string);
static uint32 HashValue(const BString& string);
};
/*static*/ inline uint32
StringUtils::HashValue(const BString& string)
{
return HashValue(string.String());
}
#endif // STRING_UTILS_H
+220
View File
@@ -0,0 +1,220 @@
/*
* Copyright 2009-2012, Ingo Weinhold, [email protected].
* Copyright 2014, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef WORKER_H
#define WORKER_H
#include <Locker.h>
#include <ObjectList.h>
#include <Referenceable.h>
#include <String.h>
#include <util/DoublyLinkedList.h>
#include <util/OpenHashTable.h>
class Job;
class Worker;
enum job_state {
JOB_STATE_UNSCHEDULED,
JOB_STATE_WAITING,
JOB_STATE_ACTIVE,
JOB_STATE_ABORTED,
JOB_STATE_FAILED,
JOB_STATE_SUCCEEDED
};
enum job_wait_status {
JOB_DEPENDENCY_NOT_FOUND,
JOB_DEPENDENCY_SUCCEEDED,
JOB_DEPENDENCY_FAILED,
JOB_DEPENDENCY_ABORTED,
JOB_DEPENDENCY_ACTIVE,
JOB_USER_INPUT_WAITING
// internal only
};
class JobKey {
public:
virtual ~JobKey();
virtual size_t HashValue() const = 0;
virtual bool operator==(const JobKey& other) const = 0;
};
struct SimpleJobKey : public JobKey {
const void* object;
uint32 type;
public:
SimpleJobKey(const void* object, uint32 type);
SimpleJobKey(const SimpleJobKey& other);
virtual size_t HashValue() const;
virtual bool operator==(const JobKey& other) const;
SimpleJobKey& operator=(const SimpleJobKey& other);
};
class JobListener {
public:
virtual ~JobListener();
virtual void JobStarted(Job* job);
virtual void JobDone(Job* job);
virtual void JobWaitingForInput(Job* job);
virtual void JobFailed(Job* job);
virtual void JobAborted(Job* job);
};
typedef DoublyLinkedList<Job> JobList;
class Job : public BReferenceable, public DoublyLinkedListLinkImpl<Job> {
public:
Job();
virtual ~Job();
virtual const JobKey& Key() const = 0;
virtual status_t Do() = 0;
Worker* GetWorker() const { return fWorker; }
job_state State() const { return fState; }
const BString& GetDescription() const
{ return fDescription; }
protected:
job_wait_status WaitFor(const JobKey& key);
status_t WaitForUserInput();
void SetDescription(const char* format, ...);
private:
friend class Worker;
private:
void SetWorker(Worker* worker);
void SetState(job_state state);
Job* Dependency() const { return fDependency; }
void SetDependency(Job* job);
JobList& DependentJobs() { return fDependentJobs; }
job_wait_status WaitStatus() const { return fWaitStatus; }
void SetWaitStatus(job_wait_status status);
status_t AddListener(JobListener* listener);
void RemoveListener(JobListener* listener);
void NotifyListeners();
private:
typedef BObjectList<JobListener> ListenerList;
private:
Worker* fWorker;
job_state fState;
Job* fDependency;
JobList fDependentJobs;
job_wait_status fWaitStatus;
ListenerList fListeners;
BString fDescription;
public:
Job* fNext;
};
class Worker {
public:
Worker();
~Worker();
status_t Init();
void ShutDown();
bool Lock() { return fLock.Lock(); }
void Unlock() { fLock.Unlock(); }
status_t ScheduleJob(Job* job,
JobListener* listener = NULL);
// always takes over reference
void AbortJob(const JobKey& key);
Job* GetJob(const JobKey& key);
status_t ResumeJob(Job* job);
// only valid for jobs that are
// suspended pending user input
bool HasPendingJobs();
status_t AddListener(const JobKey& key,
JobListener* listener);
void RemoveListener(const JobKey& key,
JobListener* listener);
private:
friend class Job;
struct JobHashDefinition {
typedef JobKey KeyType;
typedef Job ValueType;
size_t HashKey(const JobKey& key) const
{
return key.HashValue();
}
size_t Hash(Job* value) const
{
return HashKey(value->Key());
}
bool Compare(const JobKey& key, Job* value) const
{
return value->Key() == key;
}
Job*& GetLink(Job* value) const
{
return value->fNext;
}
};
typedef BOpenHashTable<JobHashDefinition> JobTable;
private:
job_wait_status WaitForJob(Job* waitingJob, const JobKey& key);
status_t WaitForUserInput(Job* waitingJob);
static status_t _WorkerLoopEntry(void* data);
status_t _WorkerLoop();
void _ProcessJobs();
void _AbortJob(Job* job, bool removeFromTable);
void _FinishJob(Job* job);
private:
BLocker fLock;
JobTable fJobs;
JobList fUnscheduledJobs;
JobList fAbortedJobs;
JobList fSuspendedJobs;
sem_id fWorkToDoSem;
thread_id fWorkerThread;
volatile bool fTerminating;
};
#endif // WORKER_H
@@ -0,0 +1,28 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TYPE_HANDLER_H
#define TYPE_HANDLER_H
#include <Referenceable.h>
class Type;
class ValueNode;
class ValueNodeChild;
class TypeHandler : public BReferenceable {
public:
virtual ~TypeHandler();
virtual float SupportsType(Type* type) = 0;
virtual status_t CreateValueNode(ValueNodeChild* nodeChild,
Type* type, ValueNode*& _node) = 0;
// returns a reference
};
#endif // TYPE_HANDLER_H
@@ -0,0 +1,51 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TYPE_HANDLER_ROSTER_H
#define TYPE_HANDLER_ROSTER_H
#include <Locker.h>
#include <ObjectList.h>
class Type;
class TypeHandler;
class ValueNode;
class ValueNodeChild;
typedef BObjectList<TypeHandler> TypeHandlerList;
class TypeHandlerRoster {
public:
TypeHandlerRoster();
~TypeHandlerRoster();
static TypeHandlerRoster* Default();
static status_t CreateDefault();
static void DeleteDefault();
status_t Init();
status_t RegisterDefaultHandlers();
status_t FindTypeHandler(ValueNodeChild* nodeChild,
Type* type, TypeHandler*& _handler);
// returns a reference
status_t CreateValueNode(ValueNodeChild* nodeChild,
Type* type, ValueNode*& _node);
// returns a reference
bool RegisterHandler(TypeHandler* handler);
void UnregisterHandler(TypeHandler* handler);
private:
BLocker fLock;
TypeHandlerList fTypeHandlers;
static TypeHandlerRoster* sDefaultInstance;
};
#endif // TYPE_HANDLER_ROSTER_H
+27
View File
@@ -0,0 +1,27 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef VALUE_H
#define VALUE_H
#include <String.h>
#include <Variant.h>
class Value : public BReferenceable {
public:
virtual ~Value();
virtual bool ToString(BString& _string) const = 0;
virtual bool ToVariant(BVariant& _value) const = 0;
virtual bool operator==(const Value& other) const = 0;
inline bool operator!=(const Value& other) const
{ return !(*this == other); }
};
#endif // VALUE_H
@@ -0,0 +1,42 @@
/*
* Copyright 2015, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef VALUE_FORMATTER_H
#define VALUE_FORMATTER_H
#include <Referenceable.h>
class BString;
class Settings;
class Value;
class ValueFormatter : public BReferenceable {
public:
virtual ~ValueFormatter();
virtual Settings* GetSettings() const = 0;
// returns NULL, if no settings
virtual status_t FormatValue(Value* value, BString& _output)
= 0;
virtual bool SupportsValidation() const;
virtual bool ValidateFormattedValue(
const BString& input,
type_code type) const;
// checks if the passed in string
// would be considered a valid value
// according to the current format
// configuration and the size constraints
// imposed by the passed in type.
virtual status_t GetValueFromFormattedInput(
const BString& input, type_code type,
Value*& _output) const;
// returns reference
};
#endif // VALUE_FORMATTER_H
+146
View File
@@ -0,0 +1,146 @@
/*
* Copyright 2015, Rene Gollent, [email protected].
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef VALUE_NODE_H
#define VALUE_NODE_H
#include <String.h>
#include <Referenceable.h>
class TeamTypeInformation;
class Type;
class Value;
class ValueLoader;
class ValueLocation;
class ValueNodeChild;
class ValueNodeContainer;
enum {
VALUE_NODE_UNRESOLVED = 1
};
class ValueNode : public BReferenceable {
public:
ValueNode(ValueNodeChild* nodeChild);
virtual ~ValueNode();
ValueNodeChild* NodeChild() const { return fNodeChild; }
virtual const BString& Name() const;
virtual Type* GetType() const = 0;
virtual status_t ResolvedLocationAndValue(
ValueLoader* valueLoader,
ValueLocation*& _location,
Value*& _value) = 0;
// returns references, a NULL value can be
// returned
// locking required
ValueNodeContainer* Container() const
{ return fContainer; }
void SetContainer(ValueNodeContainer* container);
virtual bool ChildCreationNeedsValue() const
{ return false; }
bool ChildrenCreated() const
{ return fChildrenCreated; }
virtual status_t CreateChildren(TeamTypeInformation* info) = 0;
virtual int32 CountChildren() const = 0;
virtual ValueNodeChild* ChildAt(int32 index) const = 0;
// optional virtual hooks for container type value nodes such as
// arrays that may contain a variable (and potentially quite large)
// number of children. The calls below should be implemented for such
// node types to allow the upper layers to be aware of this, and to be
// able to request that only a subset of children be created.
virtual bool IsRangedContainer() const;
virtual bool IsContainerRangeFixed() const;
// indicates that the user can't
// arbitrarily go outside of the
// specified/supported range.
virtual void ClearChildren();
virtual status_t CreateChildrenInRange(
TeamTypeInformation* info,
int32 lowIndex, int32 highIndex);
virtual status_t SupportedChildRange(int32& lowIndex,
int32& highIndex) const;
status_t LocationAndValueResolutionState() const
{ return fLocationResolutionState; }
void SetLocationAndValue(ValueLocation* location,
Value* value, status_t resolutionState);
ValueLocation* Location() const { return fLocation; }
Value* GetValue() const { return fValue; }
// immutable after SetLocationAndValue()
protected:
ValueNodeContainer* fContainer;
ValueNodeChild* fNodeChild;
ValueLocation* fLocation;
Value* fValue;
status_t fLocationResolutionState;
bool fChildrenCreated;
};
class ValueNodeChild : public BReferenceable {
public:
ValueNodeChild();
virtual ~ValueNodeChild();
virtual const BString& Name() const = 0;
virtual Type* GetType() const = 0;
virtual ValueNode* Parent() const = 0;
virtual bool IsInternal() const;
virtual status_t CreateInternalNode(ValueNode*& _node);
virtual status_t ResolveLocation(ValueLoader* valueLoader,
ValueLocation*& _location) = 0;
// returns a reference
// locking required
ValueNodeContainer* Container() const
{ return fContainer; }
void SetContainer(ValueNodeContainer* container);
ValueNode* Node() const { return fNode; }
void SetNode(ValueNode* node);
status_t LocationResolutionState() const
{ return fLocationResolutionState; }
ValueLocation* Location() const;
// immutable after SetLocation()
void SetLocation(ValueLocation* location,
status_t resolutionState);
protected:
ValueNodeContainer* fContainer;
ValueNode* fNode;
ValueLocation* fLocation;
status_t fLocationResolutionState;
};
class ChildlessValueNode : public ValueNode {
public:
ChildlessValueNode(ValueNodeChild* nodeChild);
virtual status_t CreateChildren(TeamTypeInformation* info);
virtual int32 CountChildren() const;
virtual ValueNodeChild* ChildAt(int32 index) const;
};
#endif // VALUE_NODE_H
@@ -0,0 +1,75 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef VALUE_NODE_CONTAINER_H
#define VALUE_NODE_CONTAINER_H
#include <Locker.h>
#include <ObjectList.h>
#include <Referenceable.h>
class ValueNode;
class ValueNodeChild;
class ValueNodeContainer : public BReferenceable {
public:
class Listener;
public:
ValueNodeContainer();
virtual ~ValueNodeContainer();
status_t Init();
inline bool Lock() { return fLock.Lock(); }
inline void Unlock() { fLock.Unlock(); }
int32 CountChildren() const;
ValueNodeChild* ChildAt(int32 index) const;
bool AddChild(ValueNodeChild* child);
void RemoveChild(ValueNodeChild* child);
void RemoveAllChildren();
bool AddListener(Listener* listener);
void RemoveListener(Listener* listener);
// container must be locked
void NotifyValueNodeChanged(
ValueNodeChild* nodeChild,
ValueNode* oldNode, ValueNode* newNode);
void NotifyValueNodeChildrenCreated(ValueNode* node);
void NotifyValueNodeChildrenDeleted(ValueNode* node);
void NotifyValueNodeValueChanged(ValueNode* node);
private:
typedef BObjectList<ValueNodeChild> NodeChildList;
typedef BObjectList<Listener> ListenerList;
private:
BLocker fLock;
NodeChildList fChildren;
ListenerList fListeners;
};
class ValueNodeContainer::Listener {
public:
virtual ~Listener();
// container is locked
virtual void ValueNodeChanged(ValueNodeChild* nodeChild,
ValueNode* oldNode, ValueNode* newNode);
virtual void ValueNodeChildrenCreated(ValueNode* node);
virtual void ValueNodeChildrenDeleted(ValueNode* node);
virtual void ValueNodeValueChanged(ValueNode* node);
};
#endif // VALUE_NODE_CONTAINER_H
@@ -0,0 +1,28 @@
/*
* Copyright 2015, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef BOOL_VALUE_FORMATTER_H
#define BOOL_VALUE_FORMATTER_H
#include "ValueFormatter.h"
class Settings;
class Value;
class BoolValueFormatter : public ValueFormatter {
public:
BoolValueFormatter();
virtual ~BoolValueFormatter();
virtual Settings* GetSettings() const
{ return NULL; }
virtual status_t FormatValue(Value* value, BString& _output);
};
#endif // BOOL_VALUE_FORMATTER_H

Some files were not shown because too many files have changed in this diff Show More