libdebugger: Implement remaining remote request/response pairs.

This commit is contained in:
Rene Gollent 2016-07-31 20:24:58 -04:00
parent bcca096ae5
commit 9e4d0fd483
2 changed files with 250 additions and 0 deletions

View File

@ -608,6 +608,177 @@ RemoteDebugSetCpuStateRequest::SaveSpecificInfoToMessage(
}
// #pragma mark - RemoteDebugAddressActionRequest
RemoteDebugAddressActionRequest::RemoteDebugAddressActionRequest()
:
RemoteDebugRequest(),
fAddress(0)
{
}
RemoteDebugAddressActionRequest::~RemoteDebugAddressActionRequest()
{
}
void
RemoteDebugAddressActionRequest::SetTo(target_addr_t address)
{
fAddress = address;
}
status_t
RemoteDebugAddressActionRequest::LoadSpecificInfoFromMessage(
const BMessage& data)
{
return data.FindUInt64("address", &fAddress);
}
status_t
RemoteDebugAddressActionRequest::SaveSpecificInfoToMessage(
BMessage& _output) const
{
return _output.AddUInt64("address", fAddress);
}
// #pragma mark - RemoteDebugInstallBreakpointRequest
RemoteDebugInstallBreakpointRequest::RemoteDebugInstallBreakpointRequest()
:
RemoteDebugAddressActionRequest()
{
}
RemoteDebugInstallBreakpointRequest::~RemoteDebugInstallBreakpointRequest()
{
}
remote_request_type
RemoteDebugInstallBreakpointRequest::Type() const
{
return REMOTE_REQUEST_TYPE_INSTALL_BREAKPOINT;
}
// #pragma mark - RemoteDebugUninstallBreakpointRequest
RemoteDebugUninstallBreakpointRequest::RemoteDebugUninstallBreakpointRequest()
:
RemoteDebugAddressActionRequest()
{
}
RemoteDebugUninstallBreakpointRequest::~RemoteDebugUninstallBreakpointRequest()
{
}
remote_request_type
RemoteDebugUninstallBreakpointRequest::Type() const
{
return REMOTE_REQUEST_TYPE_UNINSTALL_BREAKPOINT;
}
// #pragma mark - RemoteDebugInstallWatchpointRequest
RemoteDebugInstallWatchpointRequest::RemoteDebugInstallWatchpointRequest()
:
RemoteDebugRequest(),
fAddress(0),
fWatchType(B_DATA_READ_WATCHPOINT),
fLength(0)
{
}
RemoteDebugInstallWatchpointRequest::~RemoteDebugInstallWatchpointRequest()
{
}
void
RemoteDebugInstallWatchpointRequest::SetTo(target_addr_t address, uint32 type,
int32 length)
{
fAddress = address;
fWatchType = type;
fLength = length;
}
remote_request_type
RemoteDebugInstallWatchpointRequest::Type() const
{
return REMOTE_REQUEST_TYPE_INSTALL_WATCHPOINT;
}
status_t
RemoteDebugInstallWatchpointRequest::LoadSpecificInfoFromMessage(
const BMessage& data)
{
status_t error = data.FindUInt64("address", &fAddress);
if (error != B_OK)
return error;
error = data.FindUInt32("watchtype", &fWatchType);
if (error != B_OK)
return error;
return data.FindInt32("length", &fLength);
}
status_t
RemoteDebugInstallWatchpointRequest::SaveSpecificInfoToMessage(
BMessage& _output) const
{
status_t error = _output.AddUInt64("address", fAddress);
if (error != B_OK)
return error;
error = _output.AddUInt32("watchtype", fWatchType);
if (error != B_OK)
return error;
return _output.AddInt32("length", fLength);
}
// #pragma mark - RemoteDebugUninstallWatchpointRequest
RemoteDebugUninstallWatchpointRequest::RemoteDebugUninstallWatchpointRequest()
:
RemoteDebugAddressActionRequest()
{
}
RemoteDebugUninstallWatchpointRequest::~RemoteDebugUninstallWatchpointRequest()
{
}
remote_request_type
RemoteDebugUninstallWatchpointRequest::Type() const
{
return REMOTE_REQUEST_TYPE_UNINSTALL_WATCHPOINT;
}
// #pragma mark - RemoteDebugReadMemoryResponse

View File

@ -296,6 +296,85 @@ private:
};
// abstract base for the various actions that influence how the CPU
// reacts to a particular memory address, ergo break/watchpoints.
class RemoteDebugAddressActionRequest : public RemoteDebugRequest {
public:
RemoteDebugAddressActionRequest();
virtual ~RemoteDebugAddressActionRequest();
void SetTo(target_addr_t address);
target_addr_t Address() const { return fAddress; }
protected:
virtual status_t LoadSpecificInfoFromMessage(
const BMessage& data);
virtual status_t SaveSpecificInfoToMessage(
BMessage& _output) const;
private:
target_addr_t fAddress;
};
class RemoteDebugInstallBreakpointRequest
: public RemoteDebugAddressActionRequest {
public:
RemoteDebugInstallBreakpointRequest();
virtual ~RemoteDebugInstallBreakpointRequest();
virtual remote_request_type Type() const;
};
class RemoteDebugUninstallBreakpointRequest
: public RemoteDebugAddressActionRequest {
public:
RemoteDebugUninstallBreakpointRequest();
virtual ~RemoteDebugUninstallBreakpointRequest();
virtual remote_request_type Type() const;
};
class RemoteDebugInstallWatchpointRequest : public RemoteDebugRequest {
public:
RemoteDebugInstallWatchpointRequest();
virtual ~RemoteDebugInstallWatchpointRequest();
void SetTo(target_addr_t address, uint32 type,
int32 length);
target_addr_t Address() const { return fAddress; }
uint32 WatchType() const { return fWatchType; }
int32 Length() const { return fLength; }
virtual remote_request_type Type() const;
protected:
virtual status_t LoadSpecificInfoFromMessage(
const BMessage& data);
virtual status_t SaveSpecificInfoToMessage(
BMessage& _output) const;
private:
target_addr_t fAddress;
uint32 fWatchType;
int32 fLength;
};
class RemoteDebugUninstallWatchpointRequest
: public RemoteDebugAddressActionRequest {
public:
RemoteDebugUninstallWatchpointRequest();
virtual ~RemoteDebugUninstallWatchpointRequest();
virtual remote_request_type Type() const;
};
// #pragma mark - Responses