diff --git a/src/apps/debugger/dwarf/DwarfFile.cpp b/src/apps/debugger/dwarf/DwarfFile.cpp index 647edbb393..d4cb185c49 100644 --- a/src/apps/debugger/dwarf/DwarfFile.cpp +++ b/src/apps/debugger/dwarf/DwarfFile.cpp @@ -350,15 +350,25 @@ DwarfFile::Load(const char* fileName) fDebugRangesSection = fElfFile->GetSection(".debug_ranges"); fDebugLineSection = fElfFile->GetSection(".debug_line"); fDebugFrameSection = fElfFile->GetSection(".debug_frame"); - if (fDebugFrameSection == NULL) { - fDebugFrameSection = fElfFile->GetSection(".eh_frame"); - fUsingEHFrameSection = fDebugFrameSection != NULL; - if (fUsingEHFrameSection) { - fGCC4EHFrameSection = !fDebugFrameSection->IsWritable(); - // Crude heuristic for recognizing GCC 4 (Itanium ABI) style - // .eh_frame sections. The ones generated by GCC 2 are writable, - // the ones generated by GCC 4 aren't. + ElfSection* ehFrameSection = fElfFile->GetSection(".eh_frame"); + if (fDebugFrameSection != NULL) { + if (ehFrameSection != NULL && ehFrameSection->Size() + > fDebugFrameSection->Size()) { + fElfFile->PutSection(fDebugFrameSection); + fDebugFrameSection = ehFrameSection; + fUsingEHFrameSection = true; } + + } else if (ehFrameSection != NULL) { + fDebugFrameSection = ehFrameSection; + fUsingEHFrameSection = true; + } + + if (fUsingEHFrameSection) { + fGCC4EHFrameSection = !fDebugFrameSection->IsWritable(); + // Crude heuristic for recognizing GCC 4 (Itanium ABI) style + // .eh_frame sections. The ones generated by GCC 2 are writable, + // the ones generated by GCC 4 aren't. } fDebugLocationSection = fElfFile->GetSection(".debug_loc"); fDebugPublicTypesSection = fElfFile->GetSection(".debug_pubtypes");