From: Alexandre Oliva Date: Tue, 23 May 2017 19:29:15 +0000 (-0300) Subject: Merge 'master' branch into users/aoliva/SFN X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ee9f5c7e692678b21578d9c794947b271a48a73;p=thirdparty%2Fbinutils-gdb.git Merge 'master' branch into users/aoliva/SFN Adjusted binutils/testsuite/binutils-all/dw5.W --- 7ee9f5c7e692678b21578d9c794947b271a48a73 diff --cc binutils/dwarf.c index 77fb9457479,cdedbb2e253..e5d0b1d3b47 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@@ -2837,10 -3133,9 +3136,10 @@@ display_formatted_table (unsigned char static int display_debug_lines_raw (struct dwarf_section *section, unsigned char *data, - unsigned char *end) + unsigned char *end, void *file) { unsigned char *start = section->start; + int verbose_view = 0; printf (_("Raw dump of debug contents of section %s:\n\n"), section->name); @@@ -3370,67 -3675,203 +3720,203 @@@ display_debug_lines_decoded (struct dwa break; } - /* Go through the file table again to save the strings. */ - file_table = (File_Entry *) xmalloc (n_files * sizeof (File_Entry)); + file_table = (File_Entry *) xcalloc (1, n_files + * sizeof (File_Entry)); - i = 0; - while (*ptr_file_name_table != 0) + for (entryi = 0; entryi < n_files; entryi++) { - unsigned int bytes_read; - - file_table[i].name = ptr_file_name_table; - ptr_file_name_table += strnlen ((char *) ptr_file_name_table, - end - ptr_file_name_table) + 1; - - /* We are not interested in directory, time or size. */ - file_table[i].directory_index = read_uleb128 (ptr_file_name_table, - & bytes_read, end); - ptr_file_name_table += bytes_read; - file_table[i].modification_date = read_uleb128 (ptr_file_name_table, - & bytes_read, end); - ptr_file_name_table += bytes_read; - file_table[i].length = read_uleb128 (ptr_file_name_table, & bytes_read, end); - ptr_file_name_table += bytes_read; - i++; - } - i = 0; + File_Entry *file = &file_table[entryi]; - /* Print the Compilation Unit's name and a header. */ - if (directory_table == NULL) + format = format_start; + for (formati = 0; formati < format_count; formati++) + { + dwarf_vma content_type, form; + dwarf_vma uvalue; + + content_type = read_uleb128 (format, & bytes_read, end); + format += bytes_read; + form = read_uleb128 (format, & bytes_read, end); + format += bytes_read; + if (data == end) + { + warn (_("Corrupt file name list\n")); + break; + } + switch (content_type) + { + case DW_LNCT_path: + switch (form) + { + case DW_FORM_string: + file->name = data; + break; + case DW_FORM_line_strp: + SAFE_BYTE_GET (uvalue, data, linfo.li_offset_size, + end); + /* Remove const by the cast. */ + file->name = (unsigned char *) + fetch_indirect_line_string (uvalue); + break; + } + break; + case DW_LNCT_directory_index: + switch (form) + { + case DW_FORM_data1: + SAFE_BYTE_GET (file->directory_index, data, 1, + end); + break; + case DW_FORM_data2: + SAFE_BYTE_GET (file->directory_index, data, 2, + end); + break; + case DW_FORM_udata: + file->directory_index = read_uleb128 (data, NULL, + end); + break; + } + break; + } + data = read_and_display_attr_value (0, form, 0, data, end, + 0, 0, + linfo.li_offset_size, + linfo.li_version, + NULL, 1, section, + NULL, '\t'); + } + if (data == end) + { + warn (_("Corrupt file name list\n")); + break; + } + } + } + else + { + if (*data != 0) { - printf (_("CU: %s:\n"), file_table[0].name); - printf (_("File name Line number Starting address View\n")); + unsigned char *ptr_directory_table = data; + + while (data < end && *data != 0) + { + data += strnlen ((char *) data, end - data) + 1; + n_directories++; + } + + /* PR 20440 */ + if (data >= end) + { + warn (_("directory table ends unexpectedly\n")); + n_directories = 0; + break; + } + + /* Go through the directory table again to save the directories. */ + directory_table = (unsigned char **) + xmalloc (n_directories * sizeof (unsigned char *)); + + i = 0; + while (*ptr_directory_table != 0) + { + directory_table[i] = ptr_directory_table; + ptr_directory_table += strnlen ((char *) ptr_directory_table, + ptr_directory_table - end) + 1; + i++; + } } - else + /* Skip the NUL at the end of the table. */ + data++; + + /* Traverse the File Name table just to count the entries. */ + if (data < end && *data != 0) { - unsigned int ix = file_table[0].directory_index; - const char *directory; - - if (ix == 0) - directory = "."; - /* PR 20439 */ - else if (n_directories == 0) - directory = _(""); - else if (ix > n_directories) + unsigned char *ptr_file_name_table = data; + + while (data < end && *data != 0) { - warn (_("directory index %u > number of directories %u\n"), ix, n_directories); - directory = _(""); + unsigned int bytes_read; + + /* Skip Name, directory index, last modification time and length + of file. */ + data += strnlen ((char *) data, end - data) + 1; + read_uleb128 (data, & bytes_read, end); + data += bytes_read; + read_uleb128 (data, & bytes_read, end); + data += bytes_read; + read_uleb128 (data, & bytes_read, end); + data += bytes_read; + + n_files++; } - else - directory = (char *) directory_table[ix - 1]; - if (do_wide || strlen (directory) < 76) - printf (_("CU: %s/%s:\n"), directory, file_table[0].name); - else - printf ("%s:\n", file_table[0].name); + if (data >= end) + { + warn (_("file table ends unexpectedly\n")); + n_files = 0; + break; + } + + /* Go through the file table again to save the strings. */ + file_table = (File_Entry *) xmalloc (n_files * sizeof (File_Entry)); - printf (_("File name Line number Starting address View\n")); + i = 0; + while (*ptr_file_name_table != 0) + { + unsigned int bytes_read; + + file_table[i].name = ptr_file_name_table; + ptr_file_name_table += strnlen ((char *) ptr_file_name_table, + end - ptr_file_name_table) + 1; + + /* We are not interested in directory, time or size. */ + file_table[i].directory_index = read_uleb128 (ptr_file_name_table, + & bytes_read, end); + ptr_file_name_table += bytes_read; + file_table[i].modification_date = read_uleb128 (ptr_file_name_table, + & bytes_read, end); + ptr_file_name_table += bytes_read; + file_table[i].length = read_uleb128 (ptr_file_name_table, & bytes_read, end); + ptr_file_name_table += bytes_read; + i++; + } + i = 0; } + + /* Skip the NUL at the end of the table. */ + data++; } - /* Skip the NUL at the end of the table. */ - data++; + /* Print the Compilation Unit's name and a header. */ + if (file_table == NULL) + ; + else if (directory_table == NULL) + printf (_("CU: %s:\n"), file_table[0].name); + else + { + unsigned int ix = file_table[0].directory_index; + const char *directory; + + if (ix == 0) + directory = "."; + /* PR 20439 */ + else if (n_directories == 0) + directory = _(""); + else if (ix > n_directories) + { + warn (_("directory index %u > number of directories %s\n"), + ix, dwarf_vmatoa ("u", n_directories)); + directory = _(""); + } + else + directory = (char *) directory_table[ix - 1]; + + if (do_wide || strlen (directory) < 76) + printf (_("CU: %s/%s:\n"), directory, file_table[0].name); + else + printf ("%s:\n", file_table[0].name); + } - printf (_("File name Line number Starting address\n")); ++ printf (_("File name Line number Starting address View\n")); saved_linfo = linfo; } diff --cc binutils/testsuite/binutils-all/dw5.W index 00000000000,6f3f8efa124..1fa0d5d07b6 mode 000000,100644..100644 --- a/binutils/testsuite/binutils-all/dw5.W +++ b/binutils/testsuite/binutils-all/dw5.W @@@ -1,0 -1,355 +1,357 @@@ + Contents of the .debug_info section: + + Compilation Unit @ offset 0x0: + Length: 0x160 \(32-bit\) + Version: 5 + Abbrev Offset: 0x0 + Pointer Size: 8 + <0>: Abbrev Number: 6 \(DW_TAG_compile_unit\) + 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 + DW_AT_type : <0x54> + DW_AT_external : 1 + DW_AT_declaration : 1 + <1>: Abbrev Number: 2 \(DW_TAG_variable\) + DW_AT_name : \(indirect string, offset: 0xd\): optopt + DW_AT_decl_file : 3 + DW_AT_decl_line : 80 + DW_AT_type : <0x54> + DW_AT_external : 1 + DW_AT_declaration : 1 + <1>: Abbrev Number: 4 \(DW_TAG_variable\) + DW_AT_name : \(indirect string, offset: 0x25\): xvar + DW_AT_decl_file : 1 + DW_AT_decl_line : 2 + DW_AT_type : <0x54> + DW_AT_external : 1 + DW_AT_location : 9 byte block: 3 (0|34) (0|12) 0 0 0 0 (0|12) (0|34) \(DW_OP_addr: 1234\) + <1>: Abbrev Number: 4 \(DW_TAG_variable\) + DW_AT_name : \(indirect string, offset: 0xcf\): yvar + DW_AT_decl_file : 1 + DW_AT_decl_line : 3 + DW_AT_type : <0x54> + DW_AT_external : 1 + DW_AT_location : 9 byte block: 3 (0|34) (0|12) 0 0 0 0 (0|12) (0|34) \(DW_OP_addr: 1234\) + <1>: Abbrev Number: 4 \(DW_TAG_variable\) + DW_AT_name : \(indirect string, offset: 0xd4\): pvar + DW_AT_decl_file : 1 + DW_AT_decl_line : 4 + DW_AT_type : <0xea> + DW_AT_external : 1 + DW_AT_location : 9 byte block: 3 (0|34) (0|12) 0 0 0 0 (0|12) (0|34) \(DW_OP_addr: 1234\) + <1>: Abbrev Number: 3 \(DW_TAG_pointer_type\) + DW_AT_byte_size : 8 + DW_AT_type : <0x54> + <1>: Abbrev Number: 9 \(DW_TAG_subprogram\) + DW_AT_external : 1 + DW_AT_name : \(indirect string, offset: 0x14\): main + DW_AT_decl_file : 1 + DW_AT_decl_line : 6 + DW_AT_prototyped : 1 + DW_AT_type : <0x54> + 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 + 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 + + Contents of the .debug_rnglists section: + + Offset Begin End + 0000000c 0000000000001234 0000000000001236 + 00000016 0000000000001234 0000000000001239 + 00000020 + + 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 ++File name Line number Starting address View + main.c 6 0x1234 + main.c 6 0x12346 ++main.c 6 0x1234 + + main.c 5 0x1234 + main.c 5 0x1234 ++main.c 5 0x1234 + + diff --cc gas/dwarf2dbg.c index 5f49e387644,e02b6e8f020..04d7ef9e08f --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@@ -2178,41 -1970,8 +2205,43 @@@ dwarf2_finish (void out_debug_aranges (aranges_seg, info_seg); out_debug_abbrev (abbrev_seg, info_seg, line_seg); - out_debug_info (info_seg, abbrev_seg, line_seg, ranges_seg); + out_debug_str (str_seg, &name_sym, &comp_dir_sym, &producer_sym); + out_debug_info (info_seg, abbrev_seg, line_seg, ranges_seg, + name_sym, comp_dir_sym, producer_sym); } } + +/* Perform any deferred checks pertaining to debug information. */ + +void +dwarf2dbg_final_check (void) +{ + /* Perform reset-view checks. Don't evaluate view_assert_failed + recursively: it could be very deep. It's a chain of adds, with + each chain element pointing to the next in X_add_symbol, and + holding the check value in X_op_symbol. */ + while (view_assert_failed) + { + gas_assert (!symbol_resolved_p (view_assert_failed)); + + expressionS *expr = symbol_get_value_expression (view_assert_failed); + symbolS *sym = view_assert_failed; + + /* If view_assert_failed looks like a compound check in the + chain, break it up. */ + if (expr->X_op == O_add && expr->X_add_number == 0 && expr->X_unsigned) + { + view_assert_failed = expr->X_add_symbol; + sym = expr->X_op_symbol; + } + else + view_assert_failed = NULL; + + offsetT failed = resolve_symbol_value (sym); + if (!symbol_resolved_p (sym) || failed) + { + as_bad (_("view number mismatch")); + break; + } + } +}