Skip to content

Commit c119195

Browse files
authored
Merge pull request #8476 from jasonmolenda/cp/llvm-cov-not-loaded-in-memory-6.0
[lldb] [ObjectFileMachO] LLVM_COV is not mapped into firmware memory (llvm#86359)
2 parents dee589f + 6e1071e commit c119195

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,11 @@ ConstString ObjectFileMachO::GetSegmentNameDWARF() {
909909
return g_section_name;
910910
}
911911

912+
ConstString ObjectFileMachO::GetSegmentNameLLVM_COV() {
913+
static ConstString g_section_name("__LLVM_COV");
914+
return g_section_name;
915+
}
916+
912917
ConstString ObjectFileMachO::GetSectionNameEHFrame() {
913918
static ConstString g_section_name_eh_frame("__eh_frame");
914919
return g_section_name_eh_frame;
@@ -6175,6 +6180,13 @@ bool ObjectFileMachO::SectionIsLoadable(const Section *section) {
61756180
return false;
61766181
if (GetModule().get() != section->GetModule().get())
61776182
return false;
6183+
// firmware style binaries with llvm gcov segment do
6184+
// not have that segment mapped into memory.
6185+
if (section->GetName() == GetSegmentNameLLVM_COV()) {
6186+
const Strata strata = GetStrata();
6187+
if (strata == eStrataKernel || strata == eStrataRawImage)
6188+
return false;
6189+
}
61786190
// Be careful with __LINKEDIT and __DWARF segments
61796191
if (section->GetName() == GetSegmentNameLINKEDIT() ||
61806192
section->GetName() == GetSegmentNameDWARF()) {

lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h

+1
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ class ObjectFileMachO : public lldb_private::ObjectFile {
271271
static lldb_private::ConstString GetSegmentNameOBJC();
272272
static lldb_private::ConstString GetSegmentNameLINKEDIT();
273273
static lldb_private::ConstString GetSegmentNameDWARF();
274+
static lldb_private::ConstString GetSegmentNameLLVM_COV();
274275
static lldb_private::ConstString GetSectionNameEHFrame();
275276

276277
llvm::MachO::dysymtab_command m_dysymtab;

0 commit comments

Comments
 (0)