aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2025-03-06 17:18:31 -0800
committerJason Molenda <jmolenda@apple.com>2025-03-06 17:19:43 -0800
commit82af9888dbbcd248ec4d41968c53135e12e13454 (patch)
tree42c950b9e5da17a5690ff7564f16d97ecc50c946 /lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
parentcec36e279cb871dd011e105e0c9d3edccd0dcad9 (diff)
downloadllvm-82af9888dbbcd248ec4d41968c53135e12e13454.zip
llvm-82af9888dbbcd248ec4d41968c53135e12e13454.tar.gz
llvm-82af9888dbbcd248ec4d41968c53135e12e13454.tar.bz2
Revert "[lldb][Mach-O] Don't read symbol table of specially marked binary (#129967)"
This reverts commit 397696bb3d26c1298bf265e4907b0b6416ad59c9. This breaks the macOS CI bots, I need to use $LDFLAGS in the $LD invocation when building the dylib to get the dylibs to build on the CI bots. But I've added "-lno-nlists -lhas-nlists" to the LDFLAGS for the main binary in the same directory, so using LDFLAGS will result in a compile error for the dylibs. I'll need to build the dylibs in a subdir with a different Makefile, will reland with that change in a bit.
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp')
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp68
1 files changed, 24 insertions, 44 deletions
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index f31b56b..a19322f 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -918,11 +918,6 @@ ConstString ObjectFileMachO::GetSectionNameEHFrame() {
return g_section_name_eh_frame;
}
-ConstString ObjectFileMachO::GetSectionNameLLDBNoNlist() {
- static ConstString g_section_name_lldb_no_nlist("__lldb_no_nlist");
- return g_section_name_lldb_no_nlist;
-}
-
bool ObjectFileMachO::MagicBytesMatch(DataBufferSP data_sp,
lldb::addr_t data_offset,
lldb::addr_t data_length) {
@@ -2399,39 +2394,8 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
uint32_t memory_module_load_level = eMemoryModuleLoadLevelComplete;
bool is_shared_cache_image = IsSharedCacheBinary();
bool is_local_shared_cache_image = is_shared_cache_image && !IsInMemory();
-
- ConstString g_segment_name_TEXT = GetSegmentNameTEXT();
- ConstString g_segment_name_DATA = GetSegmentNameDATA();
- ConstString g_segment_name_DATA_DIRTY = GetSegmentNameDATA_DIRTY();
- ConstString g_segment_name_DATA_CONST = GetSegmentNameDATA_CONST();
- ConstString g_segment_name_OBJC = GetSegmentNameOBJC();
- ConstString g_section_name_eh_frame = GetSectionNameEHFrame();
- ConstString g_section_name_lldb_no_nlist = GetSectionNameLLDBNoNlist();
- SectionSP text_section_sp(
- section_list->FindSectionByName(g_segment_name_TEXT));
- SectionSP data_section_sp(
- section_list->FindSectionByName(g_segment_name_DATA));
SectionSP linkedit_section_sp(
section_list->FindSectionByName(GetSegmentNameLINKEDIT()));
- SectionSP data_dirty_section_sp(
- section_list->FindSectionByName(g_segment_name_DATA_DIRTY));
- SectionSP data_const_section_sp(
- section_list->FindSectionByName(g_segment_name_DATA_CONST));
- SectionSP objc_section_sp(
- section_list->FindSectionByName(g_segment_name_OBJC));
- SectionSP eh_frame_section_sp;
- SectionSP lldb_no_nlist_section_sp;
- if (text_section_sp.get()) {
- eh_frame_section_sp = text_section_sp->GetChildren().FindSectionByName(
- g_section_name_eh_frame);
- lldb_no_nlist_section_sp = text_section_sp->GetChildren().FindSectionByName(
- g_section_name_lldb_no_nlist);
- } else {
- eh_frame_section_sp =
- section_list->FindSectionByName(g_section_name_eh_frame);
- lldb_no_nlist_section_sp =
- section_list->FindSectionByName(g_section_name_lldb_no_nlist);
- }
if (process && m_header.filetype != llvm::MachO::MH_OBJECT &&
!is_local_shared_cache_image) {
@@ -2439,14 +2403,6 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
memory_module_load_level = target.GetMemoryModuleLoadLevel();
- // If __TEXT,__lldb_no_nlist section is present in this binary,
- // and we're reading it out of memory, do not read any of the
- // nlist entries. They are not needed in lldb and it may be
- // expensive to load these. This is to handle a dylib consisting
- // of only metadata, no code, but it has many nlist entries.
- if (lldb_no_nlist_section_sp)
- memory_module_load_level = eMemoryModuleLoadLevelMinimal;
-
// Reading mach file from memory in a process or core file...
if (linkedit_section_sp) {
@@ -2570,6 +2526,30 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
const bool have_strtab_data = strtab_data.GetByteSize() > 0;
+ ConstString g_segment_name_TEXT = GetSegmentNameTEXT();
+ ConstString g_segment_name_DATA = GetSegmentNameDATA();
+ ConstString g_segment_name_DATA_DIRTY = GetSegmentNameDATA_DIRTY();
+ ConstString g_segment_name_DATA_CONST = GetSegmentNameDATA_CONST();
+ ConstString g_segment_name_OBJC = GetSegmentNameOBJC();
+ ConstString g_section_name_eh_frame = GetSectionNameEHFrame();
+ SectionSP text_section_sp(
+ section_list->FindSectionByName(g_segment_name_TEXT));
+ SectionSP data_section_sp(
+ section_list->FindSectionByName(g_segment_name_DATA));
+ SectionSP data_dirty_section_sp(
+ section_list->FindSectionByName(g_segment_name_DATA_DIRTY));
+ SectionSP data_const_section_sp(
+ section_list->FindSectionByName(g_segment_name_DATA_CONST));
+ SectionSP objc_section_sp(
+ section_list->FindSectionByName(g_segment_name_OBJC));
+ SectionSP eh_frame_section_sp;
+ if (text_section_sp.get())
+ eh_frame_section_sp = text_section_sp->GetChildren().FindSectionByName(
+ g_section_name_eh_frame);
+ else
+ eh_frame_section_sp =
+ section_list->FindSectionByName(g_section_name_eh_frame);
+
const bool is_arm = (m_header.cputype == llvm::MachO::CPU_TYPE_ARM);
const bool always_thumb = GetArchitecture().IsAlwaysThumbInstructions();