xref: /haiku/src/kits/debugger/model/ReturnValueInfo.cpp (revision fce4895d1884da5ae6fb299d23c735c598e690b1)
1 /*
2  * Copyright 2013, Rene Gollent, rene@gollent.com.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include "ReturnValueInfo.h"
8 
9 #include "CpuState.h"
10 
11 
ReturnValueInfo()12 ReturnValueInfo::ReturnValueInfo()
13 	:
14 	BReferenceable(),
15 	fAddress(0),
16 	fState(NULL)
17 {
18 }
19 
20 
ReturnValueInfo(target_addr_t address,CpuState * state)21 ReturnValueInfo::ReturnValueInfo(target_addr_t address, CpuState* state)
22 	:
23 	BReferenceable(),
24 	fAddress(address),
25 	fState(state)
26 {
27 	state->AcquireReference();
28 }
29 
30 
~ReturnValueInfo()31 ReturnValueInfo::~ReturnValueInfo()
32 {
33 	if (fState != NULL)
34 		fState->ReleaseReference();
35 }
36 
37 
38 void
SetTo(target_addr_t address,CpuState * state)39 ReturnValueInfo::SetTo(target_addr_t address, CpuState* state)
40 {
41 	fAddress = address;
42 
43 	if (fState != NULL)
44 		fState->ReleaseReference();
45 
46 	fState = state;
47 	fState->AcquireReference();
48 }
49