This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: dwarf_output overview


On Wed, 2010-08-18 at 14:48 -0700, Roland McGrath wrote:
> Yeah, I don't really like that since the directory table indices are
> meaningful in reading the raw DWARF.  It doesn't really matter to how
> we handle attr_value.source_file () or line table entries, since those
> resolve it internally.  But it doesn't feel quite right.
> 
> Anyway, as I said, we can figure it out more exactly later.  For the
> moment, let's just go with your hack to treat a NULL string as "" when
> copying in.

OK, I pushed variant that only does the replacement for the first entry
if necessary. Since for the other entries it really shouldn't be
necessary.

Cheers,

Mark

diff --git a/libdw/c++/dwarf_data b/libdw/c++/dwarf_data
index daf0aa2..4de17d2 100644
--- a/libdw/c++/dwarf_data
+++ b/libdw/c++/dwarf_data
@@ -311,7 +311,14 @@ namespace elfutils
 
       template<typename table>
       directory_table (const table &other)
-       : _base (other.begin (), other.end ()) {}
+      {
+       /* The first entry is "special". It can be NULL/empty.
+          This is not encoded in the .debug_line table, but in
+          the DW_AT_comp_dir attribute of the referring CU.  */
+       typename table::const_iterator first = other.begin ();
+       _base::push_back (*first != NULL ? std::string (*first) : "");
+       _base::insert (_base::end (), ++first, other.end ());
+      }
 
       std::string to_string () const;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]