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: locexpr vs. loclist 1 entry


Please give me those two binaries so I can use dwarfcmp myself.

> Hmm, per the spec, DW_AT_data_member_location can be of class block, 
> constant, or loclistptr.  I emit it as DW_FORM_data8 (data4 would have 
> sufficed for 32-bit Dwarf, but that's another story), with the intended 
> semantic of `loclistptr'.  And that's how our tools understand it.

constant and loclistptr are inherently ambiguous.  When both are possible,
data* must be interpreted as constant.  (This is why DW_FORM_sec_offset is
better.)  I think I loused this up in values.cc in the last fix (ae3028b).
We'll have to correct that shortly.  But for the moment, it lets us look at
the location vs singleton list case you hit.

> ./a.out, relevant part of .debug_info:
>   [    3d]      inheritance
>                 type                 [    2d]
>                 data_member_location 2 byte block: 23 00
>                  [   0] plus_uconst 0
> 
> ./a.out.out, head of .debug_loc:
> DWARF section [33] '.debug_loc' at offset 0x15b3:
>   [     0]  000000000000000000..0xffffffffffffffff [   0] plus_uconst 0

Ok, I think I probably intended for these to be equivalent in the C++ API's
operator== (and thus to dwarfcmp).  Maybe the change below does it?

Note it is dubious to ever actually emit the latter in DWARF--I would
expect dwarflint to warn me that the PC bounds go outside the set defined
by DW_AT_ranges/*pc for the scope owning this DIE.  But it should be kosher
enough for actual consumers.

Thanks,
Roland

======

diff --git a/libdw/c++/dwarf b/libdw/c++/dwarf
index 0760942..8694852 100644
--- a/libdw/c++/dwarf
+++ b/libdw/c++/dwarf
@@ -1573,11 +1573,11 @@ namespace elfutils
 		  || std::find_if (other.begin (), other.end (),
 				   nonempty<typename other_attr::value_type> ()
 				   ) == other.end ());
-	if (!is_list ())
-	  return (!other.is_list () && !other.empty ()
-		  && location () == other.location ());
 
-	return other.is_list () && subr::container_equal (*this, other);
+	if (!is_list () && !other.is_list ())
+	  return !other.empty () && location () == other.location ();
+
+	return subr::container_equal (*this, other);
       }
       template<typename other_file>
       inline bool operator!= (const other_file &other) const


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