Page MenuHomePhabricator

Add support for DW_FORM_GNU_[addr,str]_index
ClosedPublic

Authored by tberghammer on Aug 21 2015, 7:04 AM.

Details

Summary

Add support for DW_FORM_GNU_[addr,str]_index

These are 2 new value currently in experimental status used when split debug info is enabled.

Note: This CL is part of a long series of CLs to add fission support to LLDB

Diff Detail

Repository
rL LLVM

Event Timeline

tberghammer retitled this revision from to Add support for DW_FORM_GNU_[addr,str]_index.
tberghammer updated this object.
tberghammer added reviewers: clayborg, labath.
tberghammer added a subscriber: lldb-commits.
tberghammer added inline comments.Aug 21 2015, 7:07 AM
source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
56 ↗(On Diff #32825)

This will be completed by a later patch because fetching it require parts what will be only added later.

labath edited edge metadata.Aug 21 2015, 7:43 AM

Looks reasonable at a first glance, but I'll leave the review to someone else.

clayborg requested changes to this revision.Aug 21 2015, 9:47 AM
clayborg edited edge metadata.

Looks good, a few changes needed.

We might consider changing FormValue::AsCString() to take a "SymbolFileDWARF*" instead of the data extractor for .debug_str and .debug_str_offsets. This way it would be only one parameter and it would clean up the code. It would help errors like on DWARFCompileUnit.cpp:729 and DWARFCompileUnit.cpp:745 where both were not passed.

Other than that we might consider modifying FormValue::Address(...) as suggested in the inlined comments.

source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
729 ↗(On Diff #32825)

Don't we need to pass both debug_str and debug_str_offsets here? Other places seem to pass both like on DWARFDebugInfoEntry.cpp:826

745 ↗(On Diff #32825)

Don't we need to pass both debug_str and debug_str_offsets here? Other places seem to pass both like on DWARFDebugInfoEntry.cpp:826

source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
190 ↗(On Diff #32825)

We we not longer need "m_value.data" set to the cstring value to tell the difference between DW_FORM_string and DW_FORM_strp? This might have been left over from the code this originated from and might be able to be removed, but I just wanted to verify that you intended to remove this.

source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
68 ↗(On Diff #32825)

Should be pass in a lldb::addr_t base_addr in case the DW_FORM is one where we need to add to the low_pc? Then code like this:

dw_form_t form = form_value.Form();
if (form == DW_FORM_addr || form == DW_FORM_GNU_addr_index)
    return form_value.Address(&dwarf2Data->get_debug_addr_data());

// DWARF4 can specify the hi_pc as an <offset-from-lowpc>
return lo_pc + form_value.Unsigned();

Becomes:

return form_value.Address(&dwarf2Data->get_debug_addr_data(), lo_pc);

The "base_addr" could default to LLDB_INVALID_ADDRESS and if we get a relative address we should assert in debug builds using LLDB_ASSERT.

This revision now requires changes to proceed.Aug 21 2015, 9:47 AM
tberghammer updated this revision to Diff 32949.EditedAug 24 2015, 5:42 AM
tberghammer edited edge metadata.

Change DWARFFormValue::AsCString and related functions to take SymbolFileDWARF as an argument instead of DWARFDataExtractor

source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
729 ↗(On Diff #32825)

Both of them is passed in here. The only difference is that they are pre-fetched in line 662-663.

745 ↗(On Diff #32825)

Both of them is passed in here. The only difference is that they are pre-fetched in line 662-663.

source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
190 ↗(On Diff #32825)

We store the information in the m_form field, so we don't have to rely on this magic anymore (I don't see why we needed it at the first place).

source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
68 ↗(On Diff #32825)

We have a dedicated function for that called DWARFDebugInfoEntry::GetAttributeHighPC. The purpose of this function is to fetch a value where the attribute encoding value class is "address" (http://www.dwarfstd.org/doc/DWARF4.pdf page 155)

clayborg accepted this revision.Aug 24 2015, 9:44 AM
clayborg edited edge metadata.

Looks good.

This revision is now accepted and ready to land.Aug 24 2015, 9:44 AM
This revision was automatically updated to reflect the committed changes.