aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2010-07-05 15:07:20 +0000
committerH.J. Lu <hjl.tools@gmail.com>2010-07-05 15:07:20 +0000
commitdf1c40a732c509d6729b2874d7e08987b7815490 (patch)
treeefa004eff372ae9b16ed80de22e5ed266991a72a /gas
parent5b9144488e69022bcaba2ed410ac777ed22272c2 (diff)
downloadgdb-df1c40a732c509d6729b2874d7e08987b7815490.zip
gdb-df1c40a732c509d6729b2874d7e08987b7815490.tar.gz
gdb-df1c40a732c509d6729b2874d7e08987b7815490.tar.bz2
Don't generate .debug_line section if it isn't empty.
binutils/testsuite/ 2010-07-05 H.J. Lu <hongjiu.lu@intel.com> PR gas/10531 PR gas/11789 * binutils-all/objdump.W: Remove bogus line debug info. gas/ 2010-07-05 Jim Wilson <wilson@codesourcery.com> PR gas/10531 PR gas/11789 * dwarf2dbg.c (dwarf2_finish): Don't generate .debug_line section if it isn't empty. gas/testsuite/ 2010-07-05 H.J. Lu <hongjiu.lu@intel.com> PR gas/10531 PR gas/11789 * gas/i386/dw2-compress-1.d: Remove bogus line debug info. * gas/elf/dwarf2-1.d: New. * gas/elf/dwarf2-1.s: Likewise. * gas/elf/dwarf2-2.d: Likewise. * gas/elf/dwarf2-2.s: Likewise. * gas/elf/dwarf2-3.d: Likewise. * gas/elf/dwarf2-3.s: Likewise. * gas/i386/debug1.d: Likewise. * gas/i386/debug1.s: Likewise. * gas/elf/elf.exp: Run dwarf2-1, dwarf2-2 and dwarf2-3. * gas/i386/i386.exp: Run debug1 for both 32bit and 64bit.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog7
-rw-r--r--gas/dwarf2dbg.c28
-rw-r--r--gas/testsuite/ChangeLog19
-rw-r--r--gas/testsuite/gas/elf/dwarf2-1.d100
-rw-r--r--gas/testsuite/gas/elf/dwarf2-1.s219
-rw-r--r--gas/testsuite/gas/elf/dwarf2-2.d100
-rw-r--r--gas/testsuite/gas/elf/dwarf2-2.s219
-rw-r--r--gas/testsuite/gas/elf/dwarf2-3.d38
-rw-r--r--gas/testsuite/gas/elf/dwarf2-3.s186
-rw-r--r--gas/testsuite/gas/elf/elf.exp3
-rw-r--r--gas/testsuite/gas/i386/debug1.d46
-rw-r--r--gas/testsuite/gas/i386/debug1.s5
-rw-r--r--gas/testsuite/gas/i386/dw2-compress-1.d30
-rw-r--r--gas/testsuite/gas/i386/i386.exp2
14 files changed, 964 insertions, 38 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 0f90c4b..b02f315 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,10 @@
+2010-07-05 Jim Wilson <wilson@codesourcery.com>
+
+ PR gas/10531
+ PR gas/11789
+ * dwarf2dbg.c (dwarf2_finish): Don't generate .debug_line section
+ if it isn't empty.
+
2010-07-05 Alan Modra <amodra@gmail.com>
* config/tc-moxie.c (md_apply_fix): Delete set but otherwise
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index 4061c72..85c1f30 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -1718,11 +1718,12 @@ dwarf2_init (void)
/* Finish the dwarf2 debug sections. We emit .debug.line if there
were any .file/.loc directives, or --gdwarf2 was given, or if the
- file has a non-empty .debug_info section. If we emit .debug_line,
- and the .debug_info section is empty, we also emit .debug_info,
- .debug_aranges and .debug_abbrev. ALL_SEGS will be non-null if
- there were any .file/.loc directives, or --gdwarf2 was given and
- there were any located instructions emitted. */
+ file has a non-empty .debug_info section and an empty .debug_line
+ section. If we emit .debug_line, and the .debug_info section is
+ empty, we also emit .debug_info, .debug_aranges and .debug_abbrev.
+ ALL_SEGS will be non-null if there were any .file/.loc directives,
+ or --gdwarf2 was given and there were any located instructions
+ emitted. */
void
dwarf2_finish (void)
@@ -1731,13 +1732,24 @@ dwarf2_finish (void)
struct line_seg *s;
segT info_seg;
int emit_other_sections = 0;
+ int empty_debug_line = 0;
info_seg = bfd_get_section_by_name (stdoutput, ".debug_info");
emit_other_sections = info_seg == NULL || !seg_not_empty_p (info_seg);
- if (!all_segs && emit_other_sections)
- /* There is no line information and no non-empty .debug_info
- section. */
+ line_seg = bfd_get_section_by_name (stdoutput, ".debug_line");
+ empty_debug_line = line_seg == NULL || !seg_not_empty_p (line_seg);
+
+ /* We can't construct a new debug_line section if we already have one.
+ Give an error. */
+ if (all_segs && !empty_debug_line)
+ as_fatal ("duplicate .debug_line sections");
+
+ if ((!all_segs && emit_other_sections)
+ || (!emit_other_sections && !empty_debug_line))
+ /* If there is no line information and no non-empty .debug_info
+ section, or if there is both a non-empty .debug_info and a non-empty
+ .debug_line, then we do nothing. */
return;
/* Calculate the size of an address for the target machine. */
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index f518b76..fbe6d72 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,22 @@
+2010-07-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gas/10531
+ PR gas/11789
+ * gas/i386/dw2-compress-1.d: Remove bogus line debug info.
+
+ * gas/elf/dwarf2-1.d: New.
+ * gas/elf/dwarf2-1.s: Likewise.
+ * gas/elf/dwarf2-2.d: Likewise.
+ * gas/elf/dwarf2-2.s: Likewise.
+ * gas/elf/dwarf2-3.d: Likewise.
+ * gas/elf/dwarf2-3.s: Likewise.
+ * gas/i386/debug1.d: Likewise.
+ * gas/i386/debug1.s: Likewise.
+
+ * gas/elf/elf.exp: Run dwarf2-1, dwarf2-2 and dwarf2-3.
+
+ * gas/i386/i386.exp: Run debug1 for both 32bit and 64bit.
+
2010-07-04 H.J. Lu <hongjiu.lu@intel.com>
* gas/i386/dw2-compress-1.d: New.
diff --git a/gas/testsuite/gas/elf/dwarf2-1.d b/gas/testsuite/gas/elf/dwarf2-1.d
new file mode 100644
index 0000000..f09d230
--- /dev/null
+++ b/gas/testsuite/gas/elf/dwarf2-1.d
@@ -0,0 +1,100 @@
+#readelf: -w
+#name: DWARF2 1
+#not-target: ia64-*-*
+
+Contents of the .debug_info section:
+
+ Compilation Unit @ offset 0x0:
+ Length: 0x4e \(32-bit\)
+ Version: 2
+ Abbrev Offset: 0
+ Pointer Size: 4
+ <0><b>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
+ < c> DW_AT_stmt_list : 0x0
+ <10> DW_AT_high_pc : 0x.
+ <14> DW_AT_low_pc : 0x.
+ <18> DW_AT_name : file1.txt
+ <22> DW_AT_producer : GNU C 3.3.3
+ <2e> DW_AT_language : 1 \(ANSI C\)
+ <1><2f>: Abbrev Number: 2 \(DW_TAG_subprogram\)
+ <30> DW_AT_external : 1
+ <31> DW_AT_decl_file : 1
+ <32> DW_AT_decl_line : 2
+ <33> DW_AT_name : func_cu1
+ <3c> DW_AT_type : <0x4a>
+ <40> DW_AT_low_pc : 0x.
+ <44> DW_AT_high_pc : 0x.
+ <48> DW_AT_frame_base : 1 byte block: 55 \(DW_OP_reg5\)
+ <1><4a>: Abbrev Number: 3 \(DW_TAG_base_type\)
+ <4b> DW_AT_name : int
+ <4f> DW_AT_byte_size : 4
+ <50> DW_AT_encoding : 5 \(signed\)
+
+Raw dump of debug contents of section .debug_line:
+
+ Offset: 0x0
+ Length: 62
+ DWARF Version: 2
+ Prologue Length: 35
+ Minimum Instruction Length: 1
+ Initial value of 'is_stmt': 1
+ Line Base: 1
+ Line Range: 1
+ Opcode Base: 16
+
+ 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
+ Opcode 13 has 0 args
+ Opcode 14 has 0 args
+ Opcode 15 has 0 args
+
+ The Directory Table is empty.
+
+ The File Name Table:
+ Entry Dir Time Size Name
+ 1 0 0 0 file1.txt
+
+ Line Number Statements:
+ Extended opcode 2: set Address to .*
+ Advance Line by 3 to 4
+ Copy
+ Copy
+ Extended opcode 2: set Address to .*
+ Extended opcode 1: End of Sequence
+
+
+Contents of the .zdebug_abbrev section:
+
+ Number TAG
+ 1 DW_TAG_compile_unit \[has children\]
+ DW_AT_stmt_list DW_FORM_data4
+ DW_AT_high_pc DW_FORM_addr
+ DW_AT_low_pc DW_FORM_addr
+ DW_AT_name DW_FORM_string
+ DW_AT_producer DW_FORM_string
+ DW_AT_language DW_FORM_data1
+ 2 DW_TAG_subprogram \[no children\]
+ DW_AT_external DW_FORM_flag
+ DW_AT_decl_file DW_FORM_data1
+ DW_AT_decl_line DW_FORM_data1
+ DW_AT_name DW_FORM_string
+ DW_AT_type DW_FORM_ref4
+ DW_AT_low_pc DW_FORM_addr
+ DW_AT_high_pc DW_FORM_addr
+ DW_AT_frame_base DW_FORM_block1
+ 3 DW_TAG_base_type \[no children\]
+ DW_AT_name DW_FORM_string
+ DW_AT_byte_size DW_FORM_data1
+ DW_AT_encoding DW_FORM_data1
+
diff --git a/gas/testsuite/gas/elf/dwarf2-1.s b/gas/testsuite/gas/elf/dwarf2-1.s
new file mode 100644
index 0000000..0310079
--- /dev/null
+++ b/gas/testsuite/gas/elf/dwarf2-1.s
@@ -0,0 +1,219 @@
+/* This testcase is derived from a similar test in GDB.
+
+ Copyright 2009 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/>. */
+
+/* This tests that gdb can read compressed sections. The contents
+ are a basic assembly file, but the .debug_abbrev section has been
+ comrpessed using zlib. */
+
+/* Dummy function to provide debug information for. */
+
+ .file "dwarf2-1.c"
+ .text
+ .globl _start
+_start:
+ .int 0
+.Lbegin_text1:
+ .globl func_cu1
+ .type func_cu1, %function
+func_cu1:
+.Lbegin_func_cu1:
+ .int 0
+.Lend_func_cu1:
+ .size func_cu1, .-func_cu1
+.Lend_text1:
+
+/* Debug information */
+
+ .section .debug_info
+.Lcu1_begin:
+ /* CU header */
+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
+.Lcu1_start:
+ .2byte 2 /* DWARF Version */
+ .4byte .Labbrev1_begin /* Offset into abbrev section */
+ .byte 4 /* Pointer size */
+
+ /* CU die */
+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
+ .4byte .Lline1_begin /* DW_AT_stmt_list */
+ .4byte .Lend_text1 /* DW_AT_high_pc */
+ .4byte .Lbegin_text1 /* DW_AT_low_pc */
+ .ascii "file1.txt\0" /* DW_AT_name */
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
+ .byte 1 /* DW_AT_language (C) */
+
+ /* func_cu1 */
+ .uleb128 2 /* Abbrev: DW_TAG_subprogram */
+ .byte 1 /* DW_AT_external */
+ .byte 1 /* DW_AT_decl_file */
+ .byte 2 /* DW_AT_decl_line */
+ .ascii "func_cu1\0" /* DW_AT_name */
+ .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
+ .4byte .Lbegin_func_cu1 /* DW_AT_low_pc */
+ .4byte .Lend_func_cu1 /* DW_AT_high_pc */
+ .byte 1 /* DW_AT_frame_base: length */
+ .byte 0x55 /* DW_AT_frame_base: DW_OP_reg5 */
+
+.Ltype_int:
+ .uleb128 3 /* Abbrev: DW_TAG_base_type */
+ .ascii "int\0" /* DW_AT_name */
+ .byte 4 /* DW_AT_byte_size */
+ .byte 5 /* DW_AT_encoding */
+
+ .byte 0 /* End of children of CU */
+
+.Lcu1_end:
+
+/* Line table */
+ .section .debug_line
+.Lline1_begin:
+ .4byte .Lline1_end - .Lline1_start /* Initial length */
+.Lline1_start:
+ .2byte 2 /* Version */
+ .4byte .Lline1_lines - .Lline1_hdr /* header_length */
+.Lline1_hdr:
+ .byte 1 /* Minimum insn length */
+ .byte 1 /* default_is_stmt */
+ .byte 1 /* line_base */
+ .byte 1 /* line_range */
+ .byte 0x10 /* opcode_base */
+
+ /* Standard lengths */
+ .byte 0
+ .byte 1
+ .byte 1
+ .byte 1
+ .byte 1
+ .byte 0
+ .byte 0
+ .byte 0
+ .byte 1
+ .byte 0
+ .byte 0
+ .byte 1
+ .byte 0
+ .byte 0
+ .byte 0
+
+ /* Include directories */
+ .byte 0
+
+ /* File names */
+ .ascii "file1.txt\0"
+ .uleb128 0
+ .uleb128 0
+ .uleb128 0
+
+ .byte 0
+
+.Lline1_lines:
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ .4byte .Lbegin_func_cu1
+
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 3 /* ... to 4 */
+
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 1 /* DW_LNS_copy (second time as an end-of-prologue marker) */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ .4byte .Lend_func_cu1
+
+ .byte 0 /* DW_LNE_end_of_sequence */
+ .uleb128 1
+ .byte 1
+
+.Lline1_end:
+
+/* Abbrev table -- compressed */
+ .section .zdebug_abbrev
+.Labbrev1_begin:
+ .ascii "ZLIB"
+ .4byte 0
+ .2byte 0
+ .byte 0
+ .byte 51
+ .byte 0x78
+ .byte 0x5e
+ .byte 0x63
+ .byte 0x14
+ .byte 0x64
+ .byte 0x14
+ .byte 0x60
+ .byte 0x13
+ .byte 0x62
+ .byte 0x14
+ .byte 0x64
+ .byte 0x64
+ .byte 0xe6
+ .byte 0x50
+ .byte 0xe5
+ .byte 0x10
+ .byte 0xe6
+ .byte 0x66
+ .byte 0x60
+ .byte 0x60
+ .byte 0xd2
+ .byte 0x63
+ .byte 0xb0
+ .byte 0xe7
+ .byte 0xb1
+ .byte 0xe2
+ .byte 0xb6
+ .byte 0xe6
+ .byte 0x66
+ .byte 0xe6
+ .byte 0xf0
+ .byte 0x14
+ .byte 0x16
+ .byte 0x64
+ .byte 0x14
+ .byte 0x62
+ .byte 0x74
+ .byte 0xe0
+ .byte 0x02
+ .byte 0x00
+ .byte 0x25
+ .byte 0x78
+ .byte 0x02
+ .byte 0x81
+ .byte 0x78
+ .byte 0x9c
+ .byte 0x63
+ .byte 0x60
+ .byte 0x60
+ .byte 0x56
+ .byte 0x61
+ .byte 0x60
+ .byte 0xe6
+ .byte 0xe0
+ .byte 0xe6
+ .byte 0xb6
+ .byte 0xe3
+ .byte 0x66
+ .byte 0x00
+ .byte 0x02
+ .byte 0x00
+ .byte 0x04
+ .byte 0x9c
+ .byte 0x00
+ .byte 0x92
diff --git a/gas/testsuite/gas/elf/dwarf2-2.d b/gas/testsuite/gas/elf/dwarf2-2.d
new file mode 100644
index 0000000..de87004
--- /dev/null
+++ b/gas/testsuite/gas/elf/dwarf2-2.d
@@ -0,0 +1,100 @@
+#readelf: -w
+#name: DWARF2 2
+#not-target: ia64-*-*
+
+Contents of the .debug_info section:
+
+ Compilation Unit @ offset 0x0:
+ Length: 0x4e \(32-bit\)
+ Version: 2
+ Abbrev Offset: 0
+ Pointer Size: 4
+ <0><b>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
+ < c> DW_AT_stmt_list : 0x0
+ <10> DW_AT_high_pc : 0x.
+ <14> DW_AT_low_pc : 0x.
+ <18> DW_AT_name : file1.txt
+ <22> DW_AT_producer : GNU C 3.3.3
+ <2e> DW_AT_language : 1 \(ANSI C\)
+ <1><2f>: Abbrev Number: 2 \(DW_TAG_subprogram\)
+ <30> DW_AT_external : 1
+ <31> DW_AT_decl_file : 1
+ <32> DW_AT_decl_line : 2
+ <33> DW_AT_name : func_cu1
+ <3c> DW_AT_type : <0x4a>
+ <40> DW_AT_low_pc : 0x.
+ <44> DW_AT_high_pc : 0x.
+ <48> DW_AT_frame_base : 1 byte block: 55 \(DW_OP_reg5\)
+ <1><4a>: Abbrev Number: 3 \(DW_TAG_base_type\)
+ <4b> DW_AT_name : int
+ <4f> DW_AT_byte_size : 4
+ <50> DW_AT_encoding : 5 \(signed\)
+
+Raw dump of debug contents of section .debug_line:
+
+ Offset: 0x0
+ Length: 62
+ DWARF Version: 2
+ Prologue Length: 35
+ Minimum Instruction Length: 1
+ Initial value of 'is_stmt': 1
+ Line Base: 1
+ Line Range: 1
+ Opcode Base: 16
+
+ 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
+ Opcode 13 has 0 args
+ Opcode 14 has 0 args
+ Opcode 15 has 0 args
+
+ The Directory Table is empty.
+
+ The File Name Table:
+ Entry Dir Time Size Name
+ 1 0 0 0 file1.txt
+
+ Line Number Statements:
+ Extended opcode 2: set Address to .*
+ Advance Line by 3 to 4
+ Copy
+ Copy
+ Extended opcode 2: set Address to .*
+ Extended opcode 1: End of Sequence
+
+
+Contents of the .zdebug_abbrev section:
+
+ Number TAG
+ 1 DW_TAG_compile_unit \[has children\]
+ DW_AT_stmt_list DW_FORM_data4
+ DW_AT_high_pc DW_FORM_addr
+ DW_AT_low_pc DW_FORM_addr
+ DW_AT_name DW_FORM_string
+ DW_AT_producer DW_FORM_string
+ DW_AT_language DW_FORM_data1
+ 2 DW_TAG_subprogram \[no children\]
+ DW_AT_external DW_FORM_flag
+ DW_AT_decl_file DW_FORM_data1
+ DW_AT_decl_line DW_FORM_data1
+ DW_AT_name DW_FORM_string
+ DW_AT_type DW_FORM_ref4
+ DW_AT_low_pc DW_FORM_addr
+ DW_AT_high_pc DW_FORM_addr
+ DW_AT_frame_base DW_FORM_block1
+ 3 DW_TAG_base_type \[no children\]
+ DW_AT_name DW_FORM_string
+ DW_AT_byte_size DW_FORM_data1
+ DW_AT_encoding DW_FORM_data1
+
diff --git a/gas/testsuite/gas/elf/dwarf2-2.s b/gas/testsuite/gas/elf/dwarf2-2.s
new file mode 100644
index 0000000..389918c
--- /dev/null
+++ b/gas/testsuite/gas/elf/dwarf2-2.s
@@ -0,0 +1,219 @@
+/* This testcase is derived from a similar test in GDB.
+
+ Copyright 2009 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/>. */
+
+/* This tests that gdb can read compressed sections. The contents
+ are a basic assembly file, but the .debug_abbrev section has been
+ comrpessed using zlib. */
+
+/* Dummy function to provide debug information for. */
+
+ .file "dwarf2-2.c"
+ .section .gnu.linkonce.t.foo,"axG",%progbits,foo,comdat
+ .globl _start
+_start:
+ .int 0
+.Lbegin_text1:
+ .globl func_cu1
+ .type func_cu1, %function
+func_cu1:
+.Lbegin_func_cu1:
+ .int 0
+.Lend_func_cu1:
+ .size func_cu1, .-func_cu1
+.Lend_text1:
+
+/* Debug information */
+
+ .section .debug_info,"G",%progbits,foo,comdat
+.Lcu1_begin:
+ /* CU header */
+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
+.Lcu1_start:
+ .2byte 2 /* DWARF Version */
+ .4byte .Labbrev1_begin /* Offset into abbrev section */
+ .byte 4 /* Pointer size */
+
+ /* CU die */
+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
+ .4byte .Lline1_begin /* DW_AT_stmt_list */
+ .4byte .Lend_text1 /* DW_AT_high_pc */
+ .4byte .Lbegin_text1 /* DW_AT_low_pc */
+ .ascii "file1.txt\0" /* DW_AT_name */
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
+ .byte 1 /* DW_AT_language (C) */
+
+ /* func_cu1 */
+ .uleb128 2 /* Abbrev: DW_TAG_subprogram */
+ .byte 1 /* DW_AT_external */
+ .byte 1 /* DW_AT_decl_file */
+ .byte 2 /* DW_AT_decl_line */
+ .ascii "func_cu1\0" /* DW_AT_name */
+ .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
+ .4byte .Lbegin_func_cu1 /* DW_AT_low_pc */
+ .4byte .Lend_func_cu1 /* DW_AT_high_pc */
+ .byte 1 /* DW_AT_frame_base: length */
+ .byte 0x55 /* DW_AT_frame_base: DW_OP_reg5 */
+
+.Ltype_int:
+ .uleb128 3 /* Abbrev: DW_TAG_base_type */
+ .ascii "int\0" /* DW_AT_name */
+ .byte 4 /* DW_AT_byte_size */
+ .byte 5 /* DW_AT_encoding */
+
+ .byte 0 /* End of children of CU */
+
+.Lcu1_end:
+
+/* Line table */
+ .section .debug_line,"G",%progbits,foo,comdat
+.Lline1_begin:
+ .4byte .Lline1_end - .Lline1_start /* Initial length */
+.Lline1_start:
+ .2byte 2 /* Version */
+ .4byte .Lline1_lines - .Lline1_hdr /* header_length */
+.Lline1_hdr:
+ .byte 1 /* Minimum insn length */
+ .byte 1 /* default_is_stmt */
+ .byte 1 /* line_base */
+ .byte 1 /* line_range */
+ .byte 0x10 /* opcode_base */
+
+ /* Standard lengths */
+ .byte 0
+ .byte 1
+ .byte 1
+ .byte 1
+ .byte 1
+ .byte 0
+ .byte 0
+ .byte 0
+ .byte 1
+ .byte 0
+ .byte 0
+ .byte 1
+ .byte 0
+ .byte 0
+ .byte 0
+
+ /* Include directories */
+ .byte 0
+
+ /* File names */
+ .ascii "file1.txt\0"
+ .uleb128 0
+ .uleb128 0
+ .uleb128 0
+
+ .byte 0
+
+.Lline1_lines:
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ .4byte .Lbegin_func_cu1
+
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 3 /* ... to 4 */
+
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 1 /* DW_LNS_copy (second time as an end-of-prologue marker) */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ .4byte .Lend_func_cu1
+
+ .byte 0 /* DW_LNE_end_of_sequence */
+ .uleb128 1
+ .byte 1
+
+.Lline1_end:
+
+/* Abbrev table -- compressed */
+ .section .zdebug_abbrev,"G",%progbits,foo,comdat
+.Labbrev1_begin:
+ .ascii "ZLIB"
+ .4byte 0
+ .2byte 0
+ .byte 0
+ .byte 51
+ .byte 0x78
+ .byte 0x5e
+ .byte 0x63
+ .byte 0x14
+ .byte 0x64
+ .byte 0x14
+ .byte 0x60
+ .byte 0x13
+ .byte 0x62
+ .byte 0x14
+ .byte 0x64
+ .byte 0x64
+ .byte 0xe6
+ .byte 0x50
+ .byte 0xe5
+ .byte 0x10
+ .byte 0xe6
+ .byte 0x66
+ .byte 0x60
+ .byte 0x60
+ .byte 0xd2
+ .byte 0x63
+ .byte 0xb0
+ .byte 0xe7
+ .byte 0xb1
+ .byte 0xe2
+ .byte 0xb6
+ .byte 0xe6
+ .byte 0x66
+ .byte 0xe6
+ .byte 0xf0
+ .byte 0x14
+ .byte 0x16
+ .byte 0x64
+ .byte 0x14
+ .byte 0x62
+ .byte 0x74
+ .byte 0xe0
+ .byte 0x02
+ .byte 0x00
+ .byte 0x25
+ .byte 0x78
+ .byte 0x02
+ .byte 0x81
+ .byte 0x78
+ .byte 0x9c
+ .byte 0x63
+ .byte 0x60
+ .byte 0x60
+ .byte 0x56
+ .byte 0x61
+ .byte 0x60
+ .byte 0xe6
+ .byte 0xe0
+ .byte 0xe6
+ .byte 0xb6
+ .byte 0xe3
+ .byte 0x66
+ .byte 0x00
+ .byte 0x02
+ .byte 0x00
+ .byte 0x04
+ .byte 0x9c
+ .byte 0x00
+ .byte 0x92
diff --git a/gas/testsuite/gas/elf/dwarf2-3.d b/gas/testsuite/gas/elf/dwarf2-3.d
new file mode 100644
index 0000000..2d8c2ac
--- /dev/null
+++ b/gas/testsuite/gas/elf/dwarf2-3.d
@@ -0,0 +1,38 @@
+#readelf: -wl
+#name: DWARF2 3
+#not-target: ia64-*-*
+
+Raw dump of debug contents of section .debug_line:
+
+ Offset: 0x0
+ Length: 41
+ DWARF Version: 2
+ Prologue Length: 35
+ Minimum Instruction Length: [0-9]*
+ Initial value of 'is_stmt': 1
+ Line Base: -5
+ Line Range: 14
+ 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 is empty.
+
+ The File Name Table:
+ Entry Dir Time Size Name
+ 1 0 0 0 /beginwarn.c
+
+ Line Number Statements:
+
diff --git a/gas/testsuite/gas/elf/dwarf2-3.s b/gas/testsuite/gas/elf/dwarf2-3.s
new file mode 100644
index 0000000..8c4b1e8
--- /dev/null
+++ b/gas/testsuite/gas/elf/dwarf2-3.s
@@ -0,0 +1,186 @@
+ .file "beginwarn.c"
+ .section .debug_abbrev,"",%progbits
+.Ldebug_abbrev0:
+ .section .debug_info,"",%progbits
+.Ldebug_info0:
+ .section .debug_line,"",%progbits
+.Ldebug_line0:
+ .text
+.Ltext0:
+ .section .init_array,"aw"
+ .align 4
+ .type init_array, %object
+ .size init_array, 4
+init_array:
+ .long foo
+ .section .gnu.warning.foo,"a",%progbits
+ .type _evoke_link_warning_foo, %object
+ .size _evoke_link_warning_foo, 27
+_evoke_link_warning_foo:
+ .string "function foo is deprecated"
+ .file 1 "/beginwarn.c"
+ .text
+.Letext0:
+ .section .debug_info
+ .long 0x8a
+ .short 0x2
+ .long .Ldebug_abbrev0
+ .byte 0x4
+ .uleb128 0x1
+ .long .Ldebug_line0
+ .long .Letext0
+ .long .Ltext0
+ .long .LASF4
+ .byte 0x1
+ .long .LASF5
+ .uleb128 0x2
+ .long 0x31
+ .long 0x38
+ .uleb128 0x3
+ .long 0x31
+ .byte 0x1a
+ .byte 0x0
+ .uleb128 0x4
+ .long .LASF0
+ .byte 0x4
+ .byte 0x7
+ .uleb128 0x5
+ .long 0x3d
+ .uleb128 0x4
+ .long .LASF1
+ .byte 0x1
+ .byte 0x6
+ .uleb128 0x6
+ .long .LASF2
+ .byte 0x1
+ .byte 0x3
+ .long 0x55
+ .byte 0x5
+ .byte 0x3
+ .long _evoke_link_warning_foo
+ .uleb128 0x5
+ .long 0x21
+ .uleb128 0x2
+ .long 0x6a
+ .long 0x6c
+ .uleb128 0x3
+ .long 0x31
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x7
+ .byte 0x1
+ .uleb128 0x5
+ .long 0x71
+ .uleb128 0x8
+ .byte 0x4
+ .long 0x6a
+ .uleb128 0x6
+ .long .LASF3
+ .byte 0x1
+ .byte 0x9
+ .long 0x88
+ .byte 0x5
+ .byte 0x3
+ .long init_array
+ .uleb128 0x5
+ .long 0x5a
+ .byte 0x0
+ .section .debug_abbrev
+ .uleb128 0x1
+ .uleb128 0x11
+ .byte 0x1
+ .uleb128 0x10
+ .uleb128 0x6
+ .uleb128 0x12
+ .uleb128 0x1
+ .uleb128 0x11
+ .uleb128 0x1
+ .uleb128 0x25
+ .uleb128 0xe
+ .uleb128 0x13
+ .uleb128 0xb
+ .uleb128 0x3
+ .uleb128 0xe
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x2
+ .uleb128 0x1
+ .byte 0x1
+ .uleb128 0x1
+ .uleb128 0x13
+ .uleb128 0x49
+ .uleb128 0x13
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x3
+ .uleb128 0x21
+ .byte 0x0
+ .uleb128 0x49
+ .uleb128 0x13
+ .uleb128 0x2f
+ .uleb128 0xb
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x4
+ .uleb128 0x24
+ .byte 0x0
+ .uleb128 0x3
+ .uleb128 0xe
+ .uleb128 0xb
+ .uleb128 0xb
+ .uleb128 0x3e
+ .uleb128 0xb
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x5
+ .uleb128 0x26
+ .byte 0x0
+ .uleb128 0x49
+ .uleb128 0x13
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x6
+ .uleb128 0x34
+ .byte 0x0
+ .uleb128 0x3
+ .uleb128 0xe
+ .uleb128 0x3a
+ .uleb128 0xb
+ .uleb128 0x3b
+ .uleb128 0xb
+ .uleb128 0x49
+ .uleb128 0x13
+ .uleb128 0x2
+ .uleb128 0xa
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x7
+ .uleb128 0x15
+ .byte 0x0
+ .uleb128 0x27
+ .uleb128 0xc
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x8
+ .uleb128 0xf
+ .byte 0x0
+ .uleb128 0xb
+ .uleb128 0xb
+ .uleb128 0x49
+ .uleb128 0x13
+ .byte 0x0
+ .byte 0x0
+ .byte 0x0
+ .section .debug_str,"MS",%progbits,1
+.LASF5:
+ .string "/beginwarn.c"
+.LASF0:
+ .string "unsigned int"
+.LASF3:
+ .string "init_array"
+.LASF2:
+ .string "_evoke_link_warning_foo"
+.LASF4:
+ .string "GNU C 3.4.6"
+.LASF1:
+ .string "char"
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index 9771a86..b2a29aa 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -161,4 +161,7 @@ if { ([istarget "*-*-*elf*"]
run_dump_test "section6"
run_dump_test "section7"
run_dump_test "section8"
+ run_dump_test "dwarf2-1"
+ run_dump_test "dwarf2-2"
+ run_dump_test "dwarf2-3"
}
diff --git a/gas/testsuite/gas/i386/debug1.d b/gas/testsuite/gas/i386/debug1.d
new file mode 100644
index 0000000..437e38f
--- /dev/null
+++ b/gas/testsuite/gas/i386/debug1.d
@@ -0,0 +1,46 @@
+#as: --gdwarf-2
+#readelf: -wl
+#name: DWARF2 debugging information 1
+
+Raw dump of debug contents of section .debug_line:
+
+ Offset: 0x0
+ Length: .*
+ DWARF Version: 2
+ Prologue Length: .*
+ Minimum Instruction Length: 1
+ Initial value of 'is_stmt': 1
+ Line Base: -5
+ Line Range: 14
+ 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:
+ .*
+
+ The File Name Table:
+ Entry Dir Time Size Name
+ 1 1 0 0 debug1.s
+
+ Line Number Statements:
+ Extended opcode 2: set Address to 0x0
+ Special opcode 7: advance Address by 0 to 0x0 and Line by 2 to 3
+ Special opcode 20: advance Address by 1 to 0x1 and Line by 1 to 4
+ Special opcode 20: advance Address by 1 to 0x2 and Line by 1 to 5
+ Advance PC by 1 to 0x3
+ Extended opcode 1: End of Sequence
+
+
diff --git a/gas/testsuite/gas/i386/debug1.s b/gas/testsuite/gas/i386/debug1.s
new file mode 100644
index 0000000..da623af
--- /dev/null
+++ b/gas/testsuite/gas/i386/debug1.s
@@ -0,0 +1,5 @@
+ .file "debug1.s"
+ .text
+ nop
+ nop
+ nop
diff --git a/gas/testsuite/gas/i386/dw2-compress-1.d b/gas/testsuite/gas/i386/dw2-compress-1.d
index 614c7e8..1205ddf 100644
--- a/gas/testsuite/gas/i386/dw2-compress-1.d
+++ b/gas/testsuite/gas/i386/dw2-compress-1.d
@@ -98,33 +98,3 @@ Raw dump of debug contents of section .zdebug_line:
Extended opcode 1: End of Sequence
- Offset: 0x42
- Length: 25
- DWARF Version: 2
- Prologue Length: 19
- Minimum Instruction Length: 1
- Initial value of 'is_stmt': 1
- Line Base: -5
- Line Range: 14
- 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 is empty.
-
- The File Name Table is empty.
-
- Line Number Statements:
-
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index 02cde86..59ad747 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -212,6 +212,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]]
run_dump_test "ifunc"
run_list_test "l1om-inval" "-march=l1om --32"
run_dump_test "localpic"
+ run_dump_test "debug1"
}
# This is a PE specific test.
@@ -399,6 +400,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t
run_dump_test "x86-64-ifunc"
run_dump_test "l1om"
run_dump_test "x86-64-localpic"
+ run_dump_test "debug1"
}
set ASFLAGS "$old_ASFLAGS"