Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 6/8] Remove a use of the comp_unit backlink
Date: Sat, 08 Feb 2020 15:28:00 -0000	[thread overview]
Message-ID: <20200208152758.29385-7-tom@tromey.com> (raw)
In-Reply-To: <20200208152758.29385-1-tom@tromey.com>

The DWARF frame comp_unit object still has a backlink to the objfile.
In order to be truly objfile-independent, this must be removed.

This patch removes one such use, by passing the gdbarch to
decode_frame_entry directly.

gdb/ChangeLog
2020-02-08  Tom Tromey  <tom@tromey.com>

	* dwarf2/frame.c (decode_frame_entry_1): Add gdbarch parameter.
	(decode_frame_entry): Likewise.
	(dwarf2_build_frame_info): Update.

Change-Id: I51126a468a012540eaf002be64dba7cbcb111b4d
---
 gdb/ChangeLog      |  6 ++++++
 gdb/dwarf2/frame.c | 21 +++++++++++++--------
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c
index 7e1a744513b..d4f6165b75c 100644
--- a/gdb/dwarf2/frame.c
+++ b/gdb/dwarf2/frame.c
@@ -1695,7 +1695,8 @@ enum eh_frame_type
   EH_CIE_OR_FDE_TYPE_ID = EH_CIE_TYPE_ID | EH_FDE_TYPE_ID
 };
 
-static const gdb_byte *decode_frame_entry (struct comp_unit *unit,
+static const gdb_byte *decode_frame_entry (struct gdbarch *gdbarch,
+					   struct comp_unit *unit,
 					   const gdb_byte *start,
 					   int eh_frame_p,
 					   dwarf2_cie_table &cie_table,
@@ -1706,13 +1707,13 @@ static const gdb_byte *decode_frame_entry (struct comp_unit *unit,
    Return NULL if invalid input, otherwise the next byte to be processed.  */
 
 static const gdb_byte *
-decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start,
+decode_frame_entry_1 (struct gdbarch *gdbarch,
+		      struct comp_unit *unit, const gdb_byte *start,
 		      int eh_frame_p,
                       dwarf2_cie_table &cie_table,
                       dwarf2_fde_table *fde_table,
                       enum eh_frame_type entry_type)
 {
-  struct gdbarch *gdbarch = get_objfile_arch (unit->objfile);
   const gdb_byte *buf, *end;
   ULONGEST length;
   unsigned int bytes_read;
@@ -1957,7 +1958,8 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start,
       fde->cie = find_cie (cie_table, cie_pointer);
       if (fde->cie == NULL)
 	{
-	  decode_frame_entry (unit, unit->dwarf_frame_buffer + cie_pointer,
+	  decode_frame_entry (gdbarch, unit,
+			      unit->dwarf_frame_buffer + cie_pointer,
 			      eh_frame_p, cie_table, fde_table,
 			      EH_CIE_TYPE_ID);
 	  fde->cie = find_cie (cie_table, cie_pointer);
@@ -2008,7 +2010,8 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start,
    expect an FDE or a CIE.  */
 
 static const gdb_byte *
-decode_frame_entry (struct comp_unit *unit, const gdb_byte *start,
+decode_frame_entry (struct gdbarch *gdbarch,
+		    struct comp_unit *unit, const gdb_byte *start,
 		    int eh_frame_p,
 		    dwarf2_cie_table &cie_table,
                     dwarf2_fde_table *fde_table,
@@ -2020,7 +2023,7 @@ decode_frame_entry (struct comp_unit *unit, const gdb_byte *start,
 
   while (1)
     {
-      ret = decode_frame_entry_1 (unit, start, eh_frame_p,
+      ret = decode_frame_entry_1 (gdbarch, unit, start, eh_frame_p,
 				  cie_table, fde_table, entry_type);
       if (ret != NULL)
 	break;
@@ -2127,6 +2130,8 @@ dwarf2_build_frame_info (struct objfile *objfile)
   dwarf2_cie_table cie_table;
   dwarf2_fde_table fde_table;
 
+  struct gdbarch *gdbarch = get_objfile_arch (objfile);
+
   /* Build a minimal decoding of the DWARF2 compilation unit.  */
   unit = new comp_unit;
   unit->abfd = objfile->obfd;
@@ -2162,7 +2167,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
 	    {
 	      frame_ptr = unit->dwarf_frame_buffer;
 	      while (frame_ptr < unit->dwarf_frame_buffer + unit->dwarf_frame_size)
-		frame_ptr = decode_frame_entry (unit, frame_ptr, 1,
+		frame_ptr = decode_frame_entry (gdbarch, unit, frame_ptr, 1,
 						cie_table, &fde_table,
 						EH_CIE_OR_FDE_TYPE_ID);
 	    }
@@ -2192,7 +2197,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
 	{
 	  frame_ptr = unit->dwarf_frame_buffer;
 	  while (frame_ptr < unit->dwarf_frame_buffer + unit->dwarf_frame_size)
-	    frame_ptr = decode_frame_entry (unit, frame_ptr, 0,
+	    frame_ptr = decode_frame_entry (gdbarch, unit, frame_ptr, 0,
 					    cie_table, &fde_table,
 					    EH_CIE_OR_FDE_TYPE_ID);
 	}
-- 
2.17.2


  reply	other threads:[~2020-02-08 15:28 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 ` Tom Tromey [this message]
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 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 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 8/8] Move the frame data to the BFD when possible Tom Tromey
2020-02-11 10:45   ` Luis Machado
2020-02-12  0:31     ` Tom Tromey
2020-11-14  3:31   ` Simon Marchi
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: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=20200208152758.29385-7-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /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