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: Only complain about no aranges if CU has low_pc set


Mark Wielaard <mjw@redhat.com> writes:

> On Mon, 2011-04-18 at 11:44 -0600, Tom Tromey wrote:
>> >>>>> "Mark" == Mark Wielaard <mjw@redhat.com> writes:
>> 
>> Mark> Note that libdw relies on .debug_aranges. For example dwarf_addrdie (),
>> Mark> which returns the CU DIE containing a given address, just returns NULL
>> Mark> if the aranges section isn't there.
>> 
>> Yeah.  What makes this bug theoretical is that, AFAIK, nobody has seen
>> it happen in the wild.  In practice, a missing .debug_aranges entry
>> means that the CU covers no addresses.
>
> To make this explicit, lets make the dwarflint check more specific in
> this case. Petr, does the following make sense?
>
> For CUs with no associated code and a new enough gcc this will no longer
> complain when no aranges section is found when the CU doesn't have
> low_pc set.

I'm not sure.  I think that having empty arange section is better,
because then it's more explicit.  But it's all the same in the end, if
the absence is reliable and meaningful, so we can do it like you
propose.

However, your patch doesn't take into account DW_AT_ranges (I'm not sure
these appear at CU DIEs in practice, but it's legal DWARF).  How about
this?

-      if (_m_aranges != NULL && !it->has_arange)
+      if (_m_aranges != NULL && !it->has_arange
+         && (it->low_pc != (uint64_t)-1 || !it->range_refs.empty ()))

And this to enable empty ():

diff --git a/dwarflint/addr-record.hh b/dwarflint/addr-record.hh
index 4bbd0c5..fe9718a 100644
--- a/dwarflint/addr-record.hh
+++ b/dwarflint/addr-record.hh
@@ -77,6 +77,7 @@ public:
   using _super_t::begin;
   using _super_t::end;
   using _super_t::push_back;
+  using _super_t::empty;
 };
 
 #endif//DWARFLINT_ADDR_RECORD_H

Thanks,
PM

> commit 3f8d455103b378d96d2a99124c1c332e1e28d9bd
> Author: Mark Wielaard <mjw@redhat.com>
> Date:   Thu Apr 21 15:00:34 2011 +0200
>
>     dwarflint: Only complain about no aranges if CU has low_pc set.
>
> diff --git a/dwarflint/check_debug_info.cc b/dwarflint/check_debug_info.cc
> index e415fb1..337b12d 100644
> --- a/dwarflint/check_debug_info.cc
> +++ b/dwarflint/check_debug_info.cc
> @@ -1261,7 +1261,7 @@ check_debug_info_refs::check_debug_info_refs (checkstack &stack,
>           << "unresolved reference to .debug_line table "
>           << pri::hex (it->stmt_list.addr) << '.' << std::endl;
>  
> -      if (_m_aranges != NULL && !it->has_arange)
> +      if (_m_aranges != NULL && !it->has_arange && it->low_pc != (uint64_t)-1)
>         wr_message (it->head->where,
>                     mc_impact_3 | mc_acc_suboptimal | mc_aranges | mc_info)
>           << "no aranges table is associated with this CU." << std::endl;

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