Add ReturnValueInfo class for storing function return information.
This commit is contained in:
parent
5a6b854033
commit
3fa429781c
47
src/apps/debugger/model/ReturnValueInfo.cpp
Normal file
47
src/apps/debugger/model/ReturnValueInfo.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2013, Rene Gollent, rene@gollent.com.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include "ReturnValueInfo.h"
|
||||
|
||||
#include "CpuState.h"
|
||||
|
||||
|
||||
ReturnValueInfo::ReturnValueInfo()
|
||||
:
|
||||
BReferenceable(),
|
||||
fAddress(0),
|
||||
fState(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ReturnValueInfo::ReturnValueInfo(target_addr_t address, CpuState* state)
|
||||
:
|
||||
BReferenceable(),
|
||||
fAddress(address),
|
||||
fState(state)
|
||||
{
|
||||
state->AcquireReference();
|
||||
}
|
||||
|
||||
|
||||
ReturnValueInfo::~ReturnValueInfo()
|
||||
{
|
||||
if (fState != NULL)
|
||||
fState->ReleaseReference();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ReturnValueInfo::SetTo(target_addr_t address, CpuState* state)
|
||||
{
|
||||
fAddress = address;
|
||||
|
||||
if (fState != NULL)
|
||||
fState->ReleaseReference();
|
||||
|
||||
fState = state;
|
||||
fState->AcquireReference();
|
||||
}
|
38
src/apps/debugger/model/ReturnValueInfo.h
Normal file
38
src/apps/debugger/model/ReturnValueInfo.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2013, Rene Gollent, rene@gollent.com.
|
||||
* 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
|
Loading…
x
Reference in New Issue
Block a user