From c019691bd5c0280b087c6245509d2cab02874ef9 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Wed, 9 Jun 2010 13:42:55 +0000 Subject: [PATCH] - Backport DWARF-4 support (BZ 601887, Tom Tromey). --- gdb-bz601887-dwarf4-1of2.patch | 329 ++++++++++++++++++++++++++++++ gdb-bz601887-dwarf4-2of2.patch | 56 +++++ gdb-bz601887-dwarf4-rh-test.patch | 240 ++++++++++++++++++++++ gdb.spec | 13 +- 4 files changed, 637 insertions(+), 1 deletion(-) create mode 100644 gdb-bz601887-dwarf4-1of2.patch create mode 100644 gdb-bz601887-dwarf4-2of2.patch create mode 100644 gdb-bz601887-dwarf4-rh-test.patch diff --git a/gdb-bz601887-dwarf4-1of2.patch b/gdb-bz601887-dwarf4-1of2.patch new file mode 100644 index 0000000..22708df --- /dev/null +++ b/gdb-bz601887-dwarf4-1of2.patch @@ -0,0 +1,329 @@ +commit be1f57c90bdf86477b9bc69cc982171d6ad5df56 +Author: Tom Tromey +Date: Tue Apr 20 17:33:13 2010 +0000 + + * dwarf2-frame.c (decode_frame_entry_1): Handle CIE version 4. + (struct dwarf2_cie) : New field. + * dwarf2read.c (partial_read_comp_unit_head): Accept DWARF 4. + (skip_one_die): Handle DW_FORM_flag_present, DW_FORM_sec_offset, + DW_FORM_exprloc. + (read_attribute_value): Handle DW_FORM_flag_present, + DW_FORM_sec_offset, DW_FORM_exprloc. + (dump_die_shallow): Likewise. + (attr_form_is_section_offset): Handle DW_FORM_sec_offset. + (dwarf2_const_value): Handle DW_FORM_exprloc. + (attr_form_is_block): Likewise. + (struct line_header) : New field. + (dwarf_decode_line_header): Set new field. + (dwarf_decode_lines): Handle new field. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,20 @@ ++2010-04-20 Tom Tromey ++ ++ * dwarf2-frame.c (decode_frame_entry_1): Handle CIE version 4. ++ (struct dwarf2_cie) : New field. ++ * dwarf2read.c (partial_read_comp_unit_head): Accept DWARF 4. ++ (skip_one_die): Handle DW_FORM_flag_present, DW_FORM_sec_offset, ++ DW_FORM_exprloc. ++ (read_attribute_value): Handle DW_FORM_flag_present, ++ DW_FORM_sec_offset, DW_FORM_exprloc. ++ (dump_die_shallow): Likewise. ++ (attr_form_is_section_offset): Handle DW_FORM_sec_offset. ++ (dwarf2_const_value): Handle DW_FORM_exprloc. ++ (attr_form_is_block): Likewise. ++ (struct line_header) : New field. ++ (dwarf_decode_line_header): Set new field. ++ (dwarf_decode_lines): Handle new field. ++ + 2010-04-20 Jan Kratochvil + + * f-exp.y: Add new production to recognize the `logical*8' type. +--- a/gdb/dwarf2-frame.c ++++ b/gdb/dwarf2-frame.c +@@ -85,6 +85,9 @@ struct dwarf2_cie + + /* The version recorded in the CIE. */ + unsigned char version; ++ ++ /* The segment size. */ ++ unsigned char segment_size; + }; + + struct dwarf2_cie_table +@@ -1714,7 +1717,7 @@ decode_frame_entry_1 (struct comp_unit *unit, gdb_byte *start, int eh_frame_p, + + /* Check version number. */ + cie_version = read_1_byte (unit->abfd, buf); +- if (cie_version != 1 && cie_version != 3) ++ if (cie_version != 1 && cie_version != 3 && cie_version != 4) + return NULL; + cie->version = cie_version; + buf += 1; +@@ -1738,6 +1741,20 @@ decode_frame_entry_1 (struct comp_unit *unit, gdb_byte *start, int eh_frame_p, + augmentation += 2; + } + ++ if (cie->version >= 4) ++ { ++ /* FIXME: check that this is the same as from the CU header. */ ++ cie->addr_size = read_1_byte (unit->abfd, buf); ++ ++buf; ++ cie->segment_size = read_1_byte (unit->abfd, buf); ++ ++buf; ++ } ++ else ++ { ++ cie->addr_size = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT; ++ cie->segment_size = 0; ++ } ++ + cie->code_alignment_factor = + read_unsigned_leb128 (unit->abfd, buf, &bytes_read); + buf += bytes_read; +--- a/gdb/dwarf2read.c ++++ b/gdb/dwarf2read.c +@@ -396,6 +396,7 @@ struct line_header + unsigned short version; + unsigned int header_length; + unsigned char minimum_instruction_length; ++ unsigned char maximum_ops_per_instruction; + unsigned char default_is_stmt; + int line_base; + unsigned char line_range; +@@ -1488,10 +1489,10 @@ partial_read_comp_unit_head (struct comp_unit_head *header, gdb_byte *info_ptr, + + info_ptr = read_comp_unit_head (header, info_ptr, abfd); + +- if (header->version != 2 && header->version != 3) ++ if (header->version != 2 && header->version != 3 && header->version != 4) + error (_("Dwarf Error: wrong version in compilation unit header " +- "(is %d, should be %d) [in module %s]"), header->version, +- 2, bfd_get_filename (abfd)); ++ "(is %d, should be 2, 3, or 4) [in module %s]"), header->version, ++ bfd_get_filename (abfd)); + + if (header->abbrev_offset >= dwarf2_per_objfile->abbrev.size) + error (_("Dwarf Error: bad offset (0x%lx) in compilation unit header " +@@ -2776,6 +2777,8 @@ skip_one_die (gdb_byte *buffer, gdb_byte *info_ptr, + case DW_FORM_flag: + info_ptr += 1; + break; ++ case DW_FORM_flag_present: ++ break; + case DW_FORM_data2: + case DW_FORM_ref2: + info_ptr += 2; +@@ -2793,9 +2796,11 @@ skip_one_die (gdb_byte *buffer, gdb_byte *info_ptr, + read_string (abfd, info_ptr, &bytes_read); + info_ptr += bytes_read; + break; ++ case DW_FORM_sec_offset: + case DW_FORM_strp: + info_ptr += cu->header.offset_size; + break; ++ case DW_FORM_exprloc: + case DW_FORM_block: + info_ptr += read_unsigned_leb128 (abfd, info_ptr, &bytes_read); + info_ptr += bytes_read; +@@ -7129,6 +7134,10 @@ read_attribute_value (struct attribute *attr, unsigned form, + DW_UNSND (attr) = read_8_bytes (abfd, info_ptr); + info_ptr += 8; + break; ++ case DW_FORM_sec_offset: ++ DW_UNSND (attr) = read_offset (abfd, info_ptr, &cu->header, &bytes_read); ++ info_ptr += bytes_read; ++ break; + case DW_FORM_string: + DW_STRING (attr) = read_string (abfd, info_ptr, &bytes_read); + DW_STRING_IS_CANONICAL (attr) = 0; +@@ -7140,6 +7149,7 @@ read_attribute_value (struct attribute *attr, unsigned form, + DW_STRING_IS_CANONICAL (attr) = 0; + info_ptr += bytes_read; + break; ++ case DW_FORM_exprloc: + case DW_FORM_block: + blk = dwarf_alloc_block (cu); + blk->size = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); +@@ -7164,6 +7174,9 @@ read_attribute_value (struct attribute *attr, unsigned form, + DW_UNSND (attr) = read_1_byte (abfd, info_ptr); + info_ptr += 1; + break; ++ case DW_FORM_flag_present: ++ DW_UNSND (attr) = 1; ++ break; + case DW_FORM_sdata: + DW_SND (attr) = read_signed_leb128 (abfd, info_ptr, &bytes_read); + info_ptr += bytes_read; +@@ -7680,7 +7693,7 @@ dwarf2_attr_no_follow (struct die_info *die, unsigned int name, + + /* Return non-zero iff the attribute NAME is defined for the given DIE, + and holds a non-zero value. This function should only be used for +- DW_FORM_flag attributes. */ ++ DW_FORM_flag or DW_FORM_flag_present attributes. */ + + static int + dwarf2_flag_true_p (struct die_info *die, unsigned name, struct dwarf2_cu *cu) +@@ -7862,6 +7875,21 @@ dwarf_decode_line_header (unsigned int offset, bfd *abfd, + line_ptr += offset_size; + lh->minimum_instruction_length = read_1_byte (abfd, line_ptr); + line_ptr += 1; ++ if (lh->version >= 4) ++ { ++ lh->maximum_ops_per_instruction = read_1_byte (abfd, line_ptr); ++ line_ptr += 1; ++ } ++ else ++ lh->maximum_ops_per_instruction = 1; ++ ++ if (lh->maximum_ops_per_instruction == 0) ++ { ++ lh->maximum_ops_per_instruction = 1; ++ complaint (&symfile_complaints, ++ _("invalid maximum_ops_per_instruction in `.debug_line' section")); ++ } ++ + lh->default_is_stmt = read_1_byte (abfd, line_ptr); + line_ptr += 1; + lh->line_base = read_1_signed_byte (abfd, line_ptr); +@@ -8010,6 +8038,7 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, + int basic_block = 0; + int end_sequence = 0; + CORE_ADDR addr; ++ unsigned char op_index = 0; + + if (!decode_for_pst_p && lh->num_file_names >= file) + { +@@ -8041,12 +8070,17 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, + { + /* Special operand. */ + adj_opcode = op_code - lh->opcode_base; +- address += (adj_opcode / lh->line_range) +- * lh->minimum_instruction_length; ++ address += (((op_index + (adj_opcode / lh->line_range)) ++ / lh->maximum_ops_per_instruction) ++ * lh->minimum_instruction_length); ++ op_index = ((op_index + (adj_opcode / lh->line_range)) ++ % lh->maximum_ops_per_instruction); + line += lh->line_base + (adj_opcode % lh->line_range); + if (lh->num_file_names < file || file == 0) + dwarf2_debug_line_missing_file_complaint (); +- else ++ /* For now we ignore lines not starting on an ++ instruction boundary. */ ++ else if (op_index == 0) + { + lh->file_names[file - 1].included_p = 1; + if (!decode_for_pst_p && is_stmt) +@@ -8081,6 +8115,7 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, + break; + case DW_LNE_set_address: + address = read_address (abfd, line_ptr, cu, &bytes_read); ++ op_index = 0; + line_ptr += bytes_read; + address += baseaddr; + break; +@@ -8146,9 +8181,17 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, + basic_block = 0; + break; + case DW_LNS_advance_pc: +- address += lh->minimum_instruction_length +- * read_unsigned_leb128 (abfd, line_ptr, &bytes_read); +- line_ptr += bytes_read; ++ { ++ CORE_ADDR adjust ++ = read_unsigned_leb128 (abfd, line_ptr, &bytes_read); ++ ++ address += (((op_index + adjust) ++ / lh->maximum_ops_per_instruction) ++ * lh->minimum_instruction_length); ++ op_index = ((op_index + adjust) ++ % lh->maximum_ops_per_instruction); ++ line_ptr += bytes_read; ++ } + break; + case DW_LNS_advance_line: + line += read_signed_leb128 (abfd, line_ptr, &bytes_read); +@@ -8195,11 +8238,19 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, + instruction length since special opcode 255 would have + scaled the the increment. */ + case DW_LNS_const_add_pc: +- address += (lh->minimum_instruction_length +- * ((255 - lh->opcode_base) / lh->line_range)); ++ { ++ CORE_ADDR adjust = (255 - lh->opcode_base) / lh->line_range; ++ ++ address += (((op_index + adjust) ++ / lh->maximum_ops_per_instruction) ++ * lh->minimum_instruction_length); ++ op_index = ((op_index + adjust) ++ % lh->maximum_ops_per_instruction); ++ } + break; + case DW_LNS_fixed_advance_pc: + address += read_2_bytes (abfd, line_ptr); ++ op_index = 0; + line_ptr += 2; + break; + default: +@@ -8761,6 +8812,7 @@ dwarf2_const_value (struct attribute *attr, struct symbol *sym, + case DW_FORM_block2: + case DW_FORM_block4: + case DW_FORM_block: ++ case DW_FORM_exprloc: + blk = DW_BLOCK (attr); + if (TYPE_LENGTH (SYMBOL_TYPE (sym)) != blk->size) + dwarf2_const_value_length_mismatch_complaint (SYMBOL_PRINT_NAME (sym), +@@ -10308,6 +10360,10 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) + case DW_FORM_block1: + fprintf_unfiltered (f, "block: size %d", DW_BLOCK (&die->attrs[i])->size); + break; ++ case DW_FORM_exprloc: ++ fprintf_unfiltered (f, "expression: size %u", ++ DW_BLOCK (&die->attrs[i])->size); ++ break; + case DW_FORM_ref1: + case DW_FORM_ref2: + case DW_FORM_ref4: +@@ -10323,6 +10379,10 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) + fprintf_unfiltered (f, "constant: %s", + pulongest (DW_UNSND (&die->attrs[i]))); + break; ++ case DW_FORM_sec_offset: ++ fprintf_unfiltered (f, "section offset: %s", ++ pulongest (DW_UNSND (&die->attrs[i]))); ++ break; + case DW_FORM_sig8: + if (DW_SIGNATURED_TYPE (&die->attrs[i]) != NULL) + fprintf_unfiltered (f, "signatured type, offset: 0x%x", +@@ -10343,6 +10403,9 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) + else + fprintf_unfiltered (f, "flag: FALSE"); + break; ++ case DW_FORM_flag_present: ++ fprintf_unfiltered (f, "flag: TRUE"); ++ break; + case DW_FORM_indirect: + /* the reader will have reduced the indirect form to + the "base form" so this form should not occur */ +@@ -11520,7 +11583,8 @@ attr_form_is_block (struct attribute *attr) + attr->form == DW_FORM_block1 + || attr->form == DW_FORM_block2 + || attr->form == DW_FORM_block4 +- || attr->form == DW_FORM_block); ++ || attr->form == DW_FORM_block ++ || attr->form == DW_FORM_exprloc); + } + + /* Return non-zero if ATTR's value is a section offset --- classes +@@ -11535,7 +11599,8 @@ static int + attr_form_is_section_offset (struct attribute *attr) + { + return (attr->form == DW_FORM_data4 +- || attr->form == DW_FORM_data8); ++ || attr->form == DW_FORM_data8 ++ || attr->form == DW_FORM_sec_offset); + } + + diff --git a/gdb-bz601887-dwarf4-2of2.patch b/gdb-bz601887-dwarf4-2of2.patch new file mode 100644 index 0000000..97f88b0 --- /dev/null +++ b/gdb-bz601887-dwarf4-2of2.patch @@ -0,0 +1,56 @@ +commit 669907bd6d54ae8e85b1278f0f16f8641ce6802d +Author: Tom Tromey +Date: Tue Apr 20 21:19:07 2010 +0000 + + * dwarf2read.c (dwarf2_compute_name): Handle DW_AT_linkage_name. + (read_partial_die): Likewise. + (dwarf_attr_name): Likewise. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,9 @@ ++2010-04-20 Tom Tromey ++ ++ * dwarf2read.c (dwarf2_compute_name): Handle DW_AT_linkage_name. ++ (read_partial_die): Likewise. ++ (dwarf_attr_name): Likewise. ++ + 2010-04-20 Chris Moller + + PR 10867 +--- gdb-7.1/gdb/dwarf2read.c.orig 2010-06-09 14:38:01.000000000 +0200 ++++ gdb-7.1/gdb/dwarf2read.c 2010-06-09 14:49:53.000000000 +0200 +@@ -7675,7 +7675,11 @@ read_partial_die (struct partial_die_inf + break; + } + break; ++ case DW_AT_linkage_name: + case DW_AT_MIPS_linkage_name: ++ /* Note that both forms of linkage name might appear. We ++ assume they will be the same, and we only store the last ++ one we see. */ + if (cu->language == language_ada) + part_die->name = DW_STRING (&attr); + break; +@@ -10167,7 +10171,11 @@ dwarf2_name (struct die_info *die, struc + struct attribute *attr = NULL; + + if (cu->language == language_ada) +- attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu); ++ { ++ attr = dwarf2_attr (die, DW_AT_linkage_name, cu); ++ if (attr == NULL) ++ attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu); ++ } + + if (!attr) + attr = dwarf2_attr (die, DW_AT_name, cu); +@@ -10555,6 +10563,8 @@ dwarf_attr_name (unsigned attr) + /* DWARF 4 values. */ + case DW_AT_signature: + return "DW_AT_signature"; ++ case DW_AT_linkage_name: ++ return "DW_AT_linkage_name"; + /* SGI/MIPS extensions. */ + #ifdef MIPS /* collides with DW_AT_HP_block_index */ + case DW_AT_MIPS_fde: diff --git a/gdb-bz601887-dwarf4-rh-test.patch b/gdb-bz601887-dwarf4-rh-test.patch new file mode 100644 index 0000000..4774bda --- /dev/null +++ b/gdb-bz601887-dwarf4-rh-test.patch @@ -0,0 +1,240 @@ +--- /dev/null 2010-06-08 20:35:46.800278452 +0200 ++++ gdb-7.1/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.S 2010-06-09 15:22:57.000000000 +0200 +@@ -0,0 +1,167 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2010 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 . */ ++ ++ .file "rh-dwarf4-x86_64.c" ++ .section .debug_abbrev,"",@progbits ++.Ldebug_abbrev0: ++ .section .debug_info,"",@progbits ++.Ldebug_info0: ++ .section .debug_line,"",@progbits ++.Ldebug_line0: ++ .text ++.Ltext0: ++.globl main ++ .type main, @function ++main: ++.LFB0: ++ .file 1 "gdb.dwarf2/rh-dwarf4-x86_64.c" ++ # gdb.dwarf2/rh-dwarf4-x86_64.c:20 ++ .loc 1 20 0 ++ .cfi_startproc ++ # basic block 2 ++ pushq %rbp ++ .cfi_def_cfa_offset 16 ++ movq %rsp, %rbp ++ .cfi_offset 6, -16 ++ .cfi_def_cfa_register 6 ++ # gdb.dwarf2/rh-dwarf4-x86_64.c:21 ++ .loc 1 21 0 ++ movl $0, %eax ++ # gdb.dwarf2/rh-dwarf4-x86_64.c:22 ++ .loc 1 22 0 ++ leave ++ .cfi_def_cfa 7, 8 ++ ret ++ .cfi_endproc ++.LFE0: ++ .size main, .-main ++.Letext0: ++ .section .debug_info ++ .long 0x4e # Length of Compilation Unit Info ++ .value 0x4 # DWARF version number ++ .long .Ldebug_abbrev0 # Offset Into Abbrev. Section ++ .byte 0x8 # Pointer Size (in bytes) ++ .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit) ++ .long .LASF0 # DW_AT_producer: "GNU C 4.4.4 20100503 (Red Hat 4.4.4-2)" ++ .byte 0x1 # DW_AT_language ++ .long .LASF1 # DW_AT_name: "gdb.dwarf2/rh-dwarf4-x86_64.c" ++ .long .LASF2 # DW_AT_comp_dir ++ .quad .Ltext0 # DW_AT_low_pc ++ .quad .Letext0 # DW_AT_high_pc ++ .long .Ldebug_line0 # DW_AT_stmt_list ++ .uleb128 0x2 # (DIE (0x2d) DW_TAG_subprogram) ++ # DW_AT_external ++ .long .LASF3 # DW_AT_name: "main" ++ .byte 0x1 # DW_AT_decl_file (gdb.dwarf2/rh-dwarf4-x86_64.c) ++ .byte 0x13 # DW_AT_decl_line ++ # DW_AT_prototyped ++ .long 0x4a # DW_AT_type ++ .quad .LFB0 # DW_AT_low_pc ++ .quad .LFE0 # DW_AT_high_pc ++ .uleb128 0x1 # DW_AT_frame_base ++ .byte 0x9c # DW_OP_call_frame_cfa ++ .uleb128 0x3 # (DIE (0x4a) DW_TAG_base_type) ++ .byte 0x4 # DW_AT_byte_size ++ .byte 0x5 # DW_AT_encoding ++ .ascii "int\0" # DW_AT_name ++ .byte 0x0 # end of children of DIE 0xb ++ .section .debug_abbrev ++ .uleb128 0x1 # (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 0xe # (DW_FORM_strp) ++ .uleb128 0x1b # (DW_AT_comp_dir) ++ .uleb128 0xe # (DW_FORM_strp) ++ .uleb128 0x11 # (DW_AT_low_pc) ++ .uleb128 0x1 # (DW_FORM_addr) ++ .uleb128 0x12 # (DW_AT_high_pc) ++ .uleb128 0x1 # (DW_FORM_addr) ++ .uleb128 0x10 # (DW_AT_stmt_list) ++ .uleb128 0x17 # (DW_FORM_sec_offset) ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0x2 # (abbrev code) ++ .uleb128 0x2e # (TAG: DW_TAG_subprogram) ++ .byte 0x0 # 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 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 0x1 # (DW_FORM_addr) ++ .uleb128 0x40 # (DW_AT_frame_base) ++ .uleb128 0x18 # (DW_FORM_exprloc) ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0x3 # (abbrev code) ++ .uleb128 0x24 # (TAG: DW_TAG_base_type) ++ .byte 0x0 # 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 0x0 ++ .byte 0x0 ++ .byte 0x0 ++ .section .debug_pubnames,"",@progbits ++ .long 0x17 # Length of Public Names Info ++ .value 0x2 # DWARF Version ++ .long .Ldebug_info0 # Offset of Compilation Unit Info ++ .long 0x52 # Compilation Unit Length ++ .long 0x2d # DIE offset ++ .ascii "main\0" # external name ++ .long 0x0 ++ .section .debug_aranges,"",@progbits ++ .long 0x2c # Length of Address Ranges Info ++ .value 0x2 # DWARF Version ++ .long .Ldebug_info0 # Offset of Compilation Unit Info ++ .byte 0x8 # Size of Address ++ .byte 0x0 # Size of Segment Descriptor ++ .value 0x0 # Pad to 16 byte boundary ++ .value 0x0 ++ .quad .Ltext0 # Address ++ .quad .Letext0-.Ltext0 # Length ++ .quad 0x0 ++ .quad 0x0 ++ .section .debug_str,"MS",@progbits,1 ++.LASF2: ++ .string "." ++.LASF0: ++ .string "GNU C 4.4.4 20100503 (Red Hat 4.4.4-2)" ++.LASF1: ++ .string "gdb.dwarf2/rh-dwarf4-x86_64.c" ++.LASF3: ++ .string "main" ++ .ident "GCC: (GNU) 4.4.4 20100503 (Red Hat 4.4.4-2)" ++ .section .note.GNU-stack,"",@progbits +--- /dev/null 2010-06-08 20:35:46.800278452 +0200 ++++ gdb-7.1/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.c 2010-06-09 15:21:35.000000000 +0200 +@@ -0,0 +1,22 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2010 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 . */ ++ ++int ++main (void) ++{ ++ return 0; ++} +--- /dev/null 2010-06-08 20:35:46.800278452 +0200 ++++ gdb-7.1/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.exp 2010-06-09 15:26:21.000000000 +0200 +@@ -0,0 +1,42 @@ ++# Copyright 2010 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 . ++ ++# This test can only be run on targets which support DWARF-2 and use gas. ++# For now pick a sampling of likely targets. ++if {![istarget *-*-linux*] ++ && ![istarget *-*-gnu*] ++ && ![istarget *-*-elf*] ++ && ![istarget *-*-openbsd*] ++ && ![istarget arm-*-eabi*] ++ && ![istarget powerpc-*-eabi*]} { ++ return 0 ++} ++ ++if {![istarget x86_64-*]} { ++ return 0 ++} ++ ++set testfile "rh-dwarf4-x86_64" ++set srcfile ${testfile}.S ++set executable ${testfile}.x ++set binfile ${objdir}/${subdir}/${executable} ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } { ++ return -1 ++} ++ ++clean_restart $executable ++ ++gdb_test "ptype main" {type = int \(void\)} diff --git a/gdb.spec b/gdb.spec index 75166c1..066f1d0 100644 --- a/gdb.spec +++ b/gdb.spec @@ -36,7 +36,7 @@ Version: 7.1 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 25%{?_with_upstream:.upstream}%{dist} +Release: 26%{?_with_upstream:.upstream}%{dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and GFDL and BSD and Public Domain Group: Development/Debuggers @@ -502,6 +502,11 @@ Patch470: gdb-archer-next-over-throw-cxx-exec.patch # Fix ADL anonymous type crash (BZ 600746, Sami Wagiaalla). Patch472: gdb-bz600746-koenig-crash.patch +# Backport DWARF-4 support (BZ 601887, Tom Tromey). +Patch473: gdb-bz601887-dwarf4-1of2.patch +Patch474: gdb-bz601887-dwarf4-2of2.patch +Patch475: gdb-bz601887-dwarf4-rh-test.patch + BuildRequires: ncurses-devel%{?_isa} texinfo gettext flex bison expat-devel%{?_isa} Requires: readline%{?_isa} BuildRequires: readline-devel%{?_isa} @@ -789,6 +794,9 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch471 -p1 %patch470 -p1 %patch472 -p1 +%patch473 -p1 +%patch474 -p1 +%patch475 -p1 %patch415 -p1 %patch393 -p1 @@ -1121,6 +1129,9 @@ fi %endif %changelog +* Wed Jun 9 2010 Jan Kratochvil - 7.1-26.fc13 +- Backport DWARF-4 support (BZ 601887, Tom Tromey). + * Wed Jun 9 2010 Jan Kratochvil - 7.1-25.fc13 - Fix ADL anonymous type crash (BZ 600746, Sami Wagiaalla).