Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Luis Machado <luis.machado@linaro.org>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 8/8] Move the frame data to the BFD when possible
Date: Tue, 11 Feb 2020 10:45:00 -0000	[thread overview]
Message-ID: <f9d52acf-83b8-c88d-cb66-d8f8d385473d@linaro.org> (raw)
In-Reply-To: <20200208152758.29385-9-tom@tromey.com>

On 2/8/20 12:27 PM, Tom Tromey wrote:
> Now that comp_unit and the remaining frame data are all independent of
> the objfile, it can all be stored on the BFD and shared across
> inferiors.
> 
> As with other code doing this same thing, care must be taken to not
> share the data when the objfile requires relocations.  So, two keys
> are used: one for the BFD and one for the objfile, and
> gdb_bfd_requires_relocations is used to differentiate between the two
> cases.
> 
> gdb/ChangeLog
> 2020-02-08  Tom Tromey  <tom@tromey.com>
> 
> 	* dwarf2/frame.c (dwarf2_frame_bfd_data): New global.
> 	(dwarf2_frame_objfile_data): Add comment.
> 	(find_comp_unit, set_comp_unit): New functions.
> 	(dwarf2_frame_find_fde): Use find_comp_unit.
> 	(dwarf2_build_frame_info): Use set_comp_unit.
> 
> Change-Id: I50f5e1220c3f6b2992a15d5112fe474fb2904511
> ---
>   gdb/ChangeLog      |  8 ++++++++
>   gdb/dwarf2/frame.c | 37 +++++++++++++++++++++++++++++++++----
>   2 files changed, 41 insertions(+), 4 deletions(-)
> 
> diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c
> index 2c35016e2d9..25dddb7b1ae 100644
> --- a/gdb/dwarf2/frame.c
> +++ b/gdb/dwarf2/frame.c
> @@ -1475,8 +1475,14 @@ dwarf2_frame_cfa (struct frame_info *this_frame)
>     return get_frame_base (this_frame);
>   }
>   \f
> -const struct objfile_key<comp_unit> dwarf2_frame_objfile_data;
> +/* We store the frame data on the BFD, when it is independent of the

when -> where?

> +   address space and so can be shared.  */
> +const struct bfd_key<comp_unit> dwarf2_frame_bfd_data;
>   
> +/* If any BFD sections require relocations (note; really should be if
> +   any debug info requires relocations), then we store the frame data
> +   on the objfile instead, and do not share it.  */
> +const struct objfile_key<comp_unit> dwarf2_frame_objfile_data;
>   \f
>   
>   /* Pointer encoding helper functions.  */
> @@ -1630,6 +1636,29 @@ bsearch_fde_cmp (const dwarf2_fde *fde, CORE_ADDR seek_pc)
>     return 1;
>   }
>   
> +/* Find an existing comp_unit for an objfile, if any.  */
> +
> +static comp_unit *
> +find_comp_unit (struct objfile *objfile)
> +{
> +  bfd *abfd = objfile->obfd;
> +  if (gdb_bfd_requires_relocations (abfd))
> +    return dwarf2_frame_bfd_data.get (abfd);
> +  return dwarf2_frame_objfile_data.get (objfile);
> +}
> +
> +/* Store the comp_unit on OBJFILE, or the corresponding BFD, as
> +   appropriate.  */
> +
> +static void
> +set_comp_unit (struct objfile *objfile, struct comp_unit *unit)
> +{
> +  bfd *abfd = objfile->obfd;
> +  if (gdb_bfd_requires_relocations (abfd))
> +    return dwarf2_frame_bfd_data.set (abfd, unit);
> +  return dwarf2_frame_objfile_data.set (objfile, unit);
> +}
> +
>   /* Find the FDE for *PC.  Return a pointer to the FDE, and store the
>      initial location associated with it into *PC.  */
>   
> @@ -1641,11 +1670,11 @@ dwarf2_frame_find_fde (CORE_ADDR *pc, CORE_ADDR *out_offset)
>         CORE_ADDR offset;
>         CORE_ADDR seek_pc;
>   
> -      comp_unit *unit = dwarf2_frame_objfile_data.get (objfile);
> +      comp_unit *unit = find_comp_unit (objfile);
>         if (unit == NULL)
>   	{
>   	  dwarf2_build_frame_info (objfile);
> -	  unit = dwarf2_frame_objfile_data.get (objfile);
> +	  unit = find_comp_unit (objfile);
>   	}
>         gdb_assert (unit != NULL);
>   
> @@ -2261,7 +2290,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
>         unit->fde_table.shrink_to_fit ();
>       }
>   
> -  dwarf2_frame_objfile_data.set (objfile, unit);
> +  set_comp_unit (objfile, unit);
>   }
>   
>   /* Handle 'maintenance show dwarf unwinders'.  */
> 

Otherwise LGTM.


  reply	other threads:[~2020-02-11 10:45 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-08 15:28 [PATCH 0/8] Share DWARF frame information across inferiors Tom Tromey
2020-02-08 15:28 ` [PATCH 1/8] Don't forward-declare struct objfile in frame.h Tom Tromey
2020-02-12  0:51   ` Simon Marchi
2020-02-12  1:59     ` Tom Tromey
2020-02-08 15:28 ` [PATCH 2/8] Dont' allow copying of auto_obstack Tom Tromey
2020-02-09 23:56   ` Christian Biesinger via gdb-patches
2020-02-12  0:16     ` Tom Tromey
2020-02-12  0:53       ` Simon Marchi
2020-02-12  1:01         ` Tom Tromey
2020-02-08 15:28 ` [PATCH 5/8] Add per-unit obstack Tom Tromey
2020-02-11 10:34   ` Luis Machado
2020-02-12  3:53   ` Simon Marchi
2020-02-12 22:41     ` Tom Tromey
2020-02-12 22:48       ` Simon Marchi
2020-02-12 22:51         ` Tom Tromey
2020-02-08 15:28 ` [PATCH 6/8] Remove a use of the comp_unit backlink Tom Tromey
2020-02-08 15:28 ` [PATCH 7/8] Remove the objfile backlink from comp_unit Tom Tromey
2020-02-09 23:56   ` Christian Biesinger via gdb-patches
2020-02-12  0:26     ` Tom Tromey
2020-02-11 10:40   ` Luis Machado
2020-02-08 15:28 ` [PATCH 4/8] Store the comp_unit instead of the FDE table Tom Tromey
2020-02-09 23:56   ` Christian Biesinger via gdb-patches
2020-02-12  0:19     ` Tom Tromey
2020-02-11 10:32   ` Luis Machado
2020-02-12  0:20     ` Tom Tromey
2020-02-12  3:36   ` Simon Marchi
2020-02-12 22:20     ` Tom Tromey
2020-02-08 15:28 ` [PATCH 3/8] Change fde table to a vector Tom Tromey
     [not found]   ` <5a373a74-9283-5d82-a22d-7a2606a4d3f5@linaro.org>
2020-02-12  0:29     ` Tom Tromey
2020-02-12  3:28   ` Simon Marchi
2020-02-12  3:33     ` Simon Marchi
2020-02-12 22:36     ` Tom Tromey
2020-02-12 22:47       ` Simon Marchi
2020-02-08 15:28 ` [PATCH 8/8] Move the frame data to the BFD when possible Tom Tromey
2020-02-11 10:45   ` Luis Machado [this message]
2020-02-12  0:31     ` Tom Tromey
2020-11-14  3:31   ` Simon Marchi
2020-02-08 15:29 ` [PATCH 0/8] Share DWARF frame information across inferiors Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f9d52acf-83b8-c88d-cb66-d8f8d385473d@linaro.org \
    --to=luis.machado@linaro.org \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox