https://github.com/barsolo2000 updated https://github.com/llvm/llvm-project/pull/150331
>From b79edf938d49d03498ec3a9228344a684d0cbf6e Mon Sep 17 00:00:00 2001 From: Bar Soloveychik <bars...@fb.com> Date: Wed, 23 Jul 2025 15:17:29 -0700 Subject: [PATCH 1/2] [LLDB] added getName method in SBModule --- lldb/include/lldb/API/SBModule.h | 3 +++ lldb/source/API/SBModule.cpp | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/lldb/include/lldb/API/SBModule.h b/lldb/include/lldb/API/SBModule.h index 85332066ee687..ed90c48849699 100644 --- a/lldb/include/lldb/API/SBModule.h +++ b/lldb/include/lldb/API/SBModule.h @@ -296,6 +296,9 @@ class LLDB_API SBModule { /// Remove any global modules which are no longer needed. static void GarbageCollectAllocatedModules(); + /// Return the name of the module. + const char *GetName() const; + private: friend class SBAddress; friend class SBFrame; diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp index 985107ec68efd..9eb0ae3cb3dba 100644 --- a/lldb/source/API/SBModule.cpp +++ b/lldb/source/API/SBModule.cpp @@ -671,3 +671,11 @@ void SBModule::GarbageCollectAllocatedModules() { const bool mandatory = false; ModuleList::RemoveOrphanSharedModules(mandatory); } + +const char *SBModule::GetName() const { + LLDB_INSTRUMENT_VA(this); + if (!m_opaque_sp) { + return nullptr; + } + return m_opaque_sp->GetObjectName().AsCString(); +} \ No newline at end of file >From 019261475ee073345aac9faba2e20ac2ef980b79 Mon Sep 17 00:00:00 2001 From: Bar Soloveychik <bars...@fb.com> Date: Wed, 23 Jul 2025 16:00:07 -0700 Subject: [PATCH 2/2] added nullptr check --- lldb/source/API/SBModule.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp index 9eb0ae3cb3dba..88cff3d6bcbf2 100644 --- a/lldb/source/API/SBModule.cpp +++ b/lldb/source/API/SBModule.cpp @@ -677,5 +677,9 @@ const char *SBModule::GetName() const { if (!m_opaque_sp) { return nullptr; } - return m_opaque_sp->GetObjectName().AsCString(); + auto mod_name = m_opaque_sp->GetObjectName(); + if (!mod_name) { + return nullptr; + } + return mod_name.AsCString(); } \ No newline at end of file _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits