This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [PATCH 1/2] Fix BZ 25065 - Ensure that physnames are computed for inherited DIEs


On Sun, 13 Oct 2019 23:02:01 -0400
Simon Marchi <simon.marchi@polymtl.ca> wrote:

> Hi Kevin,
> 
> I don't really have the big picture of these advanced DWARF use cases, 
> so I can't really weigh on this, but I have a question:
> 
> > diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
> > index ee9df34ed2..f7ef122933 100644
> > --- a/gdb/dwarf2read.c
> > +++ b/gdb/dwarf2read.c
> > @@ -13666,6 +13666,17 @@ inherit_abstract_dies (struct die_info *die,
> > struct dwarf2_cu *cu)
> >        origin_child_die = sibling_die (origin_child_die);
> >      }
> >    origin_cu->list_in_scope = origin_previous_list_in_scope;
> > +
> > +  if (cu != origin_cu && !origin_cu->method_list.empty ())
> > +    {
> > +      /* Add list of methods found in origin_cu to the list in cu.  
> > These
> > +         methods still need to have their physnames computed in
> > +	 compute_delayed_physnames().  */
> > +      cu->method_list.insert (cu->method_list.end (),
> > +                              origin_cu->method_list.begin (),
> > +			      origin_cu->method_list.end ());
> > +      origin_cu->method_list.clear ();
> > +    }  
> 
> So, this effectively makes the inheriting CU steal the method_list 
> content from the inherited from CU?  Is it possible for a CU to be 
> inherited from multiple times?  If so, what happens the second time we 
> process something that inherits from this CU, the method_list vector 
> will then be empty?  Is it that we want?

Hi Simon,

You raise some good questions.  I modified the test associated with
this bug so that two different CUs attempt to inherit a third CU. 
This has turned up another bug in GDB which I spent the rest of the
day looking at.  (GDB goes into an infinite loop!)

I'll make the following observations, however...

- method_list is used solely for keeping track of C++ methods for
delayed physname computations.

- method_list is cleared in process_full_comp_unit(),
process_full_type_unit(), and compute_delayed_physnames().
That latter function(), compute_delayed_physnames(), is called
after DIE processing in the first two functions.  So method_list
is made to be empty prior to DIE processing and then made empty
(as a result of delayed physname computation) again after DIE
processing (in the above mentioned functions).

So, what is the right thing to do with regard to method_list for
inherit_abstract_dies()?

Yesterday, as part of my investigations, I made inherit_abstract_dies()
call compute_delayed_physnames in place of the code in my posted
patch.  That also works, at least for my test case.  I'll note that
for my original (posted) patch, compute_delayed_physnames will be
called with the inheriting CU.  In the alternate approach (in which
compute_delayed_physnames is called from inherit_abstract_dies),
compute_delayed_physnames is called with the origin CU.  I don't
yet know which is more correct or if there are cases where it'll
make a difference.

So... I'm continuing my investigations and will let you know when
I have some answers.  In the interim, if anyone has some insights
about these matters, I'd very much like to hear them.

Kevin


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