2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Copyright 2011-2016, Rene Gollent, rene@gollent.com.
4 * Distributed under the terms of the MIT License.
12 #include "ImageDebugInfoLoadingState.h"
13 #include "ImageDebugInfoProvider.h"
21 class DebuggerInterface
;
23 class ExpressionResult
;
25 class FunctionInstance
;
29 class StackFrameValues
;
32 class TeamMemoryBlock
;
33 class TeamTypeInformation
;
36 class TypeComponentPath
;
41 class ValueNodeContainer
;
42 class ValueNodeManager
;
48 JOB_TYPE_GET_THREAD_STATE
,
49 JOB_TYPE_GET_CPU_STATE
,
50 JOB_TYPE_GET_STACK_TRACE
,
51 JOB_TYPE_LOAD_IMAGE_DEBUG_INFO
,
52 JOB_TYPE_LOAD_SOURCE_CODE
,
53 JOB_TYPE_GET_STACK_FRAME_VALUE
,
54 JOB_TYPE_RESOLVE_VALUE_NODE_VALUE
,
55 JOB_TYPE_WRITE_VALUE_NODE_VALUE
,
56 JOB_TYPE_GET_MEMORY_BLOCK
,
57 JOB_TYPE_WRITE_MEMORY
,
58 JOB_TYPE_EVALUATE_EXPRESSION
,
59 JOB_TYPE_WRITE_CORE_FILE
63 class GetThreadStateJob
: public Job
{
66 DebuggerInterface
* debuggerInterface
,
68 virtual ~GetThreadStateJob();
70 virtual const JobKey
& Key() const;
71 virtual status_t
Do();
75 DebuggerInterface
* fDebuggerInterface
;
80 class GetCpuStateJob
: public Job
{
83 DebuggerInterface
* debuggerInterface
,
85 virtual ~GetCpuStateJob();
87 virtual const JobKey
& Key() const;
88 virtual status_t
Do();
92 DebuggerInterface
* fDebuggerInterface
;
97 class GetStackTraceJob
: public Job
, private ImageDebugInfoProvider
{
100 DebuggerInterface
* debuggerInterface
,
101 JobListener
* jobListener
,
102 Architecture
* architecture
,
104 virtual ~GetStackTraceJob();
106 virtual const JobKey
& Key() const;
107 virtual status_t
Do();
110 // ImageDebugInfoProvider
111 virtual status_t
GetImageDebugInfo(Image
* image
,
112 ImageDebugInfo
*& _info
);
116 DebuggerInterface
* fDebuggerInterface
;
117 JobListener
* fJobListener
;
118 Architecture
* fArchitecture
;
124 class LoadImageDebugInfoJob
: public Job
{
126 LoadImageDebugInfoJob(Image
* image
);
127 virtual ~LoadImageDebugInfoJob();
129 virtual const JobKey
& Key() const;
130 virtual status_t
Do();
132 static status_t
ScheduleIfNecessary(Worker
* worker
,
134 JobListener
* jobListener
,
135 ImageDebugInfo
** _imageDebugInfo
= NULL
);
136 // If already loaded returns a
137 // reference, if desired. If not loaded
138 // schedules a job, but does not wait;
139 // returns B_OK and NULL. An error,
140 // if scheduling the job failed, or the
141 // debug info already failed to load
144 ImageDebugInfoLoadingState
*
151 ImageDebugInfoLoadingState
156 class LoadSourceCodeJob
: public Job
{
159 DebuggerInterface
* debuggerInterface
,
160 Architecture
* architecture
, Team
* team
,
161 FunctionInstance
* functionInstance
,
162 bool loadForFunction
);
163 virtual ~LoadSourceCodeJob();
165 virtual const JobKey
& Key() const;
166 virtual status_t
Do();
170 DebuggerInterface
* fDebuggerInterface
;
171 Architecture
* fArchitecture
;
173 FunctionInstance
* fFunctionInstance
;
174 bool fLoadForFunction
;
178 class ResolveValueNodeValueJob
: public Job
{
180 ResolveValueNodeValueJob(
181 DebuggerInterface
* debuggerInterface
,
182 Architecture
* architecture
,
184 TeamTypeInformation
* typeInformation
,
185 ValueNodeContainer
* container
,
186 ValueNode
* valueNode
);
187 virtual ~ResolveValueNodeValueJob();
189 virtual const JobKey
& Key() const;
190 virtual status_t
Do();
193 status_t
_ResolveNodeValue();
194 status_t
_ResolveNodeChildLocation(
195 ValueNodeChild
* nodeChild
);
196 status_t
_ResolveParentNodeValue(ValueNode
* parentNode
);
201 DebuggerInterface
* fDebuggerInterface
;
202 Architecture
* fArchitecture
;
206 ValueNodeContainer
* fContainer
;
207 ValueNode
* fValueNode
;
211 class WriteValueNodeValueJob
: public Job
{
213 WriteValueNodeValueJob(
214 DebuggerInterface
* debuggerInterface
,
215 Architecture
* architecture
,
217 TeamTypeInformation
* typeInformation
,
218 ValueNode
* valueNode
,
220 virtual ~WriteValueNodeValueJob();
222 virtual const JobKey
& Key() const;
223 virtual status_t
Do();
227 DebuggerInterface
* fDebuggerInterface
;
228 Architecture
* fArchitecture
;
232 ValueNode
* fValueNode
;
237 class RetrieveMemoryBlockJob
: public Job
{
239 RetrieveMemoryBlockJob(Team
* team
,
240 TeamMemory
* teamMemory
,
241 TeamMemoryBlock
* memoryBlock
);
242 virtual ~RetrieveMemoryBlockJob();
244 virtual const JobKey
& Key() const;
245 virtual status_t
Do();
250 TeamMemory
* fTeamMemory
;
251 TeamMemoryBlock
* fMemoryBlock
;
255 class WriteMemoryJob
: public Job
{
257 WriteMemoryJob(Team
* team
,
258 TeamMemory
* teamMemory
,
259 target_addr_t address
, void* data
,
261 virtual ~WriteMemoryJob();
263 virtual const JobKey
& Key() const;
264 virtual status_t
Do();
269 TeamMemory
* fTeamMemory
;
270 target_addr_t fTargetAddress
;
276 class ExpressionEvaluationJob
: public Job
{
278 ExpressionEvaluationJob(Team
* team
,
279 DebuggerInterface
* debuggerInterface
,
280 SourceLanguage
* language
,
281 ExpressionInfo
* info
,
284 virtual ~ExpressionEvaluationJob();
286 virtual const JobKey
& Key() const;
287 virtual status_t
Do();
289 ExpressionResult
* GetResult() const { return fResultValue
; }
292 status_t
ResolveNodeValue(ValueNode
* node
);
297 DebuggerInterface
* fDebuggerInterface
;
298 Architecture
* fArchitecture
;
299 TeamTypeInformation
* fTypeInformation
;
300 SourceLanguage
* fLanguage
;
301 ExpressionInfo
* fExpressionInfo
;
304 ValueNodeManager
* fManager
;
305 ExpressionResult
* fResultValue
;
309 class WriteCoreFileJob
: public Job
{
311 WriteCoreFileJob(Team
* team
,
312 DebuggerInterface
* debuggerInterface
,
313 const entry_ref
& targetPath
);
314 virtual ~WriteCoreFileJob();
316 virtual const JobKey
& Key() const;
317 virtual status_t
Do();
322 DebuggerInterface
* fDebuggerInterface
;
323 entry_ref fTargetPath
;