27#include "gdbsupport/pathstuff.h"
40 new_size, include_dir);
65 std::string ret = fe.
name;
67 if (IS_ABSOLUTE_PATH (ret))
72 ret = path_join (dir, ret.c_str ());
74 if (IS_ABSOLUTE_PATH (ret))
86 complaint (_(
"statement list doesn't fit in .debug_line section"));
100 unsigned int *bytes_read,
101 unsigned int *offset_size)
110 complaint (_(
"intermixed 32-bit and 64-bit DWARF sections"));
112 *offset_size = (*bytes_read == 4) ? 4 : 8;
124 unsigned int offset_size,
131 gdb_byte format_count, formati;
132 ULONGEST data_count, datai;
133 const gdb_byte *buf = *bufp;
134 const gdb_byte *format_header_data;
135 unsigned int bytes_read;
139 format_header_data = buf;
140 for (formati = 0; formati < format_count; formati++)
150 for (datai = 0; datai < data_count; datai++)
152 const gdb_byte *format = format_header_data;
155 for (formati = 0; formati < format_count; formati++)
158 format += bytes_read;
161 format += bytes_read;
163 gdb::optional<const char *> string;
164 gdb::optional<unsigned int> uint;
173 case DW_FORM_line_strp:
177 string.emplace (str);
218 switch (content_type)
221 if (
string.has_value ())
224 case DW_LNCT_directory_index:
225 if (uint.has_value ())
228 case DW_LNCT_timestamp:
229 if (uint.has_value ())
233 if (uint.has_value ())
239 complaint (_(
"Unknown format content type %s"),
240 pulongest (content_type));
257 const char *comp_dir)
259 const gdb_byte *line_ptr;
260 unsigned int bytes_read, offset_size;
262 const char *cur_dir, *cur_file;
268 if (to_underlying (sect_off) + 4 >= section->
size)
276 lh->sect_off = sect_off;
277 lh->offset_in_dwz = is_dwz;
279 line_ptr = section->
buffer + to_underlying (sect_off);
284 &bytes_read, &offset_size);
285 line_ptr += bytes_read;
287 const gdb_byte *start_here = line_ptr;
289 if (line_ptr + unit_length > (section->
buffer + section->
size))
294 lh->statement_program_end = start_here + unit_length;
301 complaint (_(
"unsupported version in .debug_line section"));
304 if (lh->version >= 5)
306 gdb_byte segment_selector_size;
312 segment_selector_size =
read_1_byte (abfd, line_ptr);
314 if (segment_selector_size != 0)
316 complaint (_(
"unsupported segment selector size %u "
317 "in .debug_line section"),
318 segment_selector_size);
323 LONGEST header_length =
read_offset (abfd, line_ptr, offset_size);
324 line_ptr += offset_size;
325 lh->statement_program_start = line_ptr + header_length;
326 lh->minimum_instruction_length =
read_1_byte (abfd, line_ptr);
329 if (lh->version >= 4)
331 lh->maximum_ops_per_instruction =
read_1_byte (abfd, line_ptr);
335 lh->maximum_ops_per_instruction = 1;
337 if (lh->maximum_ops_per_instruction == 0)
339 lh->maximum_ops_per_instruction = 1;
340 complaint (_(
"invalid maximum_ops_per_instruction "
341 "in `.debug_line' section"));
344 lh->default_is_stmt =
read_1_byte (abfd, line_ptr);
352 lh->standard_opcode_lengths.reset (
new unsigned char[lh->opcode_base]);
354 lh->standard_opcode_lengths[0] = 1;
355 for (i = 1; i < lh->opcode_base; ++i)
357 lh->standard_opcode_lengths[i] =
read_1_byte (abfd, line_ptr);
361 if (lh->version >= 5)
370 header->add_include_dir (name);
380 header->add_file_name (name, d_index, mod_time, length);
388 line_ptr += bytes_read;
389 lh->add_include_dir (cur_dir);
391 line_ptr += bytes_read;
399 line_ptr += bytes_read;
401 line_ptr += bytes_read;
403 line_ptr += bytes_read;
405 line_ptr += bytes_read;
409 line_ptr += bytes_read;
412 if (line_ptr > (section->
buffer + section->
size))
413 complaint (_(
"line number info header doesn't "
414 "fit in `.debug_line' section"));
#define complaint(FMT,...)
LONGEST read_initial_length(bfd *abfd, const gdb_byte *buf, unsigned int *bytes_read, bool handle_nonstd)
ULONGEST read_unsigned_leb128(bfd *abfd, const gdb_byte *buf, unsigned int *bytes_read_ptr)
LONGEST read_offset(bfd *abfd, const gdb_byte *buf, unsigned int offset_size)
static unsigned int read_4_bytes(bfd *abfd, const gdb_byte *buf)
static const char * read_direct_string(bfd *abfd, const gdb_byte *buf, unsigned int *bytes_read_ptr)
static unsigned int read_1_byte(bfd *abfd, const gdb_byte *buf)
static int read_1_signed_byte(bfd *abfd, const gdb_byte *buf)
static unsigned int read_2_bytes(bfd *abfd, const gdb_byte *buf)
static ULONGEST read_8_bytes(bfd *abfd, const gdb_byte *buf)
unsigned int dwarf_line_debug
unsigned int initial_length_size
const char * read_line_string(const gdb_byte *buf, const struct comp_unit_head *cu_header, unsigned int *bytes_read_ptr)
struct bfd * get_bfd_owner() const
const char * include_dir(const line_header *lh) const
void gdb_printf(struct ui_file *stream, const char *format,...)