@@ -918,11 +918,6 @@ ConstString ObjectFileMachO::GetSectionNameEHFrame() {
918918 return g_section_name_eh_frame;
919919}
920920
921- ConstString ObjectFileMachO::GetSectionNameLLDBNoNlist () {
922- static ConstString g_section_name_lldb_no_nlist (" __lldb_no_nlist" );
923- return g_section_name_lldb_no_nlist;
924- }
925-
926921bool ObjectFileMachO::MagicBytesMatch (DataBufferSP data_sp,
927922 lldb::addr_t data_offset,
928923 lldb::addr_t data_length) {
@@ -2399,54 +2394,15 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
23992394 uint32_t memory_module_load_level = eMemoryModuleLoadLevelComplete;
24002395 bool is_shared_cache_image = IsSharedCacheBinary ();
24012396 bool is_local_shared_cache_image = is_shared_cache_image && !IsInMemory ();
2402-
2403- ConstString g_segment_name_TEXT = GetSegmentNameTEXT ();
2404- ConstString g_segment_name_DATA = GetSegmentNameDATA ();
2405- ConstString g_segment_name_DATA_DIRTY = GetSegmentNameDATA_DIRTY ();
2406- ConstString g_segment_name_DATA_CONST = GetSegmentNameDATA_CONST ();
2407- ConstString g_segment_name_OBJC = GetSegmentNameOBJC ();
2408- ConstString g_section_name_eh_frame = GetSectionNameEHFrame ();
2409- ConstString g_section_name_lldb_no_nlist = GetSectionNameLLDBNoNlist ();
2410- SectionSP text_section_sp (
2411- section_list->FindSectionByName (g_segment_name_TEXT));
2412- SectionSP data_section_sp (
2413- section_list->FindSectionByName (g_segment_name_DATA));
24142397 SectionSP linkedit_section_sp (
24152398 section_list->FindSectionByName (GetSegmentNameLINKEDIT ()));
2416- SectionSP data_dirty_section_sp (
2417- section_list->FindSectionByName (g_segment_name_DATA_DIRTY));
2418- SectionSP data_const_section_sp (
2419- section_list->FindSectionByName (g_segment_name_DATA_CONST));
2420- SectionSP objc_section_sp (
2421- section_list->FindSectionByName (g_segment_name_OBJC));
2422- SectionSP eh_frame_section_sp;
2423- SectionSP lldb_no_nlist_section_sp;
2424- if (text_section_sp.get ()) {
2425- eh_frame_section_sp = text_section_sp->GetChildren ().FindSectionByName (
2426- g_section_name_eh_frame);
2427- lldb_no_nlist_section_sp = text_section_sp->GetChildren ().FindSectionByName (
2428- g_section_name_lldb_no_nlist);
2429- } else {
2430- eh_frame_section_sp =
2431- section_list->FindSectionByName (g_section_name_eh_frame);
2432- lldb_no_nlist_section_sp =
2433- section_list->FindSectionByName (g_section_name_lldb_no_nlist);
2434- }
24352399
24362400 if (process && m_header.filetype != llvm::MachO::MH_OBJECT &&
24372401 !is_local_shared_cache_image) {
24382402 Target &target = process->GetTarget ();
24392403
24402404 memory_module_load_level = target.GetMemoryModuleLoadLevel ();
24412405
2442- // If __TEXT,__lldb_no_nlist section is present in this binary,
2443- // and we're reading it out of memory, do not read any of the
2444- // nlist entries. They are not needed in lldb and it may be
2445- // expensive to load these. This is to handle a dylib consisting
2446- // of only metadata, no code, but it has many nlist entries.
2447- if (lldb_no_nlist_section_sp)
2448- memory_module_load_level = eMemoryModuleLoadLevelMinimal;
2449-
24502406 // Reading mach file from memory in a process or core file...
24512407
24522408 if (linkedit_section_sp) {
@@ -2570,6 +2526,30 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
25702526
25712527 const bool have_strtab_data = strtab_data.GetByteSize () > 0 ;
25722528
2529+ ConstString g_segment_name_TEXT = GetSegmentNameTEXT ();
2530+ ConstString g_segment_name_DATA = GetSegmentNameDATA ();
2531+ ConstString g_segment_name_DATA_DIRTY = GetSegmentNameDATA_DIRTY ();
2532+ ConstString g_segment_name_DATA_CONST = GetSegmentNameDATA_CONST ();
2533+ ConstString g_segment_name_OBJC = GetSegmentNameOBJC ();
2534+ ConstString g_section_name_eh_frame = GetSectionNameEHFrame ();
2535+ SectionSP text_section_sp (
2536+ section_list->FindSectionByName (g_segment_name_TEXT));
2537+ SectionSP data_section_sp (
2538+ section_list->FindSectionByName (g_segment_name_DATA));
2539+ SectionSP data_dirty_section_sp (
2540+ section_list->FindSectionByName (g_segment_name_DATA_DIRTY));
2541+ SectionSP data_const_section_sp (
2542+ section_list->FindSectionByName (g_segment_name_DATA_CONST));
2543+ SectionSP objc_section_sp (
2544+ section_list->FindSectionByName (g_segment_name_OBJC));
2545+ SectionSP eh_frame_section_sp;
2546+ if (text_section_sp.get ())
2547+ eh_frame_section_sp = text_section_sp->GetChildren ().FindSectionByName (
2548+ g_section_name_eh_frame);
2549+ else
2550+ eh_frame_section_sp =
2551+ section_list->FindSectionByName (g_section_name_eh_frame);
2552+
25732553 const bool is_arm = (m_header.cputype == llvm::MachO::CPU_TYPE_ARM);
25742554 const bool always_thumb = GetArchitecture ().IsAlwaysThumbInstructions ();
25752555
0 commit comments