class file_table;
class line_table;
class line_entry;
+ class macro_info_table;
class debug_info_entry
{
return line_info ().lines ();
}
- /*
- containers/iterators:
-
- XXX lines
- 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.
}
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
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_constant:
case VS_dwarf_constant:
case VS_source_line:
}
};
+ 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);
+ }
+ };
+
// This describes one attribute, equivalent to pair<const int, attr_value>.
class attribute
{
const uint8_t *const end = begin + block.length;
return const_vector<uint8_t> (begin, end);
}
+
+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);
+}
\f
// dwarf::location_attr
/* Get macro information.
- Copyright (C) 2002, 2003, 2004, 2005 Red Hat, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2009 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
mac.param2.s = str;
if (callback (&mac, arg) != DWARF_CB_OK)
- return (readp
- - ((unsigned char *) die->cu->dbg->sectiondata[IDX_debug_macinfo]->d_buf
- + offset));
+ return readp - ((unsigned char *) die->cu->dbg->sectiondata
+ [IDX_debug_macinfo]->d_buf);
}
/* If we come here the termination of the data for the CU is not