[Lldb-commits] [PATCH] D152594: [lldb] Introduce DynamicRegisterInfo::CreateFromDict
Alex Langford via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 15 10:55:25 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG35b0b244401a: [lldb] Introduce DynamicRegisterInfo::CreateFromDict (authored by bulbazord).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152594/new/
https://reviews.llvm.org/D152594
Files:
lldb/include/lldb/Target/DynamicRegisterInfo.h
lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
lldb/source/Target/DynamicRegisterInfo.cpp
Index: lldb/source/Target/DynamicRegisterInfo.cpp
===================================================================
--- lldb/source/Target/DynamicRegisterInfo.cpp
+++ lldb/source/Target/DynamicRegisterInfo.cpp
@@ -20,10 +20,17 @@
using namespace lldb;
using namespace lldb_private;
-DynamicRegisterInfo::DynamicRegisterInfo(
- const lldb_private::StructuredData::Dictionary &dict,
- const lldb_private::ArchSpec &arch) {
- SetRegisterInfo(dict, arch);
+std::unique_ptr<DynamicRegisterInfo>
+DynamicRegisterInfo::Create(const StructuredData::Dictionary &dict,
+ const ArchSpec &arch) {
+ auto dyn_reg_info = std::make_unique<DynamicRegisterInfo>();
+ if (!dyn_reg_info)
+ return nullptr;
+
+ if (dyn_reg_info->SetRegisterInfo(dict, arch) == 0)
+ return nullptr;
+
+ return dyn_reg_info;
}
DynamicRegisterInfo::DynamicRegisterInfo(DynamicRegisterInfo &&info) {
Index: lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
===================================================================
--- lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
+++ lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
@@ -341,7 +341,7 @@
LLVM_PRETTY_FUNCTION, "Failed to get scripted thread registers info.",
error, LLDBLog::Thread);
- m_register_info_sp = std::make_shared<DynamicRegisterInfo>(
+ m_register_info_sp = DynamicRegisterInfo::Create(
*reg_info, m_scripted_process.GetTarget().GetArchitecture());
}
Index: lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
===================================================================
--- lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
@@ -128,8 +128,9 @@
if (!dictionary)
return nullptr;
- m_register_info_up = std::make_unique<DynamicRegisterInfo>(
+ m_register_info_up = DynamicRegisterInfo::Create(
*dictionary, m_process->GetTarget().GetArchitecture());
+ assert(m_register_info_up);
assert(m_register_info_up->GetNumRegisters() > 0);
assert(m_register_info_up->GetNumRegisterSets() > 0);
}
Index: lldb/include/lldb/Target/DynamicRegisterInfo.h
===================================================================
--- lldb/include/lldb/Target/DynamicRegisterInfo.h
+++ lldb/include/lldb/Target/DynamicRegisterInfo.h
@@ -46,8 +46,8 @@
DynamicRegisterInfo() = default;
- DynamicRegisterInfo(const lldb_private::StructuredData::Dictionary &dict,
- const lldb_private::ArchSpec &arch);
+ static std::unique_ptr<DynamicRegisterInfo>
+ Create(const StructuredData::Dictionary &dict, const ArchSpec &arch);
virtual ~DynamicRegisterInfo() = default;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152594.531832.patch
Type: text/x-patch
Size: 2785 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230615/d5a09f5b/attachment-0001.bin>
More information about the lldb-commits
mailing list