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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
//===-- ArchDefaultUnwindPlan-x86.cpp --------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "ArchDefaultUnwindPlan-x86.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Utility/ArchDefaultUnwindPlan.h"
using namespace lldb;
using namespace lldb_private;
lldb_private::ArchDefaultUnwindPlan *
ArchDefaultUnwindPlan_x86_64::CreateInstance (const lldb_private::ArchSpec &arch)
{
if (arch.GetMachine () == llvm::Triple::x86_64)
return new ArchDefaultUnwindPlan_x86_64 ();
return NULL;
}
ArchDefaultUnwindPlan_x86_64::ArchDefaultUnwindPlan_x86_64() :
lldb_private::ArchDefaultUnwindPlan(),
m_unwind_plan_sp (new UnwindPlan)
{
UnwindPlan::Row row;
UnwindPlan::Row::RegisterLocation regloc;
m_unwind_plan_sp->SetRegisterKind (eRegisterKindGeneric);
row.SetCFARegister (LLDB_REGNUM_GENERIC_FP);
row.SetCFAOffset (2 * 8);
row.SetOffset (0);
regloc.SetAtCFAPlusOffset (2 * -8);
row.SetRegisterInfo (LLDB_REGNUM_GENERIC_FP, regloc);
regloc.SetAtCFAPlusOffset (1 * -8);
row.SetRegisterInfo (LLDB_REGNUM_GENERIC_PC, regloc);
regloc.SetIsCFAPlusOffset (0);
row.SetRegisterInfo (LLDB_REGNUM_GENERIC_SP, regloc);
m_unwind_plan_sp->AppendRow (row);
m_unwind_plan_sp->SetSourceName ("x86_64 architectural default");
}
//------------------------------------------------------------------
// PluginInterface protocol in UnwindAssemblyParser_x86
//------------------------------------------------------------------
const char *
ArchDefaultUnwindPlan_x86_64::GetPluginName()
{
return "ArchDefaultUnwindPlan_x86_64";
}
const char *
ArchDefaultUnwindPlan_x86_64::GetShortPluginName()
{
return "lldb.arch-default-unwind-plan.x86-64";
}
uint32_t
ArchDefaultUnwindPlan_x86_64::GetPluginVersion()
{
return 1;
}
void
ArchDefaultUnwindPlan_x86_64::Initialize()
{
PluginManager::RegisterPlugin (GetPluginNameStatic(),
GetPluginDescriptionStatic(),
CreateInstance);
}
void
ArchDefaultUnwindPlan_x86_64::Terminate()
{
PluginManager::UnregisterPlugin (CreateInstance);
}
const char *
ArchDefaultUnwindPlan_x86_64::GetPluginNameStatic()
{
return "ArchDefaultUnwindPlan_x86_64";
}
const char *
ArchDefaultUnwindPlan_x86_64::GetPluginDescriptionStatic()
{
return "x86_64 architecture default unwind plan assembly plugin.";
}
UnwindPlanSP
ArchDefaultUnwindPlan_x86_64::GetArchDefaultUnwindPlan (Thread& thread, Address current_pc)
{
return m_unwind_plan_sp;
}
lldb_private::ArchDefaultUnwindPlan *
ArchDefaultUnwindPlan_i386::CreateInstance (const lldb_private::ArchSpec &arch)
{
if (arch.GetMachine () == llvm::Triple::x86)
return new ArchDefaultUnwindPlan_i386 ();
return NULL;
}
ArchDefaultUnwindPlan_i386::ArchDefaultUnwindPlan_i386() :
lldb_private::ArchDefaultUnwindPlan(),
m_unwind_plan_sp (new UnwindPlan)
{
UnwindPlan::Row row;
UnwindPlan::Row::RegisterLocation regloc;
m_unwind_plan_sp->SetRegisterKind (eRegisterKindGeneric);
row.SetCFARegister (LLDB_REGNUM_GENERIC_FP);
row.SetCFAOffset (2 * 4);
row.SetOffset (0);
regloc.SetAtCFAPlusOffset (2 * -4);
row.SetRegisterInfo (LLDB_REGNUM_GENERIC_FP, regloc);
regloc.SetAtCFAPlusOffset (1 * -4);
row.SetRegisterInfo (LLDB_REGNUM_GENERIC_PC, regloc);
regloc.SetIsCFAPlusOffset (0);
row.SetRegisterInfo (LLDB_REGNUM_GENERIC_SP, regloc);
m_unwind_plan_sp->AppendRow (row);
m_unwind_plan_sp->SetSourceName ("i386 architectural default");
}
//------------------------------------------------------------------
// PluginInterface protocol in UnwindAssemblyParser_x86
//------------------------------------------------------------------
const char *
ArchDefaultUnwindPlan_i386::GetPluginName()
{
return "ArchDefaultUnwindPlan_i386";
}
const char *
ArchDefaultUnwindPlan_i386::GetShortPluginName()
{
return "archdefaultunwindplan.x86";
}
uint32_t
ArchDefaultUnwindPlan_i386::GetPluginVersion()
{
return 1;
}
void
ArchDefaultUnwindPlan_i386::Initialize()
{
PluginManager::RegisterPlugin (GetPluginNameStatic(),
GetPluginDescriptionStatic(),
CreateInstance);
}
void
ArchDefaultUnwindPlan_i386::Terminate()
{
PluginManager::UnregisterPlugin (CreateInstance);
}
const char *
ArchDefaultUnwindPlan_i386::GetPluginNameStatic()
{
return "ArchDefaultUnwindPlan_i386";
}
const char *
ArchDefaultUnwindPlan_i386::GetPluginDescriptionStatic()
{
return "i386 architecture default unwind plan assembly plugin.";
}
UnwindPlanSP
ArchDefaultUnwindPlan_i386::GetArchDefaultUnwindPlan (Thread& thread, Address current_pc)
{
return m_unwind_plan_sp;
}
|