LLDB mainline
ABISysV_loongarch.cpp
Go to the documentation of this file.
1//===-- ABISysV_loongarch.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
9#include "ABISysV_loongarch.h"
10
11#include <array>
12#include <limits>
13#include <sstream>
14
15#include "llvm/IR/DerivedTypes.h"
16#include "llvm/Support/MathExtras.h"
17
20#include "lldb/Core/Value.h"
23#include "lldb/Target/Thread.h"
27
28#define DEFINE_REG_NAME(reg_num) ConstString(#reg_num).GetCString()
29#define DEFINE_REG_NAME_STR(reg_name) ConstString(reg_name).GetCString()
30
31// The ABI is not a source of such information as size, offset, encoding, etc.
32// of a register. Just provides correct dwarf and eh_frame numbers.
33
34#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, generic_num) \
35 { \
36 DEFINE_REG_NAME(dwarf_num), \
37 DEFINE_REG_NAME_STR(nullptr), \
38 0, \
39 0, \
40 eEncodingInvalid, \
41 eFormatDefault, \
42 {dwarf_num, dwarf_num, generic_num, LLDB_INVALID_REGNUM, dwarf_num}, \
43 nullptr, \
44 nullptr, \
45 nullptr, \
46 }
47
48#define DEFINE_REGISTER_STUB(dwarf_num) \
49 DEFINE_GENERIC_REGISTER_STUB(dwarf_num, LLDB_INVALID_REGNUM)
50
51using namespace lldb;
52using namespace lldb_private;
53
55
56namespace {
57namespace dwarf {
58enum regnums {
59 r0,
60 r1,
61 ra = r1,
62 r2,
63 r3,
64 sp = r3,
65 r4,
66 r5,
67 r6,
68 r7,
69 r8,
70 r9,
71 r10,
72 r11,
73 r12,
74 r13,
75 r14,
76 r15,
77 r16,
78 r17,
79 r18,
80 r19,
81 r20,
82 r21,
83 r22,
84 fp = r22,
85 r23,
86 r24,
87 r25,
88 r26,
89 r27,
90 r28,
91 r29,
92 r30,
93 r31,
94 pc
95};
96
97static const std::array<RegisterInfo, 33> g_register_infos = {
131} // namespace dwarf
132} // namespace
133
134// Number of argument registers (the base integer calling convention
135// provides 8 argument registers, a0-a7)
136static constexpr size_t g_regs_for_args_count = 8U;
137
139 count = dwarf::g_register_infos.size();
140 return dwarf::g_register_infos.data();
141}
142
143//------------------------------------------------------------------
144// Static Functions
145//------------------------------------------------------------------
146
147ABISP
149 llvm::Triple::ArchType machine = arch.GetTriple().getArch();
150
151 if (llvm::Triple::loongarch32 != machine &&
152 llvm::Triple::loongarch64 != machine)
153 return ABISP();
154
155 ABISysV_loongarch *abi =
156 new ABISysV_loongarch(std::move(process_sp), MakeMCRegisterInfo(arch));
157 if (abi)
158 abi->SetIsLA64(llvm::Triple::loongarch64 == machine);
159 return ABISP(abi);
160}
161
162static bool UpdateRegister(RegisterContext *reg_ctx,
163 const lldb::RegisterKind reg_kind,
164 const uint32_t reg_num, const addr_t value) {
165 Log *log = GetLog(LLDBLog::Expressions);
166
167 const RegisterInfo *reg_info = reg_ctx->GetRegisterInfo(reg_kind, reg_num);
168
169 LLDB_LOG(log, "Writing {0}: 0x{1:x}", reg_info->name,
170 static_cast<uint64_t>(value));
171 if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, value)) {
172 LLDB_LOG(log, "Writing {0}: failed", reg_info->name);
173 return false;
174 }
175 return true;
176}
177
178static void LogInitInfo(Log &log, const Thread &thread, addr_t sp,
179 addr_t func_addr, addr_t return_addr,
180 const llvm::ArrayRef<addr_t> args) {
181 std::stringstream ss;
182 ss << "ABISysV_loongarch::PrepareTrivialCall"
183 << " (tid = 0x" << std::hex << thread.GetID() << ", sp = 0x" << sp
184 << ", func_addr = 0x" << func_addr << ", return_addr = 0x" << return_addr;
185
186 for (auto [idx, arg] : enumerate(args))
187 ss << ", arg" << std::dec << idx << " = 0x" << std::hex << arg;
188 ss << ")";
189 log.PutString(ss.str());
190}
191
193 addr_t func_addr, addr_t return_addr,
194 llvm::ArrayRef<addr_t> args) const {
195 Log *log = GetLog(LLDBLog::Expressions);
196 if (log)
197 LogInitInfo(*log, thread, sp, func_addr, return_addr, args);
198
199 const auto reg_ctx_sp = thread.GetRegisterContext();
200 if (!reg_ctx_sp) {
201 LLDB_LOG(log, "Failed to get RegisterContext");
202 return false;
203 }
204
205 if (args.size() > g_regs_for_args_count) {
206 LLDB_LOG(log, "Function has {0} arguments, but only {1} are allowed!",
207 args.size(), g_regs_for_args_count);
208 return false;
209 }
210
211 // Write arguments to registers
212 for (auto [idx, arg] : enumerate(args)) {
213 const RegisterInfo *reg_info = reg_ctx_sp->GetRegisterInfo(
215 LLDB_LOG(log, "About to write arg{0} ({1:x}) into {2}", idx, arg,
216 reg_info->name);
217
218 if (!reg_ctx_sp->WriteRegisterFromUnsigned(reg_info, arg)) {
219 LLDB_LOG(log, "Failed to write arg{0} ({1:x}) into {2}", idx, arg,
220 reg_info->name);
221 return false;
222 }
223 }
224
225 if (!UpdateRegister(reg_ctx_sp.get(), eRegisterKindGeneric,
226 LLDB_REGNUM_GENERIC_PC, func_addr))
227 return false;
228 if (!UpdateRegister(reg_ctx_sp.get(), eRegisterKindGeneric,
230 return false;
231 if (!UpdateRegister(reg_ctx_sp.get(), eRegisterKindGeneric,
232 LLDB_REGNUM_GENERIC_RA, return_addr))
233 return false;
234
235 LLDB_LOG(log, "ABISysV_loongarch::{0}() success", __FUNCTION__);
236 return true;
237}
238
240 ValueList &values) const {
241 // TODO: Implement
242 return false;
243}
244
246 ValueObjectSP &new_value_sp) {
247 Status result;
248 if (!new_value_sp) {
249 result = Status::FromErrorString("Empty value object for return value.");
250 return result;
251 }
252
253 CompilerType compiler_type = new_value_sp->GetCompilerType();
254 if (!compiler_type) {
255 result = Status::FromErrorString("Null clang type for return value.");
256 return result;
257 }
258
259 auto &reg_ctx = *frame_sp->GetThread()->GetRegisterContext();
260
261 bool is_signed = false;
262 if (!compiler_type.IsIntegerOrEnumerationType(is_signed) &&
263 !compiler_type.IsPointerType()) {
265 "We don't support returning other types at present");
266 return result;
267 }
268
269 DataExtractor data;
270 size_t num_bytes = new_value_sp->GetData(data, result);
271
272 if (result.Fail()) {
274 "Couldn't convert return value to raw data: %s", result.AsCString());
275 return result;
276 }
277
278 size_t reg_size = m_is_la64 ? 8 : 4;
279 // Currently, we only support sizeof(data) <= 2 * reg_size.
280 // 1. If the (`size` <= reg_size), the `data` will be returned through `ARG1`.
281 // 2. If the (`size` > reg_size && `size` <= 2 * reg_size), the `data` will be
282 // returned through a pair of registers (ARG1 and ARG2), and the lower-ordered
283 // bits in the `ARG1`.
284 if (num_bytes > 2 * reg_size) {
286 "We don't support returning large integer values at present.");
287 return result;
288 }
289
290 offset_t offset = 0;
291 uint64_t raw_value = data.GetMaxU64(&offset, num_bytes);
292 // According to psABI, i32 (no matter signed or unsigned) should be
293 // sign-extended in register.
294 if (4 == num_bytes && m_is_la64)
295 raw_value = llvm::SignExtend64<32>(raw_value);
296 auto reg_info =
297 reg_ctx.GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1);
298 if (!reg_ctx.WriteRegisterFromUnsigned(reg_info, raw_value)) {
300 "Couldn't write value to register %s", reg_info->name);
301 return result;
302 }
303
304 if (num_bytes <= reg_size)
305 return result; // Successfully written.
306
307 // For loongarch32, get the upper 32 bits from raw_value and write them.
308 // For loongarch64, get the next 64 bits from data and write them.
309 if (4 == reg_size)
310 raw_value >>= 32;
311 else
312 raw_value = data.GetMaxU64(&offset, num_bytes - reg_size);
313
314 reg_info =
315 reg_ctx.GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG2);
316 if (!reg_ctx.WriteRegisterFromUnsigned(reg_info, raw_value))
318 "Couldn't write value to register %s", reg_info->name);
319
320 return result;
321}
322
323template <typename T>
324static void SetInteger(Scalar &scalar, uint64_t raw_value, bool is_signed) {
325 static_assert(std::is_unsigned<T>::value, "T must be an unsigned type.");
326 raw_value &= std::numeric_limits<T>::max();
327 if (is_signed)
328 scalar = static_cast<typename std::make_signed<T>::type>(raw_value);
329 else
330 scalar = static_cast<T>(raw_value);
331}
332
333static bool SetSizedInteger(Scalar &scalar, uint64_t raw_value,
334 uint8_t size_in_bytes, bool is_signed) {
335 switch (size_in_bytes) {
336 default:
337 return false;
338
339 case sizeof(uint64_t):
340 SetInteger<uint64_t>(scalar, raw_value, is_signed);
341 break;
342
343 case sizeof(uint32_t):
344 SetInteger<uint32_t>(scalar, raw_value, is_signed);
345 break;
346
347 case sizeof(uint16_t):
348 SetInteger<uint16_t>(scalar, raw_value, is_signed);
349 break;
350
351 case sizeof(uint8_t):
352 SetInteger<uint8_t>(scalar, raw_value, is_signed);
353 break;
354 }
355
356 return true;
357}
358
359static bool SetSizedFloat(Scalar &scalar, uint64_t raw_value,
360 uint8_t size_in_bytes) {
361 switch (size_in_bytes) {
362 default:
363 return false;
364
365 case sizeof(uint64_t):
366 scalar = *reinterpret_cast<double *>(&raw_value);
367 break;
368
369 case sizeof(uint32_t):
370 scalar = *reinterpret_cast<float *>(&raw_value);
371 break;
372 }
373
374 return true;
375}
376
378 const RegisterContextSP &reg_ctx,
379 llvm::Triple::ArchType machine,
380 uint32_t type_flags,
381 uint32_t byte_size) {
382 Value value;
383 ValueObjectSP return_valobj_sp;
384 auto *reg_info_a0 =
386 auto *reg_info_a1 =
387 reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG2);
388 uint64_t raw_value = 0;
389
390 switch (byte_size) {
391 case sizeof(uint32_t):
392 // Read a0 to get the arg
393 raw_value = reg_ctx->ReadRegisterAsUnsigned(reg_info_a0, 0) & UINT32_MAX;
394 break;
395 case sizeof(uint64_t):
396 // Read a0 to get the arg on loongarch64, a0 and a1 on loongarch32
397 if (llvm::Triple::loongarch32 == machine) {
398 raw_value = reg_ctx->ReadRegisterAsUnsigned(reg_info_a0, 0) & UINT32_MAX;
399 raw_value |=
400 (reg_ctx->ReadRegisterAsUnsigned(reg_info_a1, 0) & UINT32_MAX) << 32U;
401 } else {
402 raw_value = reg_ctx->ReadRegisterAsUnsigned(reg_info_a0, 0);
403 }
404 break;
405 case 16: {
406 // Read a0 and a1 to get the arg on loongarch64, not supported on
407 // loongarch32
408 if (llvm::Triple::loongarch32 == machine)
409 return return_valobj_sp;
410
411 // Create the ValueObjectSP here and return
412 std::unique_ptr<DataBufferHeap> heap_data_up(
413 new DataBufferHeap(byte_size, 0));
414 const ByteOrder byte_order = thread.GetProcess()->GetByteOrder();
415 RegisterValue reg_value_a0, reg_value_a1;
416 if (reg_ctx->ReadRegister(reg_info_a0, reg_value_a0) &&
417 reg_ctx->ReadRegister(reg_info_a1, reg_value_a1)) {
419 if (reg_value_a0.GetAsMemoryData(*reg_info_a0,
420 heap_data_up->GetBytes() + 0, 8,
421 byte_order, error) &&
422 reg_value_a1.GetAsMemoryData(*reg_info_a1,
423 heap_data_up->GetBytes() + 8, 8,
424 byte_order, error)) {
425 value.SetBytes(heap_data_up.release(), byte_size);
427 thread.GetStackFrameAtIndex(0).get(), value, ConstString(""));
428 }
429 }
430 break;
431 }
432 default:
433 return return_valobj_sp;
434 }
435
436 if (type_flags & eTypeIsInteger) {
437 if (!SetSizedInteger(value.GetScalar(), raw_value, byte_size,
438 type_flags & eTypeIsSigned))
439 return return_valobj_sp;
440 } else if (type_flags & eTypeIsFloat) {
441 if (!SetSizedFloat(value.GetScalar(), raw_value, byte_size))
442 return return_valobj_sp;
443 } else
444 return return_valobj_sp;
445
446 value.SetValueType(Value::ValueType::Scalar);
447 return_valobj_sp = ValueObjectConstResult::Create(
448 thread.GetStackFrameAtIndex(0).get(), value, ConstString(""));
449 return return_valobj_sp;
450}
451
453 const RegisterContextSP &reg_ctx,
454 llvm::Triple::ArchType machine,
455 uint32_t type_flags,
456 uint32_t byte_size) {
457 auto *reg_info_fa0 = reg_ctx->GetRegisterInfoByName("f0");
458 bool use_fp_regs = false;
459 ValueObjectSP return_valobj_sp;
460
461 if (byte_size <= 8)
462 use_fp_regs = true;
463
464 if (use_fp_regs) {
465 uint64_t raw_value;
466 Value value;
467 raw_value = reg_ctx->ReadRegisterAsUnsigned(reg_info_fa0, 0);
468 if (!SetSizedFloat(value.GetScalar(), raw_value, byte_size))
469 return return_valobj_sp;
470 value.SetValueType(Value::ValueType::Scalar);
472 value, ConstString(""));
473 }
474 // we should never reach this, but if we do, use the integer registers
475 return GetValObjFromIntRegs(thread, reg_ctx, machine, type_flags, byte_size);
476}
477
479 Thread &thread, CompilerType &compiler_type) const {
480 ValueObjectSP return_valobj_sp;
481
482 if (!compiler_type)
483 return return_valobj_sp;
484
485 auto reg_ctx = thread.GetRegisterContext();
486 if (!reg_ctx)
487 return return_valobj_sp;
488
489 Value value;
490 value.SetCompilerType(compiler_type);
491
492 const uint32_t type_flags = compiler_type.GetTypeInfo();
493 const size_t byte_size = compiler_type.GetByteSize(&thread).value_or(0);
494 const ArchSpec arch = thread.GetProcess()->GetTarget().GetArchitecture();
495 const llvm::Triple::ArchType machine = arch.GetMachine();
496
497 if (type_flags & eTypeIsInteger) {
498 return_valobj_sp =
499 GetValObjFromIntRegs(thread, reg_ctx, machine, type_flags, byte_size);
500 return return_valobj_sp;
501 }
502 if (type_flags & eTypeIsPointer) {
503 const auto *reg_info_a0 = reg_ctx->GetRegisterInfo(
505 value.GetScalar() = reg_ctx->ReadRegisterAsUnsigned(reg_info_a0, 0);
506 value.SetValueType(Value::ValueType::Scalar);
508 value, ConstString(""));
509 }
510 if (type_flags & eTypeIsFloat) {
511 uint32_t float_count = 0;
512 bool is_complex = false;
513
514 if (compiler_type.IsFloatingPointType(float_count, is_complex) &&
515 float_count == 1 && !is_complex) {
516 return_valobj_sp =
517 GetValObjFromFPRegs(thread, reg_ctx, machine, type_flags, byte_size);
518 return return_valobj_sp;
519 }
520 }
521 return return_valobj_sp;
522}
523
525 Thread &thread, CompilerType &return_compiler_type) const {
526 ValueObjectSP return_valobj_sp;
527
528 if (!return_compiler_type)
529 return return_valobj_sp;
530
531 ExecutionContext exe_ctx(thread.shared_from_this());
532 return GetReturnValueObjectSimple(thread, return_compiler_type);
533}
534
536 unwind_plan.Clear();
538
539 uint32_t pc_reg_num = loongarch_dwarf::dwarf_gpr_pc;
540 uint32_t sp_reg_num = loongarch_dwarf::dwarf_gpr_sp;
541 uint32_t ra_reg_num = loongarch_dwarf::dwarf_gpr_ra;
542
544
545 // Define CFA as the stack pointer
546 row->GetCFAValue().SetIsRegisterPlusOffset(sp_reg_num, 0);
547
548 // Previous frame's pc is in ra
549
550 row->SetRegisterLocationToRegister(pc_reg_num, ra_reg_num, true);
551 unwind_plan.AppendRow(row);
552 unwind_plan.SetSourceName("loongarch function-entry unwind plan");
554
555 return true;
556}
557
559 unwind_plan.Clear();
561
562 uint32_t pc_reg_num = LLDB_REGNUM_GENERIC_PC;
563 uint32_t fp_reg_num = LLDB_REGNUM_GENERIC_FP;
564
566
567 // Define the CFA as the current frame pointer value.
568 row->GetCFAValue().SetIsRegisterPlusOffset(fp_reg_num, 0);
569 row->SetOffset(0);
570
571 int reg_size = 4;
572 if (m_is_la64)
573 reg_size = 8;
574
575 // Assume the ra reg (return pc) and caller's frame pointer
576 // have been spilled to stack already.
577 row->SetRegisterLocationToAtCFAPlusOffset(fp_reg_num, reg_size * -2, true);
578 row->SetRegisterLocationToAtCFAPlusOffset(pc_reg_num, reg_size * -1, true);
579
580 unwind_plan.AppendRow(row);
581 unwind_plan.SetSourceName("loongarch default unwind plan");
584 return true;
585}
586
588 return !RegisterIsCalleeSaved(reg_info);
589}
590
592 if (!reg_info)
593 return false;
594
595 const char *name = reg_info->name;
596 ArchSpec arch = GetProcessSP()->GetTarget().GetArchitecture();
597 uint32_t arch_flags = arch.GetFlags();
598 // Floating point registers are only callee saved when using
599 // F or D hardware floating point ABIs.
600 bool is_hw_fp = (arch_flags & ArchSpec::eLoongArch_abi_mask) != 0;
601
602 return llvm::StringSwitch<bool>(name)
603 // integer ABI names
604 .Cases("ra", "sp", "fp", true)
605 .Cases("s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "s9", true)
606 // integer hardware names
607 .Cases("r1", "r3", "r22", true)
608 .Cases("r23", "r24", "r25", "r26", "r27", "r28", "r29", "r30", "31", true)
609 // floating point ABI names
610 .Cases("fs0", "fs1", "fs2", "fs3", "fs4", "fs5", "fs6", "fs7", is_hw_fp)
611 // floating point hardware names
612 .Cases("f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", is_hw_fp)
613 .Default(false);
614}
615
618 "System V ABI for LoongArch targets",
620}
621
624}
625
626static uint32_t GetGenericNum(llvm::StringRef name) {
627 return llvm::StringSwitch<uint32_t>(name)
628 .Case("pc", LLDB_REGNUM_GENERIC_PC)
629 .Cases("ra", "r1", LLDB_REGNUM_GENERIC_RA)
630 .Cases("sp", "r3", LLDB_REGNUM_GENERIC_SP)
631 .Cases("fp", "r22", LLDB_REGNUM_GENERIC_FP)
632 .Cases("a0", "r4", LLDB_REGNUM_GENERIC_ARG1)
633 .Cases("a1", "r5", LLDB_REGNUM_GENERIC_ARG2)
634 .Cases("a2", "r6", LLDB_REGNUM_GENERIC_ARG3)
635 .Cases("a3", "r7", LLDB_REGNUM_GENERIC_ARG4)
636 .Cases("a4", "r8", LLDB_REGNUM_GENERIC_ARG5)
637 .Cases("a5", "r9", LLDB_REGNUM_GENERIC_ARG6)
638 .Cases("a6", "r10", LLDB_REGNUM_GENERIC_ARG7)
639 .Cases("a7", "r11", LLDB_REGNUM_GENERIC_ARG8)
640 .Default(LLDB_INVALID_REGNUM);
641}
642
644 std::vector<lldb_private::DynamicRegisterInfo::Register> &regs) {
646
647 for (auto it : llvm::enumerate(regs)) {
648 // Set alt name for certain registers for convenience
649 if (it.value().name == "r0")
650 it.value().alt_name.SetCString("zero");
651 else if (it.value().name == "r1")
652 it.value().alt_name.SetCString("ra");
653 else if (it.value().name == "r3")
654 it.value().alt_name.SetCString("sp");
655 else if (it.value().name == "r22")
656 it.value().alt_name.SetCString("fp");
657 else if (it.value().name == "r4")
658 it.value().alt_name.SetCString("a0");
659 else if (it.value().name == "r5")
660 it.value().alt_name.SetCString("a1");
661 else if (it.value().name == "r6")
662 it.value().alt_name.SetCString("a2");
663 else if (it.value().name == "r7")
664 it.value().alt_name.SetCString("a3");
665 else if (it.value().name == "r8")
666 it.value().alt_name.SetCString("a4");
667 else if (it.value().name == "r9")
668 it.value().alt_name.SetCString("a5");
669 else if (it.value().name == "r10")
670 it.value().alt_name.SetCString("a6");
671 else if (it.value().name == "r11")
672 it.value().alt_name.SetCString("a7");
673
674 // Set generic regnum so lldb knows what the PC, etc is
675 it.value().regnum_generic = GetGenericNum(it.value().name.GetStringRef());
676 }
677}
static const RegisterInfo g_register_infos[]
#define DEFINE_REGISTER_STUB(dwarf_num, str_name)
Definition: ABISysV_arc.cpp:52
#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, generic_num)
Definition: ABISysV_arc.cpp:44
static const size_t reg_size
static ValueObjectSP GetValObjFromIntRegs(Thread &thread, const RegisterContextSP &reg_ctx, llvm::Triple::ArchType machine, uint32_t type_flags, uint32_t byte_size)
static bool UpdateRegister(RegisterContext *reg_ctx, const lldb::RegisterKind reg_kind, const uint32_t reg_num, const addr_t value)
static void LogInitInfo(Log &log, const Thread &thread, addr_t sp, addr_t func_addr, addr_t return_addr, const llvm::ArrayRef< addr_t > args)
static void SetInteger(Scalar &scalar, uint64_t raw_value, bool is_signed)
static ValueObjectSP GetValObjFromFPRegs(Thread &thread, const RegisterContextSP &reg_ctx, llvm::Triple::ArchType machine, uint32_t type_flags, uint32_t byte_size)
static uint32_t GetGenericNum(llvm::StringRef name)
static bool SetSizedInteger(Scalar &scalar, uint64_t raw_value, uint8_t size_in_bytes, bool is_signed)
static constexpr size_t g_regs_for_args_count
static bool SetSizedFloat(Scalar &scalar, uint64_t raw_value, uint8_t size_in_bytes)
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition: Log.h:369
#define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName)
Definition: PluginManager.h:26
bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info)
bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp, lldb::addr_t functionAddress, lldb::addr_t returnAddress, llvm::ArrayRef< lldb::addr_t > args) const override
const lldb_private::RegisterInfo * GetRegisterInfoArray(uint32_t &count) override
lldb::ValueObjectSP GetReturnValueObjectSimple(lldb_private::Thread &thread, lldb_private::CompilerType &ast_type) const
void AugmentRegisterInfo(std::vector< lldb_private::DynamicRegisterInfo::Register > &regs) override
static void Initialize()
void SetIsLA64(bool is_la64)
bool CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override
static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch)
bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override
lldb_private::Status SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override
bool GetArgumentValues(lldb_private::Thread &thread, lldb_private::ValueList &values) const override
lldb::ValueObjectSP GetReturnValueObjectImpl(lldb_private::Thread &thread, lldb_private::CompilerType &type) const override
bool CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override
static llvm::StringRef GetPluginNameStatic()
static std::unique_ptr< llvm::MCRegisterInfo > MakeMCRegisterInfo(const ArchSpec &arch)
Utility function to construct a MCRegisterInfo using the ArchSpec triple.
Definition: ABI.cpp:234
lldb::ProcessSP GetProcessSP() const
Request to get a Process shared pointer.
Definition: ABI.h:96
An architecture specification class.
Definition: ArchSpec.h:31
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:461
@ eLoongArch_abi_mask
double precision floating point, +d
Definition: ArchSpec.h:116
uint32_t GetFlags() const
Definition: ArchSpec.h:532
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
Definition: ArchSpec.cpp:701
Generic representation of a type in a programming language.
Definition: CompilerType.h:36
std::optional< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
bool IsFloatingPointType(uint32_t &count, bool &is_complex) const
bool IsIntegerOrEnumerationType(bool &is_signed) const
uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_type=nullptr) const
bool IsPointerType(CompilerType *pointee_type=nullptr) const
A uniqued constant string class.
Definition: ConstString.h:40
A subclass of DataBuffer that stores a data buffer on the heap.
An data extractor class.
Definition: DataExtractor.h:48
const void * GetData(lldb::offset_t *offset_ptr, lldb::offset_t length) const
Extract length bytes from *offset_ptr.
uint64_t GetMaxU64(lldb::offset_t *offset_ptr, size_t byte_size) const
Extract an unsigned integer of size byte_size from *offset_ptr.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void PutString(llvm::StringRef str)
Definition: Log.cpp:147
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
void AugmentRegisterInfo(std::vector< DynamicRegisterInfo::Register > &regs) override
Definition: ABI.cpp:251
const RegisterInfo * GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num)
bool WriteRegisterFromUnsigned(uint32_t reg, uint64_t uval)
uint32_t GetAsMemoryData(const RegisterInfo &reg_info, void *dst, uint32_t dst_len, lldb::ByteOrder dst_byte_order, Status &error) const
An error handling class.
Definition: Status.h:115
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Definition: Status.cpp:106
static Status FromErrorString(const char *str)
Definition: Status.h:138
bool Fail() const
Test for error condition.
Definition: Status.cpp:270
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
Definition: Status.cpp:195
virtual lldb::StackFrameSP GetStackFrameAtIndex(uint32_t idx)
Definition: Thread.h:408
virtual lldb::RegisterContextSP GetRegisterContext()=0
lldb::ProcessSP GetProcess() const
Definition: Thread.h:157
void SetRegisterKind(lldb::RegisterKind kind)
Definition: UnwindPlan.h:471
void AppendRow(const RowSP &row_sp)
Definition: UnwindPlan.cpp:392
std::shared_ptr< Row > RowSP
Definition: UnwindPlan.h:429
void SetSourcedFromCompiler(lldb_private::LazyBool from_compiler)
Definition: UnwindPlan.h:512
void SetSourceName(const char *)
Definition: UnwindPlan.cpp:594
void SetUnwindPlanValidAtAllInstructions(lldb_private::LazyBool valid_at_all_insn)
Definition: UnwindPlan.h:524
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS)
const Scalar & GetScalar() const
Definition: Value.h:112
RegisterInfo * GetRegisterInfo() const
Definition: Value.cpp:140
void SetCompilerType(const CompilerType &compiler_type)
Definition: Value.cpp:268
void SetValueType(ValueType value_type)
Definition: Value.h:89
void SetBytes(const void *bytes, int len)
Definition: Value.cpp:88
#define LLDB_REGNUM_GENERIC_RA
Definition: lldb-defines.h:59
#define LLDB_REGNUM_GENERIC_ARG8
Definition: lldb-defines.h:75
#define LLDB_REGNUM_GENERIC_ARG6
Definition: lldb-defines.h:71
#define LLDB_REGNUM_GENERIC_SP
Definition: lldb-defines.h:57
#define LLDB_REGNUM_GENERIC_ARG4
Definition: lldb-defines.h:67
#define LLDB_REGNUM_GENERIC_ARG3
Definition: lldb-defines.h:65
#define LLDB_REGNUM_GENERIC_ARG1
Definition: lldb-defines.h:61
#define LLDB_REGNUM_GENERIC_ARG7
Definition: lldb-defines.h:73
#define UINT32_MAX
Definition: lldb-defines.h:19
#define LLDB_INVALID_REGNUM
Definition: lldb-defines.h:87
#define LLDB_REGNUM_GENERIC_ARG2
Definition: lldb-defines.h:63
#define LLDB_REGNUM_GENERIC_PC
Definition: lldb-defines.h:56
#define LLDB_REGNUM_GENERIC_FP
Definition: lldb-defines.h:58
#define LLDB_REGNUM_GENERIC_ARG5
Definition: lldb-defines.h:69
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:332
Definition: SBAddress.h:15
std::shared_ptr< lldb_private::ABI > ABISP
Definition: lldb-forward.h:317
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
Definition: lldb-forward.h:424
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Definition: lldb-forward.h:484
uint64_t offset_t
Definition: lldb-types.h:85
std::shared_ptr< lldb_private::Process > ProcessSP
Definition: lldb-forward.h:389
ByteOrder
Byte ordering definitions.
uint64_t addr_t
Definition: lldb-types.h:80
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
Definition: lldb-forward.h:394
RegisterKind
Register numbering types.
@ eRegisterKindGeneric
insn ptr reg, stack ptr reg, etc not specific to any particular target
@ eRegisterKindDWARF
the register numbers seen DWARF
Every register is described in detail including its name, alternate name (optional),...
llvm::ArrayRef< uint8_t > data(const uint8_t *context_base) const
const char * name
Name of this register, can't be NULL.
lldb::user_id_t GetID() const
Get accessor for the user ID.
Definition: UserID.h:47