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 7/7] Change dwarf_record_line_1 to be a method
Date: Sun, 07 Sep 2025 13:29:19 -0600	[thread overview]
Message-ID: <20250907-breakpoint-cu-expand-v1-7-dd2beef9d475@tromey.com> (raw)
In-Reply-To: <20250907-breakpoint-cu-expand-v1-0-dd2beef9d475@tromey.com>

This changes dwarf_record_line_1 to be a method of lnp_state_machine,
simplifying it a bit.
---
 gdb/dwarf2/line-program.c | 34 ++++++++++++++--------------------
 1 file changed, 14 insertions(+), 20 deletions(-)

diff --git a/gdb/dwarf2/line-program.c b/gdb/dwarf2/line-program.c
index b6007e368344216af3e09d2651d9483b7d2940e6..48ae4befd5409f11d73a01cbf565b735442ce886 100644
--- a/gdb/dwarf2/line-program.c
+++ b/gdb/dwarf2/line-program.c
@@ -152,6 +152,7 @@ class lnp_state_machine
 
   bool record_line_p ();
   void finish_line ();
+  void record_line_1 (unsigned int line, linetable_entry_flags flags);
 
   struct dwarf2_cu *m_cu;
 
@@ -315,24 +316,22 @@ lnp_state_machine::record_line_p ()
 /* Use the CU's builder to record line number LINE beginning at
    address ADDRESS in the line table of subfile SUBFILE.  */
 
-static void
-dwarf_record_line_1 (struct gdbarch *gdbarch, struct subfile *subfile,
-		     unsigned int line, unrelocated_addr address,
-		     linetable_entry_flags flags,
-		     struct dwarf2_cu *cu)
+void
+lnp_state_machine::record_line_1 (unsigned int line,
+				  linetable_entry_flags flags)
 {
-  unrelocated_addr addr
-    = unrelocated_addr (gdbarch_addr_bits_remove (gdbarch,
-						  (CORE_ADDR) address));
-
-  if (cu != nullptr)
+  if (m_currently_recording_lines)
     {
+      unrelocated_addr addr
+	= unrelocated_addr (gdbarch_addr_bits_remove (m_gdbarch,
+						      (CORE_ADDR) m_address));
+
       if (dwarf_line_debug)
 	gdb_printf (gdb_stdlog, "Recording line %u, file %s, address %s\n",
-		    line, lbasename (subfile->name.c_str ()),
-		    paddress (gdbarch, (CORE_ADDR) address));
+		    m_line, lbasename (m_last_subfile->name.c_str ()),
+		    paddress (m_gdbarch, (CORE_ADDR) addr));
 
-      cu->get_builder ()->record_line (subfile, line, addr, flags);
+      m_builder->record_line (m_last_subfile, line, addr, flags);
     }
 }
 
@@ -354,8 +353,7 @@ lnp_state_machine::finish_line ()
 		  paddress (m_gdbarch, (CORE_ADDR) m_address));
     }
 
-  dwarf_record_line_1 (m_gdbarch, m_last_subfile, 0, m_address, LEF_IS_STMT,
-		       m_currently_recording_lines ? m_cu : nullptr);
+  record_line_1 (0, LEF_IS_STMT);
 }
 
 void
@@ -419,12 +417,8 @@ lnp_state_machine::record_line (bool end_sequence)
 
 	  if (record_line_p ())
 	    {
-	      dwarf_record_line_1 (m_gdbarch,
-				   m_builder->get_current_subfile (),
-				   m_line, m_address, lte_flags,
-				   m_currently_recording_lines ? m_cu : nullptr);
-
 	      m_last_subfile = m_builder->get_current_subfile ();
+	      record_line_1 (m_line, lte_flags);
 	      m_last_line = m_line;
 	    }
 	}

-- 
2.49.0


  parent reply	other threads:[~2025-09-07 19:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-07 19:29 [PATCH 0/7] Shrink dwarf2/read.c and clean up lnp_state_machine Tom Tromey
2025-09-07 19:29 ` [PATCH 1/7] Move lnp_state_machine to new file Tom Tromey
2025-09-08 16:04   ` Simon Marchi
2025-09-09  0:51     ` Tom Tromey
2025-09-09  0:52       ` Simon Marchi
2025-09-09  2:33         ` Eli Zaretskii
2025-09-09 23:25           ` Tom Tromey
2025-09-07 19:29 ` [PATCH 2/7] Move compute_include_file_name earlier Tom Tromey
2025-09-08 16:08   ` Simon Marchi
2025-09-09  0:46     ` Tom Tromey
2025-09-07 19:29 ` [PATCH 3/7] Boolify line-program.c Tom Tromey
2025-09-08 17:07   ` Simon Marchi
2025-09-09  0:48     ` Tom Tromey
2025-09-09  0:50       ` Simon Marchi
2025-09-09  1:11         ` Tom Tromey
2025-09-09 23:55           ` Tom Tromey
2025-09-10  1:51             ` Simon Marchi
2025-09-07 19:29 ` [PATCH 4/7] Change dwarf_record_line_p to be a method Tom Tromey
2025-09-07 19:29 ` [PATCH 5/7] Add m_builder member to lnp_state_machine Tom Tromey
2025-09-08 17:12   ` Simon Marchi
2025-09-07 19:29 ` [PATCH 6/7] Change dwarf_finish_line to be a method Tom Tromey
2025-09-08 17:14   ` Simon Marchi
2025-09-07 19:29 ` Tom Tromey [this message]
2025-09-08 17:17   ` [PATCH 7/7] Change dwarf_record_line_1 " Simon Marchi
2025-09-08 17:18 ` [PATCH 0/7] Shrink dwarf2/read.c and clean up lnp_state_machine Simon Marchi
2025-09-09  0:54   ` 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=20250907-breakpoint-cu-expand-v1-7-dd2beef9d475@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