diff options
| -rw-r--r-- | libdw/c++/dwarf | 50 | ||||
| -rw-r--r-- | libdw/c++/values.cc | 10 |
2 files changed, 48 insertions, 12 deletions
diff --git a/libdw/c++/dwarf b/libdw/c++/dwarf index 45dc558f..93ce401a 100644 --- a/libdw/c++/dwarf +++ b/libdw/c++/dwarf @@ -391,6 +391,7 @@ namespace elfutils class file_table; class line_table; class line_entry; + class macro_info_table; class dwarf_enum; class debug_info_entry @@ -941,14 +942,8 @@ namespace elfutils return line_info ().lines (); } - /* - containers/iterators: - - XXX macros - - abbrevs (punt) - - */ + // Fetch the CU's DW_AT_macro_info. + const macro_info_table macro_info () const; }; // These are the kinds of values that attributes can have. @@ -1112,8 +1107,7 @@ namespace elfutils } const line_info_table line_info () const; - - // XXX macptr + const macro_info_table macro_info () const; template<typename value> inline bool operator== (const value &other) const @@ -1136,8 +1130,9 @@ namespace elfutils case VS_lineptr: return line_info () == other.line_info (); - case VS_macptr: // XXX punt for now, treat as constant - /*FALLTHRU*/ + case VS_macptr: + return macro_info () == macro_info (); + case VS_dwarf_constant: return constant () == other.constant (); @@ -1754,6 +1749,37 @@ namespace elfutils } }; + class macro_entry; // XXX + // The DW_AT_macro_info attribute yields a line info table. + class macro_info_table + { + friend class attr_value; + private: + compile_unit _m_cu; + + macro_info_table (const debug_info_entry &die) : _m_cu (die) {} + + public: + typedef macro_entry value_type; + + macro_info_table (const macro_info_table &t) : _m_cu (t._m_cu) {} + + typedef void **const_iterator; // XXX + const_iterator begin () const { return NULL; } // dummy + const_iterator end () const { return NULL; } // dummy + + template<typename table> + inline bool operator== (const table &other) const + { + return std::equal (begin (), end (), other.begin ()); + } + template<typename table> + inline bool operator!= (const table &other) const + { + return !(*this == other); + } + }; + class dwarf_enum { friend class attr_value; diff --git a/libdw/c++/values.cc b/libdw/c++/values.cc index 8b278c49..21fd66a5 100644 --- a/libdw/c++/values.cc +++ b/libdw/c++/values.cc @@ -325,6 +325,16 @@ dwarf::attr_value::constant_block () const return const_vector<uint8_t> (block); } + +const dwarf::macro_info_table +dwarf::attr_value::macro_info () const +{ + assert (dwarf_whatattr (thisattr ()) == DW_AT_macro_info); + CUDIE (cudie, _m_attr.cu); + debug_info_entry die; + die._m_die = cudie; + return macro_info_table (die); +} // dwarf::range_list |
