2009-07-08 00:47:39 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef USER_BREAKPOINT_H
|
|
|
|
#define USER_BREAKPOINT_H
|
|
|
|
|
2009-07-24 06:35:30 +04:00
|
|
|
|
2009-07-08 00:47:39 +04:00
|
|
|
#include <ObjectList.h>
|
|
|
|
#include <Referenceable.h>
|
|
|
|
#include <util/DoublyLinkedList.h>
|
|
|
|
|
2009-07-24 06:35:30 +04:00
|
|
|
#include "SourceLocation.h"
|
2009-07-08 00:47:39 +04:00
|
|
|
#include "Types.h"
|
|
|
|
|
|
|
|
|
|
|
|
class Breakpoint;
|
|
|
|
class Function;
|
2009-07-24 06:35:30 +04:00
|
|
|
class FunctionID;
|
|
|
|
class LocatableFile;
|
2009-07-08 00:47:39 +04:00
|
|
|
class UserBreakpoint;
|
|
|
|
|
|
|
|
|
2009-07-24 06:35:30 +04:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-07-08 00:47:39 +04:00
|
|
|
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;
|
|
|
|
|
|
|
|
|
2010-12-16 16:50:30 +03:00
|
|
|
class UserBreakpoint : public BReferenceable,
|
2009-07-24 06:35:30 +04:00
|
|
|
public DoublyLinkedListLinkImpl<UserBreakpoint> {
|
2009-07-08 00:47:39 +04:00
|
|
|
public:
|
2009-07-24 06:35:30 +04:00
|
|
|
UserBreakpoint(
|
|
|
|
const UserBreakpointLocation& location);
|
2009-07-08 00:47:39 +04:00
|
|
|
~UserBreakpoint();
|
|
|
|
|
2009-07-24 06:35:30 +04:00
|
|
|
const UserBreakpointLocation& Location() const { return fLocation; }
|
2009-07-08 00:47:39 +04:00
|
|
|
|
|
|
|
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);
|
2009-07-24 06:35:30 +04:00
|
|
|
UserBreakpointInstance* RemoveInstanceAt(int32 index);
|
2009-07-08 00:47:39 +04:00
|
|
|
|
|
|
|
bool IsValid() const { return fValid; }
|
|
|
|
void SetValid(bool valid);
|
|
|
|
// BreakpointManager only
|
|
|
|
|
|
|
|
bool IsEnabled() const { return fEnabled; }
|
|
|
|
void SetEnabled(bool enabled);
|
|
|
|
// BreakpointManager only
|
|
|
|
|
|
|
|
private:
|
|
|
|
typedef BObjectList<UserBreakpointInstance> InstanceList;
|
|
|
|
|
|
|
|
private:
|
2009-07-24 06:35:30 +04:00
|
|
|
UserBreakpointLocation fLocation;
|
2009-07-08 00:47:39 +04:00
|
|
|
InstanceList fInstances;
|
|
|
|
bool fValid;
|
|
|
|
bool fEnabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-07-24 06:35:30 +04:00
|
|
|
typedef DoublyLinkedList<UserBreakpoint> UserBreakpointList;
|
|
|
|
|
|
|
|
|
2009-07-08 00:47:39 +04:00
|
|
|
#endif // USER_BREAKPOINT_H
|