/* See line-header.h. */
line_header_up
-dwarf_decode_line_header (sect_offset sect_off, bool is_dwz,
+dwarf_decode_line_header (section_and_offset sect_and_offset,
dwarf2_per_objfile *per_objfile,
- struct dwarf2_section_info *section,
const unit_head *cu_header, const char *comp_dir)
{
const gdb_byte *line_ptr;
unsigned int bytes_read, offset_size;
int i;
const char *cur_dir, *cur_file;
+ const dwarf2_section_info *section = sect_and_offset.section;
+ sect_offset sect_off = sect_and_offset.offset;
bfd *abfd = section->get_bfd_owner ();
line_header_up lh (new line_header (comp_dir));
- lh->sect_off = sect_off;
- lh->offset_in_dwz = is_dwz;
-
line_ptr = section->buffer + to_underlying (sect_off);
/* Read in the header. */
#ifndef GDB_DWARF2_LINE_HEADER_H
#define GDB_DWARF2_LINE_HEADER_H
-#include "dwarf2/types.h"
+#include "dwarf2/section.h"
struct dwarf2_per_objfile;
struct dwarf2_cu;
unit in the context of which we are reading this line header, or nullptr
if unknown or not applicable. */
explicit line_header (const char *comp_dir)
- : offset_in_dwz {}, m_comp_dir (comp_dir)
+ : m_comp_dir (comp_dir)
{}
/* This constructor should only be used to create line_header instances to do
hash table lookups. */
- line_header (sect_offset sect_off, bool offset_in_dwz)
- : sect_off (sect_off),
- offset_in_dwz (offset_in_dwz)
+ line_header (section_and_offset sect_and_offset)
+ : sect_and_offset (sect_and_offset)
{}
/* Add an entry to the include directory table. */
const std::vector<file_entry> &file_names () const
{ return m_file_names; }
- /* Offset of line number information in .debug_line section. */
- sect_offset sect_off {};
-
- /* OFFSET is for struct dwz_file associated with dwarf2_per_objfile. */
- unsigned offset_in_dwz : 1; /* Can't initialize bitfields in-class. */
+ /* Section containing this line header, and its offset into that section. */
+ section_and_offset sect_and_offset;
unsigned short version {};
unsigned char minimum_instruction_length {};
return lh->include_dir_at (d_index);
}
-/* Read the statement program header starting at SECT_OFF in SECTION.
+/* Read the statement program header starting at SECT_AND_OFFSET.
Return line_header. Returns nullptr if there is a problem reading
the header, e.g., if it has a version we don't understand.
the returned object point into the dwarf line section buffer,
and must not be freed. */
-extern line_header_up dwarf_decode_line_header
- (sect_offset sect_off, bool is_dwz, dwarf2_per_objfile *per_objfile,
- struct dwarf2_section_info *section, const struct unit_head *cu_header,
- const char *comp_dir);
+extern line_header_up dwarf_decode_line_header (
+ section_and_offset sect_and_offset, dwarf2_per_objfile *per_objfile,
+ const struct unit_head *cu_header, const char *comp_dir);
#endif /* GDB_DWARF2_LINE_HEADER_H */
static hashval_t
line_header_hash (const struct line_header *ofs)
{
- return to_underlying (ofs->sect_off) ^ ofs->offset_in_dwz;
+ return section_and_offset_hash () (ofs->sect_and_offset);
}
/* Hash function for htab_create_alloc_ex for line_header_hash. */
const struct line_header *ofs_lhs = (const struct line_header *) item_lhs;
const struct line_header *ofs_rhs = (const struct line_header *) item_rhs;
- return (ofs_lhs->sect_off == ofs_rhs->sect_off
- && ofs_lhs->offset_in_dwz == ofs_rhs->offset_in_dwz);
+ return section_and_offset_eq () (ofs_lhs->sect_and_offset,
+ ofs_rhs->sect_and_offset);
}
/* See declaration. */
}
void **slot;
- line_header line_header_local (line_offset, cu->per_cu->is_dwz ());
+ line_header line_header_local ({ get_debug_line_section (cu), line_offset });
hashval_t line_header_local_hash = line_header_hash (&line_header_local);
if (per_objfile->line_header_hash != NULL)
{
return 0;
}
- return dwarf_decode_line_header (sect_off, cu->per_cu->is_dwz (),
- per_objfile, section, &cu->header,
- comp_dir);
+ return dwarf_decode_line_header ({ section, sect_off }, per_objfile,
+ &cu->header, comp_dir);
}
static void
gdb::unordered_map<per_cu_and_offset, type *, per_cu_and_offset_hash>
die_type_hash;
- /* Table containing line_header indexed by offset and offset_in_dwz. */
+ /* Table containing line_header indexed by (section, offset-in-section). */
htab_up line_header_hash;
/* The CU containing the m_builder in scope. */