Skip to content

Commit

Permalink
Print type references differently
Browse files Browse the repository at this point in the history
  • Loading branch information
Austin Clements committed Mar 10, 2013
1 parent e7a5987 commit 1846eae
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions dwarf/die.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ die::die(const unit *cu)
{
}

const unit &
die::get_unit() const
{
return *cu;
}

section_offset
die::get_section_offset() const
{
Expand Down
5 changes: 5 additions & 0 deletions dwarf/dwarf++.hh
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ public:
return abbrev != nullptr;
}

/**
* Return the unit containing this DIE.
*/
const unit &get_unit() const;

/**
* Return this DIE's byte offset within its compilation unit.
*/
Expand Down
9 changes: 7 additions & 2 deletions dwarf/value.cc
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,13 @@ to_string(const value &v)
return "<macptr 0x" + to_hex(v.as_sec_offset()) + ">";
case value::type::rangelistptr:
return "<rangelistptr 0x" + to_hex(v.as_sec_offset()) + ">";
case value::type::reference:
return "<0x" + to_hex(v.as_reference().get_section_offset()) + ">";
case value::type::reference: {
die d = v.as_reference();
auto tu = dynamic_cast<const type_unit*>(&d.get_unit());
if (tu)
return "<.debug_types+0x" + to_hex(d.get_section_offset()) + ">";
return "<0x" + to_hex(d.get_section_offset()) + ">";
}
case value::type::string:
return v.as_string();
}
Expand Down

0 comments on commit 1846eae

Please sign in to comment.