LLDB mainline
RegisterInfos_x86_64_with_base_shared.cpp
Go to the documentation of this file.
1//===-- RegisterInfos_x86_64_with_base_shared.cpp--------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10
11#include "lldb/lldb-defines.h"
12#include <mutex>
13
14using namespace lldb;
15
16namespace lldb_private {
17
34
55
88
149
154
161
178
195
212
237
238RegInfo &GetRegInfoShared(llvm::Triple::ArchType arch_type, bool with_base) {
239 static std::once_flag once_flag_x86, once_flag_x86_64,
240 once_flag_x86_64_with_base;
241 static RegInfo reg_info_x86, reg_info_x86_64, reg_info_x86_64_with_base, reg_info_invalid;
242
243 switch (arch_type) {
244 case llvm::Triple::x86:
245 std::call_once(once_flag_x86, []() {
246 reg_info_x86.num_registers = k_num_registers_i386;
250 reg_info_x86.last_gpr = k_last_gpr_i386;
251 reg_info_x86.first_fpr = k_first_fpr_i386;
252 reg_info_x86.last_fpr = k_last_fpr_i386;
253 reg_info_x86.first_st = lldb_st0_i386;
254 reg_info_x86.last_st = lldb_st7_i386;
255 reg_info_x86.first_mm = lldb_mm0_i386;
256 reg_info_x86.last_mm = lldb_mm7_i386;
257 reg_info_x86.first_xmm = lldb_xmm0_i386;
258 reg_info_x86.last_xmm = lldb_xmm7_i386;
259 reg_info_x86.first_ymm = lldb_ymm0_i386;
260 reg_info_x86.last_ymm = lldb_ymm7_i386;
261 reg_info_x86.first_dr = lldb_dr0_i386;
262 reg_info_x86.gpr_flags = lldb_eflags_i386;
263 });
264
265 return reg_info_x86;
266 case llvm::Triple::x86_64:
267 if (with_base) {
268 std::call_once(once_flag_x86_64_with_base, []() {
269 reg_info_x86_64_with_base.num_registers =
271 reg_info_x86_64_with_base.num_gpr_registers =
273 reg_info_x86_64_with_base.num_fpr_registers =
275 reg_info_x86_64_with_base.num_avx_registers =
277 reg_info_x86_64_with_base.last_gpr = x86_64_with_base::k_last_gpr;
278 reg_info_x86_64_with_base.first_fpr = x86_64_with_base::k_first_fpr;
279 reg_info_x86_64_with_base.last_fpr = x86_64_with_base::k_last_fpr;
280 reg_info_x86_64_with_base.first_st = x86_64_with_base::lldb_st0;
281 reg_info_x86_64_with_base.last_st = x86_64_with_base::lldb_st7;
282 reg_info_x86_64_with_base.first_mm = x86_64_with_base::lldb_mm0;
283 reg_info_x86_64_with_base.last_mm = x86_64_with_base::lldb_mm7;
284 reg_info_x86_64_with_base.first_xmm = x86_64_with_base::lldb_xmm0;
285 reg_info_x86_64_with_base.last_xmm = x86_64_with_base::lldb_xmm15;
286 reg_info_x86_64_with_base.first_ymm = x86_64_with_base::lldb_ymm0;
287 reg_info_x86_64_with_base.last_ymm = x86_64_with_base::lldb_ymm15;
288 reg_info_x86_64_with_base.first_dr = x86_64_with_base::lldb_dr0;
289 reg_info_x86_64_with_base.gpr_flags = x86_64_with_base::lldb_rflags;
290 });
291
292 return reg_info_x86_64_with_base;
293 } else {
294 std::call_once(once_flag_x86_64, []() {
295 reg_info_x86_64.num_registers = k_num_registers_x86_64;
299 reg_info_x86_64.last_gpr = k_last_gpr_x86_64;
300 reg_info_x86_64.first_fpr = k_first_fpr_x86_64;
301 reg_info_x86_64.last_fpr = k_last_fpr_x86_64;
302 reg_info_x86_64.first_st = lldb_st0_x86_64;
303 reg_info_x86_64.last_st = lldb_st7_x86_64;
304 reg_info_x86_64.first_mm = lldb_mm0_x86_64;
305 reg_info_x86_64.last_mm = lldb_mm7_x86_64;
306 reg_info_x86_64.first_xmm = lldb_xmm0_x86_64;
307 reg_info_x86_64.last_xmm = lldb_xmm15_x86_64;
308 reg_info_x86_64.first_ymm = lldb_ymm0_x86_64;
309 reg_info_x86_64.last_ymm = lldb_ymm15_x86_64;
310 reg_info_x86_64.first_dr = lldb_dr0_x86_64;
311 reg_info_x86_64.gpr_flags = lldb_rflags_x86_64;
312 });
313 return reg_info_x86_64;
314 }
315 default:
316 assert(false && "Unhandled target architecture.");
317 return reg_info_invalid;
318 }
319}
320
321} // namespace lldb_private
#define LLDB_INVALID_REGNUM
Definition: lldb-defines.h:87
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
RegInfo & GetRegInfoShared(llvm::Triple::ArchType arch_type, bool with_base)
Definition: SBAddress.h:15