Don't require the .debug_str section. It's only needed for DW_FORM_strp
attributes, but apparently those aren't generated by gcc 2. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31385 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -74,9 +74,7 @@ DwarfFile::Load(const char* fileName)
|
|||||||
// get the interesting sections
|
// get the interesting sections
|
||||||
fDebugInfoSection = fElfFile->GetSection(".debug_info");
|
fDebugInfoSection = fElfFile->GetSection(".debug_info");
|
||||||
fDebugAbbrevSection = fElfFile->GetSection(".debug_abbrev");
|
fDebugAbbrevSection = fElfFile->GetSection(".debug_abbrev");
|
||||||
fDebugStringSection = fElfFile->GetSection(".debug_str");
|
if (fDebugInfoSection == NULL || fDebugAbbrevSection == NULL) {
|
||||||
if (fDebugInfoSection == NULL || fDebugAbbrevSection == NULL
|
|
||||||
|| fDebugStringSection == NULL) {
|
|
||||||
fprintf(stderr, "DwarfManager::File::Load(\"%s\"): no "
|
fprintf(stderr, "DwarfManager::File::Load(\"%s\"): no "
|
||||||
".debug_info, .debug_abbrev, or .debug_str section.\n",
|
".debug_info, .debug_abbrev, or .debug_str section.\n",
|
||||||
fileName);
|
fileName);
|
||||||
@@ -84,6 +82,7 @@ DwarfFile::Load(const char* fileName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// not mandatory sections
|
// not mandatory sections
|
||||||
|
fDebugStringSection = fElfFile->GetSection(".debug_str");
|
||||||
fDebugRangesSection = fElfFile->GetSection(".debug_ranges");
|
fDebugRangesSection = fElfFile->GetSection(".debug_ranges");
|
||||||
fDebugLineSection = fElfFile->GetSection(".debug_line");
|
fDebugLineSection = fElfFile->GetSection(".debug_line");
|
||||||
|
|
||||||
@@ -477,14 +476,20 @@ DwarfFile::_ParseEntryAttributes(DataReader& dataReader,
|
|||||||
break;
|
break;
|
||||||
case DW_FORM_strp:
|
case DW_FORM_strp:
|
||||||
{
|
{
|
||||||
dwarf_off_t offset = dataReader.Read<dwarf_off_t>(0);
|
if (fDebugStringSection != NULL) {
|
||||||
if (offset >= fDebugStringSection->Size()) {
|
dwarf_off_t offset = dataReader.Read<dwarf_off_t>(0);
|
||||||
fprintf(stderr, "Invalid DW_FORM_strp offset: %lu\n",
|
if (offset >= fDebugStringSection->Size()) {
|
||||||
offset);
|
fprintf(stderr, "Invalid DW_FORM_strp offset: %lu\n",
|
||||||
|
offset);
|
||||||
|
return B_BAD_DATA;
|
||||||
|
}
|
||||||
|
attributeValue.SetToString(
|
||||||
|
(const char*)fDebugStringSection->Data() + offset);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "Invalid DW_FORM_strp: no string "
|
||||||
|
"section!\n");
|
||||||
return B_BAD_DATA;
|
return B_BAD_DATA;
|
||||||
}
|
}
|
||||||
attributeValue.SetToString(
|
|
||||||
(const char*)fDebugStringSection->Data() + offset);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DW_FORM_udata:
|
case DW_FORM_udata:
|
||||||
|
|||||||
Reference in New Issue
Block a user