[llvm-branch-commits] [lldb] [lldb][LoongArch] Function calls support in lldb expressions (PR #114742)

Lu Weining via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Nov 5 19:47:10 PST 2024


================
@@ -0,0 +1,672 @@
+//===-- ABISysV_loongarch.cpp----------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "ABISysV_loongarch.h"
+
+#include <array>
+#include <limits>
+#include <sstream>
+
+#include "llvm/IR/DerivedTypes.h"
+
+#include "Utility/LoongArch_DWARF_Registers.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/ValueObject/ValueObjectConstResult.h"
+
+#define DEFINE_REG_NAME(reg_num) ConstString(#reg_num).GetCString()
+#define DEFINE_REG_NAME_STR(reg_name) ConstString(reg_name).GetCString()
+
+// The ABI is not a source of such information as size, offset, encoding, etc.
+// of a register. Just provides correct dwarf and eh_frame numbers.
+
+#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, generic_num)                   \
+  {                                                                            \
+      DEFINE_REG_NAME(dwarf_num),                                              \
+      DEFINE_REG_NAME_STR(nullptr),                                            \
+      0,                                                                       \
+      0,                                                                       \
+      eEncodingInvalid,                                                        \
+      eFormatDefault,                                                          \
+      {dwarf_num, dwarf_num, generic_num, LLDB_INVALID_REGNUM, dwarf_num},     \
+      nullptr,                                                                 \
+      nullptr,                                                                 \
+      nullptr,                                                                 \
+  }
+
+#define DEFINE_REGISTER_STUB(dwarf_num)                                        \
+  DEFINE_GENERIC_REGISTER_STUB(dwarf_num, LLDB_INVALID_REGNUM)
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_loongarch, ABILoongArch)
+
+namespace {
+namespace dwarf {
+enum regnums {
+  r0,
+  ra,
+  r1 = ra,
----------------
SixWeining wrote:

```suggestion
  r1,
  ra = r1,
```

https://github.com/llvm/llvm-project/pull/114742


More information about the llvm-branch-commits mailing list