Fix problems unwinding call frames.
Our more recent build of gcc4 appears to have switched to using .eh_frame for almost all useful call frame information when built with debugging. Use a somewhat crude heuristic (size) to determine if the .debug_frame section we've been given might actually be of use or not (assuming it exists at all, this was inconsistent in my tests. Sometimes apps had no .debug_frame at all, other times it was present but was only roundabouts 100 bytes). Fixes ticket #8508.
This commit is contained in:
@@ -350,15 +350,25 @@ DwarfFile::Load(const char* fileName)
|
|||||||
fDebugRangesSection = fElfFile->GetSection(".debug_ranges");
|
fDebugRangesSection = fElfFile->GetSection(".debug_ranges");
|
||||||
fDebugLineSection = fElfFile->GetSection(".debug_line");
|
fDebugLineSection = fElfFile->GetSection(".debug_line");
|
||||||
fDebugFrameSection = fElfFile->GetSection(".debug_frame");
|
fDebugFrameSection = fElfFile->GetSection(".debug_frame");
|
||||||
if (fDebugFrameSection == NULL) {
|
ElfSection* ehFrameSection = fElfFile->GetSection(".eh_frame");
|
||||||
fDebugFrameSection = fElfFile->GetSection(".eh_frame");
|
if (fDebugFrameSection != NULL) {
|
||||||
fUsingEHFrameSection = fDebugFrameSection != NULL;
|
if (ehFrameSection != NULL && ehFrameSection->Size()
|
||||||
if (fUsingEHFrameSection) {
|
> fDebugFrameSection->Size()) {
|
||||||
fGCC4EHFrameSection = !fDebugFrameSection->IsWritable();
|
fElfFile->PutSection(fDebugFrameSection);
|
||||||
// Crude heuristic for recognizing GCC 4 (Itanium ABI) style
|
fDebugFrameSection = ehFrameSection;
|
||||||
// .eh_frame sections. The ones generated by GCC 2 are writable,
|
fUsingEHFrameSection = true;
|
||||||
// the ones generated by GCC 4 aren't.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} 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");
|
fDebugLocationSection = fElfFile->GetSection(".debug_loc");
|
||||||
fDebugPublicTypesSection = fElfFile->GetSection(".debug_pubtypes");
|
fDebugPublicTypesSection = fElfFile->GetSection(".debug_pubtypes");
|
||||||
|
|||||||
Reference in New Issue
Block a user