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] Replace objfile field in dwarf2_cu and dwarf2_per_cu_data with dwarf2_per_objfile


On 2017-12-10 13:09, Simon Marchi wrote:
From: Simon Marchi <simon.marchi@ericsson.com>

The next patch aims to remove the dwarf2_per_objfile global.  In many
functions, we need to find a way to get a reference to the current
dwarf2_per_objfile through the objects passed in parameters. Often, we have access to a dwarf2_cu or a dwarf2_per_cu_data. These objects have a reference
to the objfile, through which we can get the dwarf2_per_objfile:

  dwarf2_per_objfile = ((struct dwarf2_per_objfile *)
		        objfile_data (objfile, dwarf2_objfile_data_key));

However, this is a bit cumbersome to do all over the place. It would be
more logical if the dwarf2_cu and dwarf2_per_cu_data had a reference to
their dwarf2_per_objfile, which would then have a reference to the
objfile.  It would be more in line with the object hierarchy, where
dwarf2_per_objfile owns the dwarf2_per_cu_data instances.  We could
even remove the reference dwarf2_cu has to dwarf2_per_objfile, since we
can access dwarf2_per_objfile through dwarf2_cu::per_cu.

In a graphical way, references would look like this after the current
patch:

  objfile <--- dwarf2_per_objfile <--- dwarf2_per_cu_data
                                    |      ^
				    |      |
                                    `- dwarf2_cu

This patch has been tested on the buildbot.

I pushed these three patches in. It required a non-automatic, but still simple rebase.

Simon


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