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);
219 if (
string.has_value () && *
string ==
nullptr)
222 switch (content_type)
225 if (
string.has_value ())
228 case DW_LNCT_directory_index:
229 if (uint.has_value ())
232 case DW_LNCT_timestamp:
233 if (uint.has_value ())
237 if (uint.has_value ())
243 complaint (_(
"Unknown format content type %s"),
244 pulongest (content_type));
261 const char *comp_dir)
263 const gdb_byte *line_ptr;
264 unsigned int bytes_read, offset_size;
266 const char *cur_dir, *cur_file;
272 if (to_underlying (sect_off) + 4 >= section->
size)
280 lh->sect_off = sect_off;
281 lh->offset_in_dwz = is_dwz;
283 line_ptr = section->
buffer + to_underlying (sect_off);
288 &bytes_read, &offset_size);
289 line_ptr += bytes_read;
291 const gdb_byte *start_here = line_ptr;
293 if (line_ptr + unit_length > (section->
buffer + section->
size))
298 lh->statement_program_end = start_here + unit_length;
305 complaint (_(
"unsupported version in .debug_line section"));
308 if (lh->version >= 5)
310 gdb_byte segment_selector_size;
316 segment_selector_size =
read_1_byte (abfd, line_ptr);
318 if (segment_selector_size != 0)
320 complaint (_(
"unsupported segment selector size %u "
321 "in .debug_line section"),
322 segment_selector_size);
327 LONGEST header_length =
read_offset (abfd, line_ptr, offset_size);
328 line_ptr += offset_size;
329 lh->statement_program_start = line_ptr + header_length;
330 lh->minimum_instruction_length =
read_1_byte (abfd, line_ptr);
333 if (lh->version >= 4)
335 lh->maximum_ops_per_instruction =
read_1_byte (abfd, line_ptr);
339 lh->maximum_ops_per_instruction = 1;
341 if (lh->maximum_ops_per_instruction == 0)
343 lh->maximum_ops_per_instruction = 1;
344 complaint (_(
"invalid maximum_ops_per_instruction "
345 "in `.debug_line' section"));
348 lh->default_is_stmt =
read_1_byte (abfd, line_ptr);
356 lh->standard_opcode_lengths.reset (
new unsigned char[lh->opcode_base]);
358 lh->standard_opcode_lengths[0] = 1;
359 for (i = 1; i < lh->opcode_base; ++i)
361 lh->standard_opcode_lengths[i] =
read_1_byte (abfd, line_ptr);
365 if (lh->version >= 5)
374 header->add_include_dir (name);
384 header->add_file_name (name, d_index, mod_time, length);
392 line_ptr += bytes_read;
393 lh->add_include_dir (cur_dir);
395 line_ptr += bytes_read;
403 line_ptr += bytes_read;
405 line_ptr += bytes_read;
407 line_ptr += bytes_read;
409 line_ptr += bytes_read;
413 line_ptr += bytes_read;
416 if (line_ptr > (section->
buffer + section->
size))
417 complaint (_(
"line number info header doesn't "
418 "fit in `.debug_line' section"));
const char * include_dir(const line_header *lh) const