From: Cary Coutant Date: Fri, 23 Jan 2015 21:51:56 +0000 (-0800) Subject: Add address_size and segment_size to line number program header version 5. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=285d7b5c33ce02896479c51adc43bf038698a502;p=thirdparty%2Fbinutils-gdb.git Add address_size and segment_size to line number program header version 5. 2015-01-23 Cary Coutant binutils/ * dwarf.h (struct DWARF2_Internal_LineInfo): Add li_address_size and li_segment_size. * dwarf.c (read_debug_line_header): Read li_address_size and li_segment_size. (display_debug_lines_raw): Print li_address_size and li_segment_size. --- diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 7e1650fcc7a..8d8664bd1f0 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -2820,6 +2820,17 @@ read_debug_line_header (struct dwarf_section * section, return NULL; } + if (linfo->li_version < 5) + { + linfo->li_address_size = 0; + linfo->li_segment_size = 0; + } + else + { + SAFE_BYTE_GET_AND_INC (linfo->li_address_size, hdrptr, 1, end); + SAFE_BYTE_GET_AND_INC (linfo->li_segment_size, hdrptr, 1, end); + } + SAFE_BYTE_GET_AND_INC (linfo->li_prologue_length, hdrptr, offset_size, end); if (linfo->li_version != DWARF2_LINE_EXPERIMENTAL_VERSION) @@ -3381,6 +3392,11 @@ display_debug_lines_raw (struct dwarf_section *section, printf (_(" Offset: 0x%lx\n"), (long)(data - start)); printf (_(" Length: %ld\n"), (long) linfo.li_length); printf (_(" DWARF Version: %d\n"), linfo.li_version); + if (linfo.li_version >= 5) + { + printf (_(" Address Size: %u\n"), linfo.li_address_size); + printf (_(" Segment Size: %u\n"), linfo.li_segment_size); + } printf (_(" Prologue Length: %d\n"), linfo.li_prologue_length); if (linfo.li_version == DWARF2_LINE_EXPERIMENTAL_VERSION) printf (_(" Actuals Table Offset: 0x%x\n"), linfo.li_actuals_table_offset); @@ -3393,6 +3409,8 @@ display_debug_lines_raw (struct dwarf_section *section, printf (_(" Opcode Base: %d\n"), linfo.li_opcode_base); end_of_header_length = data + initial_length_size + 2 + offset_size; + if (linfo.li_version >= 5) + end_of_header_length += 2; start_of_line_program = end_of_header_length + linfo.li_prologue_length; if (linfo.li_version == DWARF2_LINE_EXPERIMENTAL_VERSION && linfo.li_actuals_table_offset > 0) diff --git a/binutils/dwarf.h b/binutils/dwarf.h index 9c7c59c384e..55cfbfed373 100644 --- a/binutils/dwarf.h +++ b/binutils/dwarf.h @@ -40,6 +40,8 @@ typedef struct { dwarf_vma li_length; unsigned short li_version; + unsigned char li_address_size; + unsigned char li_segment_size; unsigned int li_prologue_length; unsigned int li_actuals_table_offset; unsigned char li_min_insn_length;