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:
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user