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:
parent
e0a6e07bb3
commit
dbf07c84a2
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user