File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
include/swift/RemoteInspection Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -565,6 +565,26 @@ class ReflectionContext
565565
566566 if (sizeof (typename T::Section) > SectionEntrySize)
567567 return {};
568+
569+ // Special handling for large amount of sections.
570+ // From the elf man page, describing e_shnum:
571+ //
572+ // If the number of entries in the section header table is
573+ // larger than or equal to SHN_LORESERVE (0xff00), e_shnum
574+ // holds the value zero and the real number of entries in the
575+ // section header table is held in the sh_size member of the
576+ // initial entry in section header table. Otherwise, the
577+ // sh_size member of the initial entry in the section header
578+ // table holds the value zero.
579+ if (SectionHdrNumEntries == 0 && SectionEntrySize > 0 ) {
580+ auto SecBuf = readData (SectionHdrAddress, sizeof (typename T::Section));
581+ if (!SecBuf)
582+ return {};
583+ const typename T::Section *FirstSectHdr =
584+ reinterpret_cast <const typename T::Section *>(SecBuf);
585+ SectionHdrNumEntries = FirstSectHdr->sh_size ;
586+ }
587+
568588 if (SectionHdrNumEntries == 0 )
569589 return {};
570590
You can’t perform that action at this time.
0 commit comments