aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2025-09-06 13:12:05 -0600
committerTom Tromey <tom@tromey.com>2025-09-08 18:52:48 -0600
commitaa5f053f971000f8748a2f0f10e89e4020615c9e (patch)
treeee622997475a4988cefbe63f23eabcb3c9f12743 /gdb
parent2b75a49202d60705270722923106a76446b2dc9f (diff)
downloadbinutils-aa5f053f971000f8748a2f0f10e89e4020615c9e.zip
binutils-aa5f053f971000f8748a2f0f10e89e4020615c9e.tar.gz
binutils-aa5f053f971000f8748a2f0f10e89e4020615c9e.tar.bz2
Change dwarf_record_line_p to be a method
This changes dwarf_record_line_p to be a method of lnp_state_machine. This simplifies it, as it can refer to members of the object. Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb')
-rw-r--r--gdb/dwarf2/line-program.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/gdb/dwarf2/line-program.c b/gdb/dwarf2/line-program.c
index 46427b0..ac8b177 100644
--- a/gdb/dwarf2/line-program.c
+++ b/gdb/dwarf2/line-program.c
@@ -150,6 +150,8 @@ private:
m_line_has_non_zero_discriminator = m_discriminator != 0;
}
+ bool record_line_p ();
+
struct dwarf2_cu *m_cu;
gdbarch *m_gdbarch;
@@ -291,20 +293,17 @@ lnp_state_machine::handle_const_add_pc ()
Note: Addresses in the line number state machine can never go backwards
within one sequence, thus this coalescing is ok. */
-static bool
-dwarf_record_line_p (struct dwarf2_cu *cu,
- unsigned int line, unsigned int last_line,
- int line_has_non_zero_discriminator,
- struct subfile *last_subfile)
+bool
+lnp_state_machine::record_line_p ()
{
- if (cu->get_builder ()->get_current_subfile () != last_subfile)
+ if (m_cu->get_builder ()->get_current_subfile () != m_last_subfile)
return true;
- if (line != last_line)
+ if (m_line != m_last_line)
return true;
/* Same line for the same file that we've seen already.
As a last check, for pr 17276, only record the line if the line
has never had a non-zero discriminator. */
- if (!line_has_non_zero_discriminator)
+ if (!m_line_has_non_zero_discriminator)
return true;
return false;
}
@@ -418,9 +417,7 @@ lnp_state_machine::record_line (bool end_sequence)
if (m_cu->producer_is_codewarrior ())
lte_flags |= LEF_IS_STMT;
- if (dwarf_record_line_p (m_cu, m_line, m_last_line,
- m_line_has_non_zero_discriminator,
- m_last_subfile))
+ if (record_line_p ())
{
buildsym_compunit *builder = m_cu->get_builder ();
dwarf_record_line_1 (m_gdbarch,