Skip to content

Commit 8a03abc

Browse files
author
Bar Soloveychik
committed
changed format and added a test to run darwin
1 parent 0192614 commit 8a03abc

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

lldb/source/API/SBModule.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -674,12 +674,8 @@ void SBModule::GarbageCollectAllocatedModules() {
674674

675675
const char *SBModule::GetName() const {
676676
LLDB_INSTRUMENT_VA(this);
677-
if (!m_opaque_sp) {
678-
return nullptr;
679-
}
680-
auto mod_name = m_opaque_sp->GetObjectName();
681-
if (!mod_name) {
682-
return nullptr;
683-
}
684-
return mod_name.AsCString();
677+
678+
if (!m_opaque_sp)
679+
return nullptr;
680+
return m_opaque_sp->GetObjectName().AsCString();
685681
}

lldb/test/API/python_api/sbmodule/TestSBModule.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ def tearDown(self):
2020

2121
@skipUnlessDarwin
2222
@skipIfRemote
23+
def test_getname(self):
24+
"""Test the SBModule::GetName() method"""
25+
self.build()
26+
target, _, _, _ = lldbutil.run_to_source_breakpoint(
27+
self, "// break here", lldb.SBFileSpec("main.c")
28+
)
29+
30+
self.assertGreater(target.GetNumModules(), 0)
31+
module_names = {target.GetModuleAtIndex(i).GetName() for i in range(target.GetNumModules())}
32+
self.assertIn("a.out", module_names)
33+
2334
def test_module_is_file_backed(self):
2435
"""Test the SBModule::IsFileBacked() method"""
2536
self.build()

0 commit comments

Comments
 (0)