1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
//===-- ExecutionContext.cpp ------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//
//
//===----------------------------------------------------------------------===//
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
using namespace lldb_private;
ExecutionContext::ExecutionContext() :
target (NULL),
process (NULL),
thread (NULL),
frame (NULL)
{
}
ExecutionContext::ExecutionContext (Target* t, bool fill_current_process_thread_frame) :
target (t),
process (NULL),
thread (NULL),
frame (NULL)
{
if (t && fill_current_process_thread_frame)
{
process = t->GetProcessSP().get();
if (process)
{
thread = process->GetThreadList().GetCurrentThread().get();
if (thread)
frame = thread->GetCurrentFrame().get();
}
}
}
ExecutionContext::ExecutionContext(Process* p, Thread *t, StackFrame *f) :
target (p ? &p->GetTarget() : NULL),
process (p),
thread (t),
frame (f)
{
}
ExecutionContext::ExecutionContext (ExecutionContextScope *exe_scope_ptr)
{
if (exe_scope_ptr)
exe_scope_ptr->Calculate (*this);
else
{
target = NULL;
process = NULL;
thread = NULL;
frame = NULL;
}
}
ExecutionContext::ExecutionContext (ExecutionContextScope &exe_scope_ref)
{
exe_scope_ref.Calculate (*this);
}
void
ExecutionContext::Clear()
{
target = NULL;
process = NULL;
thread = NULL;
frame = NULL;
}
RegisterContext *
ExecutionContext::GetRegisterContext () const
{
if (frame)
return frame->GetRegisterContext();
else if (thread)
return thread->GetRegisterContext();
return NULL;
}
ExecutionContextScope *
ExecutionContext::GetBestExecutionContextScope () const
{
if (frame)
return frame;
if (thread)
return thread;
if (process)
return process;
return target;
}
|