aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2017-02-23 22:54:02 +0100
committerJan Kratochvil <jan.kratochvil@redhat.com>2017-02-23 22:58:45 +0100
commita567769b813b2538bebc97d689fc0739f172028e (patch)
tree3de40ff59ad4fd1304c63e149e7a58fd83c3a82b /binutils
parent2f6cd5918e58572e118b59a26062724404fb4042 (diff)
downloadgdb-a567769b813b2538bebc97d689fc0739f172028e.zip
gdb-a567769b813b2538bebc97d689fc0739f172028e.tar.gz
gdb-a567769b813b2538bebc97d689fc0739f172028e.tar.bz2
DWARF-5: testcase
binutils/ 2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com> * testsuite/binutils-all/dw5.S: New file. * testsuite/binutils-all/dw5.W: New file. * testsuite/binutils-all/readelf.exp (readelf -wiaoRlL): New test.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/testsuite/binutils-all/dw5.S679
-rw-r--r--binutils/testsuite/binutils-all/dw5.W355
-rw-r--r--binutils/testsuite/binutils-all/readelf.exp25
4 files changed, 1065 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 26aa81e..a21e36e 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,11 @@
2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com>
+ * testsuite/binutils-all/dw5.S: New file.
+ * testsuite/binutils-all/dw5.W: New file.
+ * testsuite/binutils-all/readelf.exp (readelf -wiaoRlL): New test.
+
+2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com>
+
* dwarf.c (read_and_display_attr_value): Support DW_FORM_data16.
2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com>
diff --git a/binutils/testsuite/binutils-all/dw5.S b/binutils/testsuite/binutils-all/dw5.S
new file mode 100644
index 0000000..83bb639
--- /dev/null
+++ b/binutils/testsuite/binutils-all/dw5.S
@@ -0,0 +1,679 @@
+/* Copyright (C) 2017 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+ .file "main.c"
+ .text
+.Ltext0:
+ .p2align 4,,15
+ .globl func
+ .type func, %function
+func:
+.LFB0:
+ /* main.c:5 */
+.LM1:
+/* BLOCK 2 freq:10000 seq:0 */
+/* PRED: ENTRY [100.0%] (FALLTHRU) */
+ /* main.c:5 */
+.LM2:
+ .dc.b 0
+/* SUCC: */
+ .dc.b 0
+.LFE0:
+ .size func, .-func
+ .section .text.startup,"ax",%progbits
+ .p2align 4,,15
+ .globl main
+ .type main, %function
+main:
+.LFB1:
+ /* main.c:6 */
+.LM3:
+.LVL0:
+/* BLOCK 2 freq:10000 seq:0 */
+/* PRED: ENTRY [100.0%] (FALLTHRU) */
+ .dc.b 0
+ /* main.c:6 */
+.LM4:
+ .dc.b 0
+.LVL1:
+ .dc.b 0
+.LVL2:
+ .dc.b 0
+/* SUCC: EXIT [100.0%] */
+ .dc.b 0
+.LFE1:
+ .size main, .-main
+ .comm pvar,8,8
+ .comm yvar,4,4
+ .globl xvar
+ .data
+ .align 4
+ .type xvar, %object
+ .size xvar, 4
+xvar:
+ .4byte 42
+ .text
+.Letext0:
+ .section .debug_info,"",%progbits
+.Ldebug_info0:
+ .4byte 0x160 /* Length of Compilation Unit Info */
+ .2byte 0x5 /* DWARF version number */
+ .byte 0x1 /* DW_UT_compile */
+ .byte 0x8 /* Pointer Size (in bytes) */
+ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
+ .uleb128 0x6 /* (DIE (0xc) DW_TAG_compile_unit) */
+ .4byte .LASF21 /* DW_AT_producer: "GNU C11 7.0.1 20170218 (experimental) -mtune=generic -march=x86-64 -gdwarf-5 -O2" */
+ .byte 0x1d /* DW_AT_language */
+ .4byte .LASF0 /* DW_AT_name: "main.c" */
+ .4byte .LASF1 /* DW_AT_comp_dir: "" */
+ .4byte .LLRL2 /* DW_AT_ranges */
+ .8byte 0 /* DW_AT_low_pc */
+ .4byte .Ldebug_line0 /* DW_AT_stmt_list */
+ .uleb128 0x1 /* (DIE (0x2a) DW_TAG_base_type) */
+ .byte 0x1 /* DW_AT_byte_size */
+ .byte 0x8 /* DW_AT_encoding */
+ .4byte .LASF2 /* DW_AT_name: "unsigned char" */
+ .uleb128 0x1 /* (DIE (0x31) DW_TAG_base_type) */
+ .byte 0x2 /* DW_AT_byte_size */
+ .byte 0x7 /* DW_AT_encoding */
+ .4byte .LASF3 /* DW_AT_name: "short unsigned int" */
+ .uleb128 0x1 /* (DIE (0x38) DW_TAG_base_type) */
+ .byte 0x4 /* DW_AT_byte_size */
+ .byte 0x7 /* DW_AT_encoding */
+ .4byte .LASF4 /* DW_AT_name: "unsigned int" */
+ .uleb128 0x1 /* (DIE (0x3f) DW_TAG_base_type) */
+ .byte 0x8 /* DW_AT_byte_size */
+ .byte 0x7 /* DW_AT_encoding */
+ .4byte .LASF5 /* DW_AT_name: "long unsigned int" */
+ .uleb128 0x1 /* (DIE (0x46) DW_TAG_base_type) */
+ .byte 0x1 /* DW_AT_byte_size */
+ .byte 0x6 /* DW_AT_encoding */
+ .4byte .LASF6 /* DW_AT_name: "signed char" */
+ .uleb128 0x1 /* (DIE (0x4d) DW_TAG_base_type) */
+ .byte 0x2 /* DW_AT_byte_size */
+ .byte 0x5 /* DW_AT_encoding */
+ .4byte .LASF7 /* DW_AT_name: "short int" */
+ .uleb128 0x7 /* (DIE (0x54) DW_TAG_base_type) */
+ .byte 0x4 /* DW_AT_byte_size */
+ .byte 0x5 /* DW_AT_encoding */
+ .ascii "int\0" /* DW_AT_name */
+ .uleb128 0x1 /* (DIE (0x5b) DW_TAG_base_type) */
+ .byte 0x8 /* DW_AT_byte_size */
+ .byte 0x5 /* DW_AT_encoding */
+ .4byte .LASF8 /* DW_AT_name: "long int" */
+ .uleb128 0x1 /* (DIE (0x62) DW_TAG_base_type) */
+ .byte 0x8 /* DW_AT_byte_size */
+ .byte 0x7 /* DW_AT_encoding */
+ .4byte .LASF9 /* DW_AT_name: "sizetype" */
+ .uleb128 0x3 /* (DIE (0x69) DW_TAG_pointer_type) */
+ /* DW_AT_byte_size (0x8) */
+ .4byte 0x6e /* DW_AT_type */
+ .uleb128 0x1 /* (DIE (0x6e) DW_TAG_base_type) */
+ .byte 0x1 /* DW_AT_byte_size */
+ .byte 0x6 /* DW_AT_encoding */
+ .4byte .LASF10 /* DW_AT_name: "char" */
+ .uleb128 0x8 /* (DIE (0x75) DW_TAG_variable) */
+ .4byte .LASF11 /* DW_AT_name: "__environ" */
+ .byte 0x2 /* DW_AT_decl_file (/usr/include/unistd.h) */
+ .2byte 0x222 /* DW_AT_decl_line */
+ .4byte 0x81 /* DW_AT_type */
+ /* DW_AT_external */
+ /* DW_AT_declaration */
+ .uleb128 0x3 /* (DIE (0x81) DW_TAG_pointer_type) */
+ /* DW_AT_byte_size (0x8) */
+ .4byte 0x69 /* DW_AT_type */
+ .uleb128 0x2 /* (DIE (0x86) DW_TAG_variable) */
+ .4byte .LASF12 /* DW_AT_name: "optarg" */
+ /* DW_AT_decl_file (3, /usr/include/getopt.h) */
+ .byte 0x39 /* DW_AT_decl_line */
+ .4byte 0x69 /* DW_AT_type */
+ /* DW_AT_external */
+ /* DW_AT_declaration */
+ .uleb128 0x2 /* (DIE (0x90) DW_TAG_variable) */
+ .4byte .LASF13 /* DW_AT_name: "optind" */
+ /* DW_AT_decl_file (3, /usr/include/getopt.h) */
+ .byte 0x47 /* DW_AT_decl_line */
+ .4byte 0x54 /* DW_AT_type */
+ /* DW_AT_external */
+ /* DW_AT_declaration */
+ .uleb128 0x2 /* (DIE (0x9a) DW_TAG_variable) */
+ .4byte .LASF14 /* DW_AT_name: "opterr" */
+ /* DW_AT_decl_file (3, /usr/include/getopt.h) */
+ .byte 0x4c /* DW_AT_decl_line */
+ .4byte 0x54 /* DW_AT_type */
+ /* DW_AT_external */
+ /* DW_AT_declaration */
+ .uleb128 0x2 /* (DIE (0xa4) DW_TAG_variable) */
+ .4byte .LASF15 /* DW_AT_name: "optopt" */
+ /* DW_AT_decl_file (3, /usr/include/getopt.h) */
+ .byte 0x50 /* DW_AT_decl_line */
+ .4byte 0x54 /* DW_AT_type */
+ /* DW_AT_external */
+ /* DW_AT_declaration */
+ .uleb128 0x4 /* (DIE (0xae) DW_TAG_variable) */
+ .4byte .LASF16 /* DW_AT_name: "xvar" */
+ /* DW_AT_decl_file (1, main.c) */
+ .byte 0x2 /* DW_AT_decl_line */
+ .4byte 0x54 /* DW_AT_type */
+ /* DW_AT_external */
+ .uleb128 0x9 /* DW_AT_location */
+ .byte 0x3 /* DW_OP_addr */
+ .8byte 0x1234
+ .uleb128 0x4 /* (DIE (0xc2) DW_TAG_variable) */
+ .4byte .LASF17 /* DW_AT_name: "yvar" */
+ /* DW_AT_decl_file (1, main.c) */
+ .byte 0x3 /* DW_AT_decl_line */
+ .4byte 0x54 /* DW_AT_type */
+ /* DW_AT_external */
+ .uleb128 0x9 /* DW_AT_location */
+ .byte 0x3 /* DW_OP_addr */
+ .8byte 0x1234
+ .uleb128 0x4 /* (DIE (0xd6) DW_TAG_variable) */
+ .4byte .LASF18 /* DW_AT_name: "pvar" */
+ /* DW_AT_decl_file (1, main.c) */
+ .byte 0x4 /* DW_AT_decl_line */
+ .4byte 0xea /* DW_AT_type */
+ /* DW_AT_external */
+ .uleb128 0x9 /* DW_AT_location */
+ .byte 0x3 /* DW_OP_addr */
+ .8byte 0x1234
+ .uleb128 0x3 /* (DIE (0xea) DW_TAG_pointer_type) */
+ /* DW_AT_byte_size (0x8) */
+ .4byte 0x54 /* DW_AT_type */
+ .uleb128 0x9 /* (DIE (0xef) DW_TAG_subprogram) */
+ /* DW_AT_external */
+ .4byte .LASF22 /* DW_AT_name: "main" */
+ .byte 0x1 /* DW_AT_decl_file (main.c) */
+ .byte 0x6 /* DW_AT_decl_line */
+ /* DW_AT_prototyped */
+ .4byte 0x54 /* DW_AT_type */
+ .8byte 0x1234 /* DW_AT_low_pc */
+ .8byte 0x5678 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_AT_frame_base */
+ .byte 0x9c /* DW_OP_call_frame_cfa */
+ /* DW_AT_call_all_calls */
+ .4byte 0x13e /* DW_AT_sibling */
+ .uleb128 0x5 /* (DIE (0x110) DW_TAG_formal_parameter) */
+ .4byte .LASF19 /* DW_AT_name: "argc" */
+ /* DW_AT_decl_file (1, main.c) */
+ /* DW_AT_decl_line (0x6) */
+ .4byte 0x54 /* DW_AT_type */
+ .4byte .LLST0 /* DW_AT_location */
+ .uleb128 0x5 /* (DIE (0x11d) DW_TAG_formal_parameter) */
+ .4byte .LASF20 /* DW_AT_name: "argv" */
+ /* DW_AT_decl_file (1, main.c) */
+ /* DW_AT_decl_line (0x6) */
+ .4byte 0x81 /* DW_AT_type */
+ .4byte .LLST1 /* DW_AT_location */
+ .uleb128 0xa /* (DIE (0x12a) DW_TAG_call_site) */
+ .8byte 0x12345 /* DW_AT_call_return_pc */
+ .4byte 0x157 /* DW_AT_call_origin */
+ .uleb128 0xb /* (DIE (0x137) DW_TAG_call_site_parameter) */
+ .uleb128 0x1 /* DW_AT_location */
+ .byte 0x55 /* DW_OP_reg5 */
+ .uleb128 0x1 /* DW_AT_call_value */
+ .byte 0x30 /* DW_OP_lit0 */
+ .byte 0 /* end of children of DIE 0x12a */
+ .byte 0 /* end of children of DIE 0xef */
+ .uleb128 0xc /* (DIE (0x13e) DW_TAG_subprogram) */
+ /* DW_AT_external */
+ .4byte .LASF23 /* DW_AT_name: "func" */
+ .byte 0x1 /* DW_AT_decl_file (main.c) */
+ .byte 0x5 /* DW_AT_decl_line */
+ /* DW_AT_prototyped */
+ .8byte 0x1234 /* DW_AT_low_pc */
+ .8byte 0x5678 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_AT_frame_base */
+ .byte 0x9c /* DW_OP_call_frame_cfa */
+ /* DW_AT_call_all_calls */
+ .uleb128 0xd /* (DIE (0x157) DW_TAG_subprogram) */
+ /* DW_AT_external */
+ /* DW_AT_declaration */
+ .4byte .LASF24 /* DW_AT_linkage_name: "alarm" */
+ .4byte .LASF24 /* DW_AT_name: "alarm" */
+ .byte 0x2 /* DW_AT_decl_file (/usr/include/unistd.h) */
+ .2byte 0x1b3 /* DW_AT_decl_line */
+ .byte 0 /* end of children of DIE 0xc */
+ .section .debug_abbrev,"",%progbits
+.Ldebug_abbrev0:
+ .uleb128 0x1 /* (abbrev code) */
+ .uleb128 0x24 /* (TAG: DW_TAG_base_type) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0xb /* (DW_AT_byte_size) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3e /* (DW_AT_encoding) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .byte 0
+ .byte 0
+ .uleb128 0x2 /* (abbrev code) */
+ .uleb128 0x34 /* (TAG: DW_TAG_variable) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0x21 /* (DW_FORM_implicit_const) */
+ .sleb128 3 /* (/usr/include/getopt.h) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x3f /* (DW_AT_external) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .uleb128 0x3c /* (DW_AT_declaration) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .byte 0
+ .byte 0
+ .uleb128 0x3 /* (abbrev code) */
+ .uleb128 0xf /* (TAG: DW_TAG_pointer_type) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0xb /* (DW_AT_byte_size) */
+ .uleb128 0x21 /* (DW_FORM_implicit_const) */
+ .sleb128 8
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .byte 0
+ .byte 0
+ .uleb128 0x4 /* (abbrev code) */
+ .uleb128 0x34 /* (TAG: DW_TAG_variable) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0x21 /* (DW_FORM_implicit_const) */
+ .sleb128 1 /* (main.c) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x3f /* (DW_AT_external) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .uleb128 0x2 /* (DW_AT_location) */
+ .uleb128 0x18 /* (DW_FORM_exprloc) */
+ .byte 0
+ .byte 0
+ .uleb128 0x5 /* (abbrev code) */
+ .uleb128 0x5 /* (TAG: DW_TAG_formal_parameter) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0x21 /* (DW_FORM_implicit_const) */
+ .sleb128 1 /* (main.c) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0x21 /* (DW_FORM_implicit_const) */
+ .sleb128 6
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x2 /* (DW_AT_location) */
+ .uleb128 0x17 /* (DW_FORM_sec_offset) */
+ .byte 0
+ .byte 0
+ .uleb128 0x6 /* (abbrev code) */
+ .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x25 /* (DW_AT_producer) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .uleb128 0x13 /* (DW_AT_language) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x1f /* (DW_FORM_line_strp) */
+ .uleb128 0x1b /* (DW_AT_comp_dir) */
+ .uleb128 0x1f /* (DW_FORM_line_strp) */
+ .uleb128 0x55 /* (DW_AT_ranges) */
+ .uleb128 0x17 /* (DW_FORM_sec_offset) */
+ .uleb128 0x11 /* (DW_AT_low_pc) */
+ .uleb128 0x1 /* (DW_FORM_addr) */
+ .uleb128 0x10 /* (DW_AT_stmt_list) */
+ .uleb128 0x17 /* (DW_FORM_sec_offset) */
+ .byte 0
+ .byte 0
+ .uleb128 0x7 /* (abbrev code) */
+ .uleb128 0x24 /* (TAG: DW_TAG_base_type) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0xb /* (DW_AT_byte_size) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3e /* (DW_AT_encoding) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .byte 0
+ .byte 0
+ .uleb128 0x8 /* (abbrev code) */
+ .uleb128 0x34 /* (TAG: DW_TAG_variable) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0x5 /* (DW_FORM_data2) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x3f /* (DW_AT_external) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .uleb128 0x3c /* (DW_AT_declaration) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .byte 0
+ .byte 0
+ .uleb128 0x9 /* (abbrev code) */
+ .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x3f /* (DW_AT_external) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x27 /* (DW_AT_prototyped) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x11 /* (DW_AT_low_pc) */
+ .uleb128 0x1 /* (DW_FORM_addr) */
+ .uleb128 0x12 /* (DW_AT_high_pc) */
+ .uleb128 0x7 /* (DW_FORM_data8) */
+ .uleb128 0x40 /* (DW_AT_frame_base) */
+ .uleb128 0x18 /* (DW_FORM_exprloc) */
+ .uleb128 0x7a /* (DW_AT_call_all_calls) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .uleb128 0x1 /* (DW_AT_sibling) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .byte 0
+ .byte 0
+ .uleb128 0xa /* (abbrev code) */
+ .uleb128 0x48 /* (TAG: DW_TAG_call_site) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x7d /* (DW_AT_call_return_pc) */
+ .uleb128 0x1 /* (DW_FORM_addr) */
+ .uleb128 0x7f /* (DW_AT_call_origin) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .byte 0
+ .byte 0
+ .uleb128 0xb /* (abbrev code) */
+ .uleb128 0x49 /* (TAG: DW_TAG_call_site_parameter) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x2 /* (DW_AT_location) */
+ .uleb128 0x18 /* (DW_FORM_exprloc) */
+ .uleb128 0x7e /* (DW_AT_call_value) */
+ .uleb128 0x18 /* (DW_FORM_exprloc) */
+ .byte 0
+ .byte 0
+ .uleb128 0xc /* (abbrev code) */
+ .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x3f /* (DW_AT_external) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x27 /* (DW_AT_prototyped) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .uleb128 0x11 /* (DW_AT_low_pc) */
+ .uleb128 0x1 /* (DW_FORM_addr) */
+ .uleb128 0x12 /* (DW_AT_high_pc) */
+ .uleb128 0x7 /* (DW_FORM_data8) */
+ .uleb128 0x40 /* (DW_AT_frame_base) */
+ .uleb128 0x18 /* (DW_FORM_exprloc) */
+ .uleb128 0x7a /* (DW_AT_call_all_calls) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .byte 0
+ .byte 0
+ .uleb128 0xd /* (abbrev code) */
+ .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x3f /* (DW_AT_external) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .uleb128 0x3c /* (DW_AT_declaration) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .uleb128 0x6e /* (DW_AT_linkage_name) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0x5 /* (DW_FORM_data2) */
+ .byte 0
+ .byte 0
+ .byte 0
+ .section .debug_loclists,"",%progbits
+ .4byte .Ldebug_loc2-.Ldebug_loc1 /* Length of Location Lists */
+.Ldebug_loc1:
+ .2byte 0x5 /* DWARF Version */
+ .byte 0x8 /* Address Size */
+ .byte 0 /* Segment Size */
+ .4byte 0 /* Offset Entry Count */
+.Ldebug_loc0:
+.LLST0:
+ .byte 0x6 /* DW_LLE_base_address (*.LLST0) */
+ .8byte 0x1234 /* Base address (*.LLST0) */
+ .byte 0x4 /* DW_LLE_offset_pair (*.LLST0) */
+ .uleb128 .LVL0-.LVL0 /* Location list begin address (*.LLST0) */
+ .uleb128 .LVL1-.LVL0 /* Location list end address (*.LLST0) */
+ .uleb128 0x1 /* Location expression size */
+ .byte 0x55 /* DW_OP_reg5 */
+ .byte 0x4 /* DW_LLE_offset_pair (*.LLST0) */
+ .uleb128 .LVL1-.LVL0 /* Location list begin address (*.LLST0) */
+ .uleb128 .LFE1-.LVL0 /* Location list end address (*.LLST0) */
+ .uleb128 0x4 /* Location expression size */
+ .byte 0xa3 /* DW_OP_entry_value */
+ .uleb128 0x1
+ .byte 0x55 /* DW_OP_reg5 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .byte 0 /* DW_LLE_end_of_list (*.LLST0) */
+.LLST1:
+ .byte 0x6 /* DW_LLE_base_address (*.LLST1) */
+ .8byte 0x1234 /* Base address (*.LLST1) */
+ .byte 0x4 /* DW_LLE_offset_pair (*.LLST1) */
+ .uleb128 .LVL0-.LVL0 /* Location list begin address (*.LLST1) */
+ .uleb128 .LVL2-1-.LVL0 /* Location list end address (*.LLST1) */
+ .uleb128 0x1 /* Location expression size */
+ .byte 0x54 /* DW_OP_reg4 */
+ .byte 0x4 /* DW_LLE_offset_pair (*.LLST1) */
+ .uleb128 .LVL2-1-.LVL0 /* Location list begin address (*.LLST1) */
+ .uleb128 .LFE1-.LVL0 /* Location list end address (*.LLST1) */
+ .uleb128 0x4 /* Location expression size */
+ .byte 0xa3 /* DW_OP_entry_value */
+ .uleb128 0x1
+ .byte 0x54 /* DW_OP_reg4 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .byte 0 /* DW_LLE_end_of_list (*.LLST1) */
+.Ldebug_loc2:
+ .section .debug_aranges,"",%progbits
+ .4byte 0x3c /* Length of Address Ranges Info */
+ .2byte 0x2 /* DWARF Version */
+ .4byte .Ldebug_info0 /* Offset of Compilation Unit Info */
+ .byte 0x8 /* Size of Address */
+ .byte 0 /* Size of Segment Descriptor */
+ .2byte 0 /* Pad to 16 byte boundary */
+ .2byte 0
+ .8byte 0x1234 /* Address */
+ .8byte 0x4567 /* Length */
+ .8byte 0x1234 /* Address */
+ .8byte 0x5678 /* Length */
+ .8byte 0
+ .8byte 0
+ .section .debug_rnglists,"",%progbits
+.Ldebug_ranges0:
+ .4byte .Ldebug_ranges3-.Ldebug_ranges2 /* Length of Range Lists */
+.Ldebug_ranges2:
+ .2byte 0x5 /* DWARF Version */
+ .byte 0x8 /* Address Size */
+ .byte 0 /* Segment Size */
+ .4byte 0 /* Offset Entry Count */
+.LLRL2:
+ .byte 0x7 /* DW_RLE_start_length (*.LLRL2) */
+ .8byte 0x1234 /* Range begin address (*.LLRL2) */
+ .uleb128 .Letext0-.Ltext0 /* Range length (*.LLRL2) */
+ .byte 0x7 /* DW_RLE_start_length (*.LLRL2) */
+ .8byte 0x1234 /* Range begin address (*.LLRL2) */
+ .uleb128 .LFE1-.LFB1 /* Range length (*.LLRL2) */
+ .byte 0 /* DW_RLE_end_of_list (*.LLRL2) */
+.Ldebug_ranges3:
+ .section .debug_line,"",%progbits
+.Ldebug_line0:
+ .4byte .LELT0-.LSLT0 /* Length of Source Line Info */
+.LSLT0:
+ .2byte 0x5 /* DWARF Version */
+ .byte 0x8 /* Address Size */
+ .byte 0 /* Segment Size */
+ .4byte .LELTP0-.LASLTP0 /* Prolog Length */
+.LASLTP0:
+ .byte 0x1 /* Minimum Instruction Length */
+ .byte 0x1 /* Maximum Operations Per Instruction */
+ .byte 0x1 /* Default is_stmt_start flag */
+ .byte 0xf6 /* Line Base Value (Special Opcodes) */
+ .byte 0xf2 /* Line Range Value (Special Opcodes) */
+ .byte 0xd /* Special Opcode Base */
+ .byte 0 /* opcode: 0x1 has 0 args */
+ .byte 0x1 /* opcode: 0x2 has 1 args */
+ .byte 0x1 /* opcode: 0x3 has 1 args */
+ .byte 0x1 /* opcode: 0x4 has 1 args */
+ .byte 0x1 /* opcode: 0x5 has 1 args */
+ .byte 0 /* opcode: 0x6 has 0 args */
+ .byte 0 /* opcode: 0x7 has 0 args */
+ .byte 0 /* opcode: 0x8 has 0 args */
+ .byte 0x1 /* opcode: 0x9 has 1 args */
+ .byte 0 /* opcode: 0xa has 0 args */
+ .byte 0 /* opcode: 0xb has 0 args */
+ .byte 0x1 /* opcode: 0xc has 1 args */
+ .byte 0x1 /* Directory entry format count */
+ .uleb128 0x1 /* DW_LNCT_path */
+ .uleb128 0x1f /* DW_FORM_line_strp */
+ .uleb128 0x3 /* Directories count */
+ .4byte .LASF1 /* Directory Entry: 0: "" */
+ .4byte .LASF25 /* Directory Entry: 0: "" */
+ .4byte .LASF26 /* Directory Entry: 0: "/usr/include" */
+ .byte 0x2 /* File name entry format count */
+ .uleb128 0x1 /* DW_LNCT_path */
+ .uleb128 0x1f /* DW_FORM_line_strp */
+ .uleb128 0x2 /* DW_LNCT_directory_index */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x4 /* File names count */
+ .4byte .LASF0 /* File Entry: 0: "main.c" */
+ .byte 0
+ .4byte .LASF27 /* File Entry: 0: "main.c" */
+ .byte 0x1
+ .4byte .LASF28 /* File Entry: 0: "unistd.h" */
+ .byte 0x2
+ .4byte .LASF29 /* File Entry: 0: "getopt.h" */
+ .byte 0x2
+.LELTP0:
+ .byte 0 /* set address *.LM3 */
+ .uleb128 0x9
+ .byte 0x2
+ .8byte 0x1234
+ .byte 0x1c /* line 6 */
+ .byte 0 /* set address *.LM4 */
+ .uleb128 0x9
+ .byte 0x2
+ .8byte 0x12346
+ .byte 0x1 /* copy line 6 */
+ .byte 0 /* set address *.LFE1 */
+ .uleb128 0x9
+ .byte 0x2
+ .8byte 0x1234
+ .byte 0 /* end sequence */
+ .uleb128 0x1
+ .byte 0x1
+ .byte 0 /* set address *.LM1 */
+ .uleb128 0x9
+ .byte 0x2
+ .8byte 0x1234
+ .byte 0x1b /* line 5 */
+ .byte 0 /* set address *.LM2 */
+ .uleb128 0x9
+ .byte 0x2
+ .8byte 0x1234
+ .byte 0x1 /* copy line 5 */
+ .byte 0 /* set address *.Letext0 */
+ .uleb128 0x9
+ .byte 0x2
+ .8byte 0x1234
+ .byte 0 /* end sequence */
+ .uleb128 0x1
+ .byte 0x1
+.LELT0:
+ .section .debug_str,"MS",%progbits,1
+.LASF4:
+ .string "unsigned int"
+.LASF15:
+ .string "optopt"
+.LASF22:
+ .string "main"
+.LASF6:
+ .string "signed char"
+.LASF16:
+ .string "xvar"
+.LASF5:
+ .string "long unsigned int"
+.LASF14:
+ .string "opterr"
+.LASF21:
+ .string "GNU C11 7.0.1 20170218 (experimental) -mtune=generic -march=x86-64 -gdwarf-5 -O2"
+.LASF2:
+ .string "unsigned char"
+.LASF10:
+ .string "char"
+.LASF13:
+ .string "optind"
+.LASF8:
+ .string "long int"
+.LASF19:
+ .string "argc"
+.LASF3:
+ .string "short unsigned int"
+.LASF17:
+ .string "yvar"
+.LASF18:
+ .string "pvar"
+.LASF11:
+ .string "__environ"
+.LASF23:
+ .string "func"
+.LASF12:
+ .string "optarg"
+.LASF7:
+ .string "short int"
+.LASF24:
+ .string "alarm"
+.LASF9:
+ .string "sizetype"
+.LASF20:
+ .string "argv"
+ .section .debug_line_str,"MS",%progbits,1
+.LASF1:
+ .string ""
+.LASF25:
+ .string ""
+.LASF29:
+ .string "getopt.h"
+.LASF28:
+ .string "unistd.h"
+.LASF0:
+ .string "main.c"
+.LASF27:
+ .string "main.c"
+.LASF26:
+ .string "/usr/include"
+ .ident "GCC: (GNU) 7.0.1 20170218 (experimental)"
+ .section .note.GNU-stack,"",%progbits
diff --git a/binutils/testsuite/binutils-all/dw5.W b/binutils/testsuite/binutils-all/dw5.W
new file mode 100644
index 0000000..6f3f8ef
--- /dev/null
+++ b/binutils/testsuite/binutils-all/dw5.W
@@ -0,0 +1,355 @@
+Contents of the .debug_info section:
+
+ Compilation Unit @ offset 0x0:
+ Length: 0x160 \(32-bit\)
+ Version: 5
+ Abbrev Offset: 0x0
+ Pointer Size: 8
+ <0><c>: Abbrev Number: 6 \(DW_TAG_compile_unit\)
+ <d> DW_AT_producer : \(indirect string, offset: 0x43\): GNU C11 7.0.1 20170218 \(experimental\) -mtune=generic -march=x86-64 -gdwarf-5 -O2
+ <11> DW_AT_language : 29 \(C11\)
+ <12> DW_AT_name : \(indirect line string, offset: 0x14\): main.c
+ <16> DW_AT_comp_dir : \(indirect line string, offset: 0x0\):
+ <1a> DW_AT_ranges : 0xc
+ <1e> DW_AT_low_pc : 0x0
+ <26> DW_AT_stmt_list : 0x0
+ <1><2a>: Abbrev Number: 1 \(DW_TAG_base_type\)
+ <2b> DW_AT_byte_size : 1
+ <2c> DW_AT_encoding : 8 \(unsigned char\)
+ <2d> DW_AT_name : \(indirect string, offset: 0x94\): unsigned char
+ <1><31>: Abbrev Number: 1 \(DW_TAG_base_type\)
+ <32> DW_AT_byte_size : 2
+ <33> DW_AT_encoding : 7 \(unsigned\)
+ <34> DW_AT_name : \(indirect string, offset: 0xbc\): short unsigned int
+ <1><38>: Abbrev Number: 1 \(DW_TAG_base_type\)
+ <39> DW_AT_byte_size : 4
+ <3a> DW_AT_encoding : 7 \(unsigned\)
+ <3b> DW_AT_name : \(indirect string, offset: 0x0\): unsigned int
+ <1><3f>: Abbrev Number: 1 \(DW_TAG_base_type\)
+ <40> DW_AT_byte_size : 8
+ <41> DW_AT_encoding : 7 \(unsigned\)
+ <42> DW_AT_name : \(indirect string, offset: 0x2a\): long unsigned int
+ <1><46>: Abbrev Number: 1 \(DW_TAG_base_type\)
+ <47> DW_AT_byte_size : 1
+ <48> DW_AT_encoding : 6 \(signed char\)
+ <49> DW_AT_name : \(indirect string, offset: 0x19\): signed char
+ <1><4d>: Abbrev Number: 1 \(DW_TAG_base_type\)
+ <4e> DW_AT_byte_size : 2
+ <4f> DW_AT_encoding : 5 \(signed\)
+ <50> DW_AT_name : \(indirect string, offset: 0xef\): short int
+ <1><54>: Abbrev Number: 7 \(DW_TAG_base_type\)
+ <55> DW_AT_byte_size : 4
+ <56> DW_AT_encoding : 5 \(signed\)
+ <57> DW_AT_name : int
+ <1><5b>: Abbrev Number: 1 \(DW_TAG_base_type\)
+ <5c> DW_AT_byte_size : 8
+ <5d> DW_AT_encoding : 5 \(signed\)
+ <5e> DW_AT_name : \(indirect string, offset: 0xae\): long int
+ <1><62>: Abbrev Number: 1 \(DW_TAG_base_type\)
+ <63> DW_AT_byte_size : 8
+ <64> DW_AT_encoding : 7 \(unsigned\)
+ <65> DW_AT_name : \(indirect string, offset: 0xff\): sizetype
+ <1><69>: Abbrev Number: 3 \(DW_TAG_pointer_type\)
+ <6a> DW_AT_byte_size : 8
+ <6a> DW_AT_type : <0x6e>
+ <1><6e>: Abbrev Number: 1 \(DW_TAG_base_type\)
+ <6f> DW_AT_byte_size : 1
+ <70> DW_AT_encoding : 6 \(signed char\)
+ <71> DW_AT_name : \(indirect string, offset: 0xa2\): char
+ <1><75>: Abbrev Number: 8 \(DW_TAG_variable\)
+ <76> DW_AT_name : \(indirect string, offset: 0xd9\): __environ
+ <7a> DW_AT_decl_file : 2
+ <7b> DW_AT_decl_line : 546
+ <7d> DW_AT_type : <0x81>
+ <81> DW_AT_external : 1
+ <81> DW_AT_declaration : 1
+ <1><81>: Abbrev Number: 3 \(DW_TAG_pointer_type\)
+ <82> DW_AT_byte_size : 8
+ <82> DW_AT_type : <0x69>
+ <1><86>: Abbrev Number: 2 \(DW_TAG_variable\)
+ <87> DW_AT_name : \(indirect string, offset: 0xe8\): optarg
+ <8b> DW_AT_decl_file : 3
+ <8b> DW_AT_decl_line : 57
+ <8c> DW_AT_type : <0x69>
+ <90> DW_AT_external : 1
+ <90> DW_AT_declaration : 1
+ <1><90>: Abbrev Number: 2 \(DW_TAG_variable\)
+ <91> DW_AT_name : \(indirect string, offset: 0xa7\): optind
+ <95> DW_AT_decl_file : 3
+ <95> DW_AT_decl_line : 71
+ <96> DW_AT_type : <0x54>
+ <9a> DW_AT_external : 1
+ <9a> DW_AT_declaration : 1
+ <1><9a>: Abbrev Number: 2 \(DW_TAG_variable\)
+ <9b> DW_AT_name : \(indirect string, offset: 0x3c\): opterr
+ <9f> DW_AT_decl_file : 3
+ <9f> DW_AT_decl_line : 76
+ <a0> DW_AT_type : <0x54>
+ <a4> DW_AT_external : 1
+ <a4> DW_AT_declaration : 1
+ <1><a4>: Abbrev Number: 2 \(DW_TAG_variable\)
+ <a5> DW_AT_name : \(indirect string, offset: 0xd\): optopt
+ <a9> DW_AT_decl_file : 3
+ <a9> DW_AT_decl_line : 80
+ <aa> DW_AT_type : <0x54>
+ <ae> DW_AT_external : 1
+ <ae> DW_AT_declaration : 1
+ <1><ae>: Abbrev Number: 4 \(DW_TAG_variable\)
+ <af> DW_AT_name : \(indirect string, offset: 0x25\): xvar
+ <b3> DW_AT_decl_file : 1
+ <b3> DW_AT_decl_line : 2
+ <b4> DW_AT_type : <0x54>
+ <b8> DW_AT_external : 1
+ <b8> DW_AT_location : 9 byte block: 3 (0|34) (0|12) 0 0 0 0 (0|12) (0|34) \(DW_OP_addr: 1234\)
+ <1><c2>: Abbrev Number: 4 \(DW_TAG_variable\)
+ <c3> DW_AT_name : \(indirect string, offset: 0xcf\): yvar
+ <c7> DW_AT_decl_file : 1
+ <c7> DW_AT_decl_line : 3
+ <c8> DW_AT_type : <0x54>
+ <cc> DW_AT_external : 1
+ <cc> DW_AT_location : 9 byte block: 3 (0|34) (0|12) 0 0 0 0 (0|12) (0|34) \(DW_OP_addr: 1234\)
+ <1><d6>: Abbrev Number: 4 \(DW_TAG_variable\)
+ <d7> DW_AT_name : \(indirect string, offset: 0xd4\): pvar
+ <db> DW_AT_decl_file : 1
+ <db> DW_AT_decl_line : 4
+ <dc> DW_AT_type : <0xea>
+ <e0> DW_AT_external : 1
+ <e0> DW_AT_location : 9 byte block: 3 (0|34) (0|12) 0 0 0 0 (0|12) (0|34) \(DW_OP_addr: 1234\)
+ <1><ea>: Abbrev Number: 3 \(DW_TAG_pointer_type\)
+ <eb> DW_AT_byte_size : 8
+ <eb> DW_AT_type : <0x54>
+ <1><ef>: Abbrev Number: 9 \(DW_TAG_subprogram\)
+ <f0> DW_AT_external : 1
+ <f0> DW_AT_name : \(indirect string, offset: 0x14\): main
+ <f4> DW_AT_decl_file : 1
+ <f5> DW_AT_decl_line : 6
+ <f6> DW_AT_prototyped : 1
+ <f6> DW_AT_type : <0x54>
+ <fa> DW_AT_low_pc : 0x1234
+ <102> DW_AT_high_pc : 0x5678
+ <10a> DW_AT_frame_base : 1 byte block: 9c \(DW_OP_call_frame_cfa\)
+ <10c> DW_AT_call_all_calls: 1
+ <10c> DW_AT_sibling : <0x13e>
+ <2><110>: Abbrev Number: 5 \(DW_TAG_formal_parameter\)
+ <111> DW_AT_name : \(indirect string, offset: 0xb7\): argc
+ <115> DW_AT_decl_file : 1
+ <115> DW_AT_decl_line : 6
+ <115> DW_AT_type : <0x54>
+ <119> DW_AT_location : 0xc \(location list\)
+ <2><11d>: Abbrev Number: 5 \(DW_TAG_formal_parameter\)
+ <11e> DW_AT_name : \(indirect string, offset: 0x108\): argv
+ <122> DW_AT_decl_file : 1
+ <122> DW_AT_decl_line : 6
+ <122> DW_AT_type : <0x81>
+ <126> DW_AT_location : 0x23 \(location list\)
+ <2><12a>: Abbrev Number: 10 \(DW_TAG_call_site\)
+ <12b> DW_AT_call_return_pc: 0x12345
+ <133> DW_AT_call_origin : <0x157>
+ <3><137>: Abbrev Number: 11 \(DW_TAG_call_site_parameter\)
+ <138> DW_AT_location : 1 byte block: 55 \(DW_OP_reg5 \([^()]*\)\)
+ <13a> DW_AT_call_value : 1 byte block: 30 \(DW_OP_lit0\)
+ <3><13c>: Abbrev Number: 0
+ <2><13d>: Abbrev Number: 0
+ <1><13e>: Abbrev Number: 12 \(DW_TAG_subprogram\)
+ <13f> DW_AT_external : 1
+ <13f> DW_AT_name : \(indirect string, offset: 0xe3\): func
+ <143> DW_AT_decl_file : 1
+ <144> DW_AT_decl_line : 5
+ <145> DW_AT_prototyped : 1
+ <145> DW_AT_low_pc : 0x1234
+ <14d> DW_AT_high_pc : 0x5678
+ <155> DW_AT_frame_base : 1 byte block: 9c \(DW_OP_call_frame_cfa\)
+ <157> DW_AT_call_all_calls: 1
+ <1><157>: Abbrev Number: 13 \(DW_TAG_subprogram\)
+ <158> DW_AT_external : 1
+ <158> DW_AT_declaration : 1
+ <158> DW_AT_linkage_name: \(indirect string, offset: 0xf9\): alarm
+ <15c> DW_AT_name : \(indirect string, offset: 0xf9\): alarm
+ <160> DW_AT_decl_file : 2
+ <161> DW_AT_decl_line : 435
+ <1><163>: Abbrev Number: 0
+
+Contents of the .debug_abbrev section:
+
+ Number TAG \(0x0\)
+ 1 DW_TAG_base_type \[no children\]
+ DW_AT_byte_size DW_FORM_data1
+ DW_AT_encoding DW_FORM_data1
+ DW_AT_name DW_FORM_strp
+ DW_AT value: 0 DW_FORM value: 0
+ 2 DW_TAG_variable \[no children\]
+ DW_AT_name DW_FORM_strp
+ DW_AT_decl_file DW_FORM_implicit_const: 3
+ DW_AT_decl_line DW_FORM_data1
+ DW_AT_type DW_FORM_ref4
+ DW_AT_external DW_FORM_flag_present
+ DW_AT_declaration DW_FORM_flag_present
+ DW_AT value: 0 DW_FORM value: 0
+ 3 DW_TAG_pointer_type \[no children\]
+ DW_AT_byte_size DW_FORM_implicit_const: 8
+ DW_AT_type DW_FORM_ref4
+ DW_AT value: 0 DW_FORM value: 0
+ 4 DW_TAG_variable \[no children\]
+ DW_AT_name DW_FORM_strp
+ DW_AT_decl_file DW_FORM_implicit_const: 1
+ DW_AT_decl_line DW_FORM_data1
+ DW_AT_type DW_FORM_ref4
+ DW_AT_external DW_FORM_flag_present
+ DW_AT_location DW_FORM_exprloc
+ DW_AT value: 0 DW_FORM value: 0
+ 5 DW_TAG_formal_parameter \[no children\]
+ DW_AT_name DW_FORM_strp
+ DW_AT_decl_file DW_FORM_implicit_const: 1
+ DW_AT_decl_line DW_FORM_implicit_const: 6
+ DW_AT_type DW_FORM_ref4
+ DW_AT_location DW_FORM_sec_offset
+ DW_AT value: 0 DW_FORM value: 0
+ 6 DW_TAG_compile_unit \[has children\]
+ DW_AT_producer DW_FORM_strp
+ DW_AT_language DW_FORM_data1
+ DW_AT_name DW_FORM_line_strp
+ DW_AT_comp_dir DW_FORM_line_strp
+ DW_AT_ranges DW_FORM_sec_offset
+ DW_AT_low_pc DW_FORM_addr
+ DW_AT_stmt_list DW_FORM_sec_offset
+ DW_AT value: 0 DW_FORM value: 0
+ 7 DW_TAG_base_type \[no children\]
+ DW_AT_byte_size DW_FORM_data1
+ DW_AT_encoding DW_FORM_data1
+ DW_AT_name DW_FORM_string
+ DW_AT value: 0 DW_FORM value: 0
+ 8 DW_TAG_variable \[no children\]
+ DW_AT_name DW_FORM_strp
+ DW_AT_decl_file DW_FORM_data1
+ DW_AT_decl_line DW_FORM_data2
+ DW_AT_type DW_FORM_ref4
+ DW_AT_external DW_FORM_flag_present
+ DW_AT_declaration DW_FORM_flag_present
+ DW_AT value: 0 DW_FORM value: 0
+ 9 DW_TAG_subprogram \[has children\]
+ DW_AT_external DW_FORM_flag_present
+ DW_AT_name DW_FORM_strp
+ DW_AT_decl_file DW_FORM_data1
+ DW_AT_decl_line DW_FORM_data1
+ DW_AT_prototyped DW_FORM_flag_present
+ DW_AT_type DW_FORM_ref4
+ DW_AT_low_pc DW_FORM_addr
+ DW_AT_high_pc DW_FORM_data8
+ DW_AT_frame_base DW_FORM_exprloc
+ DW_AT_call_all_calls DW_FORM_flag_present
+ DW_AT_sibling DW_FORM_ref4
+ DW_AT value: 0 DW_FORM value: 0
+ 10 DW_TAG_call_site \[has children\]
+ DW_AT_call_return_pc DW_FORM_addr
+ DW_AT_call_origin DW_FORM_ref4
+ DW_AT value: 0 DW_FORM value: 0
+ 11 DW_TAG_call_site_parameter \[no children\]
+ DW_AT_location DW_FORM_exprloc
+ DW_AT_call_value DW_FORM_exprloc
+ DW_AT value: 0 DW_FORM value: 0
+ 12 DW_TAG_subprogram \[no children\]
+ DW_AT_external DW_FORM_flag_present
+ DW_AT_name DW_FORM_strp
+ DW_AT_decl_file DW_FORM_data1
+ DW_AT_decl_line DW_FORM_data1
+ DW_AT_prototyped DW_FORM_flag_present
+ DW_AT_low_pc DW_FORM_addr
+ DW_AT_high_pc DW_FORM_data8
+ DW_AT_frame_base DW_FORM_exprloc
+ DW_AT_call_all_calls DW_FORM_flag_present
+ DW_AT value: 0 DW_FORM value: 0
+ 13 DW_TAG_subprogram \[no children\]
+ DW_AT_external DW_FORM_flag_present
+ DW_AT_declaration DW_FORM_flag_present
+ DW_AT_linkage_name DW_FORM_strp
+ DW_AT_name DW_FORM_strp
+ DW_AT_decl_file DW_FORM_data1
+ DW_AT_decl_line DW_FORM_data2
+ DW_AT value: 0 DW_FORM value: 0
+#...
+Contents of the .debug_loclists section:
+#...
+ Offset Begin End Expression
+ 0000000c 0000000000001234 \(base address\)
+ 00000015 0000000000001234 0000000000001236 \(DW_OP_reg5 \([^()]*\)\)
+ 0000001a 0000000000001236 0000000000001239 \(DW_OP_entry_value: \(DW_OP_reg5 \([^()]*\)\); DW_OP_stack_value\)
+ 00000022 <End of list>
+ 00000023 0000000000001234 \(base address\)
+ 0000002c 0000000000001234 0000000000001236 \(DW_OP_reg4 \([^()]*\)\)
+ 00000031 0000000000001236 0000000000001239 \(DW_OP_entry_value: \(DW_OP_reg4 \([^()]*\)\); DW_OP_stack_value\)
+ 00000039 <End of list>
+
+Contents of the .debug_rnglists section:
+
+ Offset Begin End
+ 0000000c 0000000000001234 0000000000001236
+ 00000016 0000000000001234 0000000000001239
+ 00000020 <End of list>
+
+Raw dump of debug contents of section .debug_line:
+
+ Offset: 0x0
+ Length: 144
+ DWARF Version: 5
+ Prologue Length: 60
+ Minimum Instruction Length: 1
+ Maximum Ops per Instruction: 1
+ Initial value of 'is_stmt': 1
+ Line Base: -10
+ Line Range: 242
+ Opcode Base: 13
+
+ Opcodes:
+ Opcode 1 has 0 args
+ Opcode 2 has 1 args
+ Opcode 3 has 1 args
+ Opcode 4 has 1 args
+ Opcode 5 has 1 args
+ Opcode 6 has 0 args
+ Opcode 7 has 0 args
+ Opcode 8 has 0 args
+ Opcode 9 has 1 args
+ Opcode 10 has 0 args
+ Opcode 11 has 0 args
+ Opcode 12 has 1 args
+
+ The Directory Table \(offset 0x22\):
+ Entry Name
+ 0 \(indirect line string, offset: 0x0\):
+ 1 \(indirect line string, offset: 0x1\):
+ 2 \(indirect line string, offset: 0x22\): /usr/include
+
+ The File name Table \(offset 0x34\):
+ Entry Dir Name
+ 0 0 \(indirect line string, offset: 0x14\): main.c
+ 1 1 \(indirect line string, offset: 0x1b\): main.c
+ 2 2 \(indirect line string, offset: 0xb\): unistd.h
+ 3 2 \(indirect line string, offset: 0x2\): getopt.h
+
+ Line Number Statements:
+ \[0x00000048\] Extended opcode 2: set Address to 0x1234
+ \[0x00000053\] Special opcode 15: advance Address by 0 to 0x1234 and Line by 5 to 6
+ \[0x00000054\] Extended opcode 2: set Address to 0x12346
+ \[0x0000005f\] Copy
+ \[0x00000060\] Extended opcode 2: set Address to 0x1234
+ \[0x0000006b\] Extended opcode 1: End of Sequence
+
+ \[0x0000006e\] Extended opcode 2: set Address to 0x1234
+ \[0x00000079\] Special opcode 14: advance Address by 0 to 0x1234 and Line by 4 to 5
+ \[0x0000007a\] Extended opcode 2: set Address to 0x1234
+ \[0x00000085\] Copy
+ \[0x00000086\] Extended opcode 2: set Address to 0x1234
+ \[0x00000091\] Extended opcode 1: End of Sequence
+
+
+Decoded dump of debug contents of section .debug_line:
+
+CU: ./main.c:
+File name Line number Starting address
+main.c 6 0x1234
+main.c 6 0x12346
+
+main.c 5 0x1234
+main.c 5 0x1234
+
+
diff --git a/binutils/testsuite/binutils-all/readelf.exp b/binutils/testsuite/binutils-all/readelf.exp
index e442bdf..10f2b7a 100644
--- a/binutils/testsuite/binutils-all/readelf.exp
+++ b/binutils/testsuite/binutils-all/readelf.exp
@@ -394,3 +394,28 @@ if {![binutils_assemble $srcdir/$subdir/z.s tmpdir/z.o]} then {
readelf_test {--decompress --hex-dump .debug_loc} $tempfile readelf.z {}
}
+
+# Skip the next test for the RISCV architectures because they do not
+# support .ULEB128 pseudo-ops with non-constant values.
+if ![istarget "riscv*-*-*"] then {
+
+ # Assemble the DWARF-5 test file.
+ if {![binutils_assemble $srcdir/$subdir/dw5.S tmpdir/dw5.o]} then {
+ perror "could not assemble dw5 test file"
+ unresolved "readelf - failed to assemble dw5"
+ return
+ }
+
+ # Download it.
+ if ![is_remote host] {
+ set tempfile tmpdir/dw5.o
+ } else {
+ set tempfile [remote_download host tmpdir/dw5.o]
+ }
+
+ # First, determine the size, so specific output matchers can be used.
+ readelf_find_size $tempfile
+
+ # Make sure that readelf can decode the contents.
+ readelf_test -wiaoRlL $tempfile dw5.W {}
+}