public:
/* Initialize a machine state for the start of a line number
program. */
- lnp_state_machine (struct dwarf2_cu *cu, gdbarch *arch, line_header *lh);
+ lnp_state_machine (struct dwarf2_cu *cu, gdbarch *arch);
file_entry *current_file ()
{
/* lh->file_names is 0-based, but the file name numbers in the
statement program are 1-based. */
- return m_line_header->file_name_at (m_file);
+ return m_cu->line_header->file_name_at (m_file);
}
/* Record the line in the state machine. END_SEQUENCE is true if
gdbarch *m_gdbarch;
- /* The line number header. */
- line_header *m_line_header;
-
/* These are part of the standard DWARF line number state machine,
and initialized according to the DWARF spec. */
lnp_state_machine::handle_advance_pc (CORE_ADDR adjust)
{
CORE_ADDR addr_adj = (((m_op_index + adjust)
- / m_line_header->maximum_ops_per_instruction)
- * m_line_header->minimum_instruction_length);
+ / m_cu->line_header->maximum_ops_per_instruction)
+ * m_cu->line_header->minimum_instruction_length);
addr_adj = gdbarch_adjust_dwarf2_line (m_gdbarch, addr_adj, true);
m_address = (unrelocated_addr) ((CORE_ADDR) m_address + addr_adj);
m_op_index = ((m_op_index + adjust)
- % m_line_header->maximum_ops_per_instruction);
+ % m_cu->line_header->maximum_ops_per_instruction);
}
void
lnp_state_machine::handle_special_opcode (unsigned char op_code)
{
- unsigned char adj_opcode = op_code - m_line_header->opcode_base;
- unsigned char adj_opcode_d = adj_opcode / m_line_header->line_range;
- unsigned char adj_opcode_r = adj_opcode % m_line_header->line_range;
+ unsigned char adj_opcode = op_code - m_cu->line_header->opcode_base;
+ unsigned char adj_opcode_d = adj_opcode / m_cu->line_header->line_range;
+ unsigned char adj_opcode_r = adj_opcode % m_cu->line_header->line_range;
CORE_ADDR addr_adj = (((m_op_index + adj_opcode_d)
- / m_line_header->maximum_ops_per_instruction)
- * m_line_header->minimum_instruction_length);
+ / m_cu->line_header->maximum_ops_per_instruction)
+ * m_cu->line_header->minimum_instruction_length);
addr_adj = gdbarch_adjust_dwarf2_line (m_gdbarch, addr_adj, true);
m_address = (unrelocated_addr) ((CORE_ADDR) m_address + addr_adj);
m_op_index = ((m_op_index + adj_opcode_d)
- % m_line_header->maximum_ops_per_instruction);
+ % m_cu->line_header->maximum_ops_per_instruction);
- int line_delta = m_line_header->line_base + adj_opcode_r;
+ int line_delta = m_cu->line_header->line_base + adj_opcode_r;
advance_line (line_delta);
record_line (false);
m_discriminator = 0;
else
{
m_line_has_non_zero_discriminator = m_discriminator != 0;
- dwarf2_start_subfile (m_cu, *fe, *m_line_header);
+ dwarf2_start_subfile (m_cu, *fe, *m_cu->line_header);
}
}
lnp_state_machine::handle_const_add_pc ()
{
CORE_ADDR adjust
- = (255 - m_line_header->opcode_base) / m_line_header->line_range;
+ = (255 - m_cu->line_header->opcode_base) / m_cu->line_header->line_range;
CORE_ADDR addr_adj
= (((m_op_index + adjust)
- / m_line_header->maximum_ops_per_instruction)
- * m_line_header->minimum_instruction_length);
+ / m_cu->line_header->maximum_ops_per_instruction)
+ * m_cu->line_header->minimum_instruction_length);
addr_adj = gdbarch_adjust_dwarf2_line (m_gdbarch, addr_adj, true);
m_address = (unrelocated_addr) ((CORE_ADDR) m_address + addr_adj);
m_op_index = ((m_op_index + adjust)
- % m_line_header->maximum_ops_per_instruction);
+ % m_cu->line_header->maximum_ops_per_instruction);
}
/* Return true if we should add LINE to the line number table.
m_stmt_at_address |= (m_flags & LEF_IS_STMT) != 0;
}
-lnp_state_machine::lnp_state_machine (struct dwarf2_cu *cu, gdbarch *arch,
- line_header *lh)
+lnp_state_machine::lnp_state_machine (struct dwarf2_cu *cu, gdbarch *arch)
: m_cu (cu),
m_builder (cu->get_builder ()),
m_gdbarch (arch),
- m_line_header (lh),
/* Call `gdbarch_adjust_dwarf2_line' on the initial 0 address as
if there was a line entry for it so that the backend has a
chance to adjust it and also record it in case it needs it.
This is currently used by MIPS code,
cf. `mips_adjust_dwarf2_line'. */
m_address ((unrelocated_addr) gdbarch_adjust_dwarf2_line (arch, 0, 0)),
- m_flags (lh->default_is_stmt ? LEF_IS_STMT : (linetable_entry_flags) 0),
+ m_flags (m_cu->line_header->default_is_stmt
+ ? LEF_IS_STMT : (linetable_entry_flags) 0),
m_last_address (m_address)
{
}
{
/* The DWARF line number program state machine. Reset the state
machine at the start of each sequence. */
- lnp_state_machine state_machine (cu, gdbarch, lh);
+ lnp_state_machine state_machine (cu, gdbarch);
bool end_sequence = false;
/* Start a subfile for the current file of the state