[Lldb-commits] [PATCH] D88375: Fix MIPS and MIPS64 ABI to use ConstString in thier register info arrays.
Raphael Isemann via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Sun Sep 27 03:37:00 PDT 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe779427757f2: Fix MIPS and MIPS64 ABI to use ConstString in their register info arrays. (authored by tatsuo, committed by teemperor).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88375/new/
https://reviews.llvm.org/D88375
Files:
lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
Index: lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
===================================================================
--- lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
+++ lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
@@ -75,7 +75,7 @@
dwarf_pc
};
-static const RegisterInfo g_register_infos_mips64[] = {
+static RegisterInfo g_register_infos_mips64[] = {
// NAME ALT SZ OFF ENCODING FORMAT EH_FRAME
// DWARF GENERIC PROCESS PLUGIN
// LLDB NATIVE
@@ -542,9 +542,24 @@
static const uint32_t k_num_register_infos =
llvm::array_lengthof(g_register_infos_mips64);
+static bool g_register_info_names_constified = false;
const lldb_private::RegisterInfo *
ABISysV_mips64::GetRegisterInfoArray(uint32_t &count) {
+ // Make the C-string names and alt_names for the register infos into const
+ // C-string values by having the ConstString unique the names in the global
+ // constant C-string pool.
+ if (!g_register_info_names_constified) {
+ g_register_info_names_constified = true;
+ for (uint32_t i = 0; i < k_num_register_infos; ++i) {
+ if (g_register_infos_mips64[i].name)
+ g_register_infos_mips64[i].name =
+ ConstString(g_register_infos_mips64[i].name).GetCString();
+ if (g_register_infos_mips64[i].alt_name)
+ g_register_infos_mips64[i].alt_name =
+ ConstString(g_register_infos_mips64[i].alt_name).GetCString();
+ }
+ }
count = k_num_register_infos;
return g_register_infos_mips64;
}
Index: lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
===================================================================
--- lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
+++ lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
@@ -75,7 +75,7 @@
dwarf_pc
};
-static const RegisterInfo g_register_infos[] = {
+static RegisterInfo g_register_infos[] = {
// NAME ALT SZ OFF ENCODING FORMAT EH_FRAME
// DWARF GENERIC PROCESS PLUGINS
// LLDB NATIVE VALUE REGS INVALIDATE REGS
@@ -542,9 +542,24 @@
static const uint32_t k_num_register_infos =
llvm::array_lengthof(g_register_infos);
+static bool g_register_info_names_constified = false;
const lldb_private::RegisterInfo *
ABISysV_mips::GetRegisterInfoArray(uint32_t &count) {
+ // Make the C-string names and alt_names for the register infos into const
+ // C-string values by having the ConstString unique the names in the global
+ // constant C-string pool.
+ if (!g_register_info_names_constified) {
+ g_register_info_names_constified = true;
+ for (uint32_t i = 0; i < k_num_register_infos; ++i) {
+ if (g_register_infos[i].name)
+ g_register_infos[i].name =
+ ConstString(g_register_infos[i].name).GetCString();
+ if (g_register_infos[i].alt_name)
+ g_register_infos[i].alt_name =
+ ConstString(g_register_infos[i].alt_name).GetCString();
+ }
+ }
count = k_num_register_infos;
return g_register_infos;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88375.294546.patch
Type: text/x-patch
Size: 3084 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200927/34f281da/attachment.bin>
More information about the lldb-commits
mailing list