-static void getDebugInfoSections(const ObjectFile *Obj,
- StringRef &DebugInfoSection,
- StringRef &DebugAbbrevSection,
- StringRef &DebugLineSection,
- StringRef &DebugArangesSection,
- StringRef &DebugStringSection,
- StringRef &DebugRangesSection) {
- if (Obj == 0)
- return;
- error_code ec;
- for (section_iterator i = Obj->begin_sections(),
- e = Obj->end_sections();
- i != e; i.increment(ec)) {
- if (error(ec)) break;
- StringRef Name;
- if (error(i->getName(Name))) continue;
- StringRef Data;
- if (error(i->getContents(Data))) continue;
- if (isFullNameOfDwarfSection(Name, "debug_info"))
- DebugInfoSection = Data;
- else if (isFullNameOfDwarfSection(Name, "debug_abbrev"))
- DebugAbbrevSection = Data;
- else if (isFullNameOfDwarfSection(Name, "debug_line"))
- DebugLineSection = Data;
- // Don't use debug_aranges for now, as address ranges contained
- // there may not cover all instructions in the module
- // else if (isFullNameOfDwarfSection(Name, "debug_aranges"))
- // DebugArangesSection = Data;
- else if (isFullNameOfDwarfSection(Name, "debug_str"))
- DebugStringSection = Data;
- else if (isFullNameOfDwarfSection(Name, "debug_ranges"))
- DebugRangesSection = Data;
- }
-}
-