public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [RFC 05/10] Use unrelocated_addr in dwarf_decode_lines
Date: Mon, 24 Apr 2023 10:22:06 -0600	[thread overview]
Message-ID: <20230424162211.682763-6-tromey@adacore.com> (raw)
In-Reply-To: <20230424162211.682763-1-tromey@adacore.com>

This changes dwarf_decode_lines to accept an unrelocated_addr and
fixes up the fallout.
---
 gdb/dwarf2/read.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 39e4f05b389..6b3018831d1 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -809,7 +809,7 @@ static line_header_up dwarf_decode_line_header (sect_offset sect_off,
 
 static void dwarf_decode_lines (struct line_header *,
 				struct dwarf2_cu *,
-				CORE_ADDR, int decode_mapping);
+				unrelocated_addr, int decode_mapping);
 
 static void dwarf2_start_subfile (dwarf2_cu *cu, const file_entry &fe,
 				  const line_header &lh);
@@ -7537,7 +7537,7 @@ find_file_and_directory (struct die_info *die, struct dwarf2_cu *cu)
 
 static void
 handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu,
-			const file_and_directory &fnd, CORE_ADDR lowpc,
+			const file_and_directory &fnd, unrelocated_addr lowpc,
 			bool have_code) /* ARI: editCase function */
 {
   dwarf2_per_objfile *per_objfile = cu->per_objfile;
@@ -7666,7 +7666,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
   /* Decode line number information if present.  We do this before
      processing child DIEs, so that the line header table is available
      for DW_AT_decl_file.  */
-  handle_DW_AT_stmt_list (die, cu, fnd, lowpc, unrel_low != unrel_high);
+  handle_DW_AT_stmt_list (die, cu, fnd, unrel_low, unrel_low != unrel_high);
 
   /* Process all dies in compilation unit.  */
   if (die->child != NULL)
@@ -18455,19 +18455,16 @@ lnp_state_machine::check_line_address (struct dwarf2_cu *cu,
 
 static void
 dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu,
-		      CORE_ADDR lowpc)
+		      unrelocated_addr lowpc)
 {
   const gdb_byte *line_ptr, *extended_end;
   const gdb_byte *line_end;
   unsigned int bytes_read, extended_len;
   unsigned char op_code, extended_op;
-  CORE_ADDR baseaddr;
   struct objfile *objfile = cu->per_objfile->objfile;
   bfd *abfd = objfile->obfd.get ();
   struct gdbarch *gdbarch = objfile->arch ();
 
-  baseaddr = objfile->text_section_offset ();
-
   line_ptr = lh->statement_program_start;
   line_end = lh->statement_program_end;
 
@@ -18525,9 +18522,8 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu,
 		      = cu->header.read_address (abfd, line_ptr, &bytes_read);
 		    line_ptr += bytes_read;
 
-		    state_machine.check_line_address
-		      (cu, line_ptr, (unrelocated_addr) (lowpc - baseaddr),
-		       address);
+		    state_machine.check_line_address (cu, line_ptr, lowpc,
+						      address);
 		    state_machine.handle_set_address (address);
 		  }
 		  break;
@@ -18684,7 +18680,7 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu,
 
 static void
 dwarf_decode_lines (struct line_header *lh, struct dwarf2_cu *cu,
-		    CORE_ADDR lowpc, int decode_mapping)
+		    unrelocated_addr lowpc, int decode_mapping)
 {
   if (decode_mapping)
     dwarf_decode_lines_1 (lh, cu, lowpc);
-- 
2.39.1


  parent reply	other threads:[~2023-04-24 16:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-24 16:22 [RFC 00/10] More use of unrelocated_addr Tom Tromey
2023-04-24 16:22 ` [RFC 01/10] Remove baseaddr parameter from dwarf2_record_block_ranges Tom Tromey
2023-04-24 16:22 ` [RFC 02/10] Minor cleanup in loclist_describe_location Tom Tromey
2023-04-24 16:22 ` [RFC 03/10] Move unrelocated_addr to common-types.h Tom Tromey
2023-04-24 16:22 ` [RFC 04/10] Use unrelocated_addr in the DWARF reader Tom Tromey
2023-04-24 16:22 ` Tom Tromey [this message]
2023-04-24 16:22 ` [RFC 06/10] Fix comment in address_class Tom Tromey
2023-04-24 16:22 ` [RFC 07/10] Use "unrelocated" terminology in linetable_entry Tom Tromey
2023-04-24 16:22 ` [RFC 08/10] Constify dwarf2_cie::augmentation Tom Tromey
2023-04-24 16:22 ` [RFC 09/10] Use local "text offset" variable in dwarf2_frame_cache Tom Tromey
2023-04-24 16:22 ` [RFC 10/10] Use unrelocated_addr in dwarf2_fde Tom Tromey
2023-06-05 16:13 ` [RFC 00/10] More use of unrelocated_addr 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=20230424162211.682763-6-tromey@adacore.com \
    --to=tromey@adacore.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).