2 * Copyright 2015, Rene Gollent, rene@gollent.com.
3 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
4 * Distributed under the terms of the MIT License.
9 #include <AutoLocker.h>
11 #include "Architecture.h"
13 #include "DebuggerInterface.h"
14 #include "TeamTypeInformation.h"
17 #include "ValueLocation.h"
18 #include "ValueNode.h"
19 #include "ValueNodeContainer.h"
20 #include "ValueWriter.h"
23 WriteValueNodeValueJob::WriteValueNodeValueJob(
24 DebuggerInterface
* debuggerInterface
, Architecture
* architecture
,
25 CpuState
* cpuState
, TeamTypeInformation
* typeInformation
,
26 ValueNode
* valueNode
, Value
* newValue
)
28 fKey(valueNode
, JOB_TYPE_WRITE_VALUE_NODE_VALUE
),
29 fDebuggerInterface(debuggerInterface
),
30 fArchitecture(architecture
),
32 fTypeInformation(typeInformation
),
33 fValueNode(valueNode
),
36 if (fCpuState
!= NULL
)
37 fCpuState
->AcquireReference();
38 fValueNode
->AcquireReference();
39 fNewValue
->AcquireReference();
43 WriteValueNodeValueJob::~WriteValueNodeValueJob()
45 if (fCpuState
!= NULL
)
46 fCpuState
->ReleaseReference();
47 fValueNode
->ReleaseReference();
48 fNewValue
->ReleaseReference();
53 WriteValueNodeValueJob::Key() const
60 WriteValueNodeValueJob::Do()
62 ValueNodeContainer
* container
= fValueNode
->Container();
63 if (container
== NULL
)
66 ValueWriter
writer(fArchitecture
, fDebuggerInterface
,
70 fNewValue
->ToVariant(value
);
72 status_t error
= writer
.WriteValue(fValueNode
->Location(), value
);
76 AutoLocker
<ValueNodeContainer
> containerLocker(container
);
77 fValueNode
->SetLocationAndValue(fValueNode
->Location(), fNewValue
, B_OK
);