From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126998 invoked by alias); 7 Nov 2016 22:51:09 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 126971 invoked by uid 9674); 7 Nov 2016 22:51:08 -0000 Date: Mon, 07 Nov 2016 22:51:00 -0000 Message-ID: <20161107225108.126937.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] users/jkratoch/dwarf5gcc-gdb: . X-Git-Refname: refs/heads/users/jkratoch/dwarf5gcc-gdb X-Git-Reftype: branch X-Git-Oldrev: 4cd5f9f6dd33da4a2186ca8bc1e46739a36ba493 X-Git-Newrev: 5f99143a907a0191391a4c691deb530b4420216d X-SW-Source: 2016-q4/txt/msg00013.txt.bz2 List-Id: The branch, users/jkratoch/dwarf5gcc-gdb has been updated via 5f99143a907a0191391a4c691deb530b4420216d (commit) via df3771590d6773e93604a8b6f8a6208b46efed88 (commit) via 3e11dd8696f156b8e79f5b2188be1cf8f894e85b (commit) via 7a34932bce1342c970a03128bbccc5a81ae3da6b (commit) via e680a6b69b4bd173a180419e973a9bf18a000151 (commit) via 9af89fbaecca21b2ca34c142584165066807fb10 (commit) via b93bfa1980fa4d1229874067dd36acd9ac5685cd (commit) from 4cd5f9f6dd33da4a2186ca8bc1e46739a36ba493 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 5f99143a907a0191391a4c691deb530b4420216d Author: Jan Kratochvil Date: Mon Nov 7 23:50:53 2016 +0100 . commit df3771590d6773e93604a8b6f8a6208b46efed88 Merge: 4cd5f9f 3e11dd8 Author: Jan Kratochvil Date: Mon Nov 7 21:58:40 2016 +0100 Merge branch 'dwarf5gcc' into dwarf5gcc-gdb ----------------------------------------------------------------------- Summary of changes: bfd/version.h | 2 +- binutils/dwarf.c | 498 ++++++++++++++++++++++++++++++++----------------- gold/ChangeLog | 5 + gold/configure | 2 +- gold/configure.ac | 2 +- ld/ChangeLog | 14 ++ ld/emultempl/elf32.em | 75 +++++--- ld/ld.texinfo | 43 +++- 8 files changed, 431 insertions(+), 210 deletions(-) First 500 lines of diff: diff --git a/bfd/version.h b/bfd/version.h index f2750d9..fd3d5fd 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,4 +1,4 @@ -#define BFD_VERSION_DATE 20161106 +#define BFD_VERSION_DATE 20161107 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 26af574..333b10e 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -2931,45 +2931,18 @@ read_debug_line_header (struct dwarf_section * section, } static unsigned char * -display_formatted_entry (unsigned char *format, unsigned char *data, - unsigned char *end, - const DWARF2_Internal_LineInfo * linfo, - struct dwarf_section * section) -{ - unsigned char format_count; - unsigned int bytes_read; - int i; - - SAFE_BYTE_GET_AND_INC (format_count, format, 1, end); - for (i = 0; i < format_count; i++) - { - dwarf_vma form; - - read_uleb128 (format, & bytes_read, end); - format += bytes_read; - form = read_uleb128 (format, & bytes_read, end); - format += bytes_read; - putchar ('\t'); - data = read_and_display_attr_value (0, form, 0, data, end, 0, 0, - linfo->li_offset_size, - linfo->li_version, NULL, 0, section, - NULL); - } - return data; -} - -static unsigned char * display_formatted_table (unsigned char *data, unsigned char *start, unsigned char *end, const DWARF2_Internal_LineInfo *linfo, struct dwarf_section *section, const char *what) { - unsigned char *format = data; - unsigned char format_count; + unsigned char *format_start, format_count, *format; dwarf_vma data_count, i; unsigned int bytes_read; + unsigned int last_entry = 0; SAFE_BYTE_GET_AND_INC (format_count, data, 1, end); + format_start = data; for (i = 0; i < format_count; i++) { read_uleb128 (data, & bytes_read, end); @@ -2978,7 +2951,7 @@ display_formatted_table (unsigned char *data, data += bytes_read; if (data == end) { - warn (_("Corrupt directory entry format table entry\n")); + warn (_("Corrupt %s entry format table entry\n"), what); return data; } } @@ -2987,65 +2960,77 @@ display_formatted_table (unsigned char *data, data += bytes_read; if (data == end) { - warn (_("Corrupt directories list\n")); + warn (_("Corrupt %s list\n"), what); return data; } if (data_count == 0) - printf (_("\n The %s Table is empty.\n"), what); - else { - unsigned int last_entry = 0; - unsigned char *format_header = format; + printf (_("\n The %s Table is empty.\n"), what); + return data; + } - printf (_("\n The %s Table (offset 0x%lx):\n"), what, - (long)(data - start)); + printf (_("\n The %s Table (offset 0x%lx):\n"), what, + (long)(data - start)); - printf (_(" Entry")); - SAFE_BYTE_GET_AND_INC (format_count, format_header, 1, end); + printf (_(" Entry")); + format = format_start; + for (i = 0; i < format_count; i++) + { + dwarf_vma content_type; + + content_type = read_uleb128 (format, & bytes_read, end); + format += bytes_read; + switch (content_type) + { + case DW_LNCT_path: + printf (_("\tName")); + break; + case DW_LNCT_directory_index: + printf (_("\tDir")); + break; + case DW_LNCT_timestamp: + printf (_("\tTime")); + break; + case DW_LNCT_size: + printf (_("\tSize")); + break; + case DW_LNCT_MD5: + printf (_("\tMD5")); + break; + default: + printf (_("\t(Unknown format content type %s)"), + dwarf_vmatoa ("u", content_type)); + } + read_uleb128 (format, & bytes_read, end); + format += bytes_read; + } + putchar ('\n'); + + for (i = 0; i < data_count; i++) + { + format = format_start; + printf (" %d", last_entry++); for (i = 0; i < format_count; i++) { - dwarf_vma content_type; + dwarf_vma form; - content_type = read_uleb128 (format_header, & bytes_read, end); - format_header += bytes_read; - switch (content_type) - { - case DW_LNCT_path: - printf (_("\tName")); - break; - case DW_LNCT_directory_index: - printf (_("\tDir")); - break; - case DW_LNCT_timestamp: - printf (_("\tTime")); - break; - case DW_LNCT_size: - printf (_("\tSize")); - break; - case DW_LNCT_MD5: - printf (_("\tMD5")); - break; - default: - printf (_("\t(Unknown format content type %s)"), - dwarf_vmatoa ("u", content_type)); - } - read_uleb128 (format_header, & bytes_read, end); - format_header += bytes_read; + read_uleb128 (format, & bytes_read, end); + format += bytes_read; + form = read_uleb128 (format, & bytes_read, end); + format += bytes_read; + putchar ('\t'); + data = read_and_display_attr_value (0, form, 0, data, end, 0, 0, + linfo->li_offset_size, + linfo->li_version, NULL, 0, + section, NULL); } - putchar ('\n'); - - for (i = 0; i < data_count; i++) + if (data == end) { - printf (" %d\t", last_entry++); - data = display_formatted_entry (format, data, end, linfo, section); - if (data == end) - { - warn (_("Corrupt directory entries list\n")); - return data; - } - putchar ('\n'); + warn (_("Corrupt %s entries list\n"), what); + return data; } + putchar ('\n'); } return data; } @@ -3143,13 +3128,12 @@ display_debug_lines_raw (struct dwarf_section *section, if (linfo.li_version >= 5) { - load_debug_section (str, file); load_debug_section (line_str, file); data = display_formatted_table (data, start, end, &linfo, section, - "Directory"); + _("Directory")); data = display_formatted_table (data, start, end, &linfo, section, - "File name"); + _("File name")); } else { @@ -3431,7 +3415,7 @@ typedef struct static int display_debug_lines_decoded (struct dwarf_section *section, unsigned char *data, - unsigned char *end) + unsigned char *end, void *fileptr) { static DWARF2_Internal_LineInfo saved_linfo; @@ -3448,7 +3432,7 @@ display_debug_lines_decoded (struct dwarf_section *section, File_Entry *file_table = NULL; unsigned int n_files = 0; unsigned char **directory_table = NULL; - unsigned int n_directories = 0; + dwarf_vma n_directories = 0; if (const_strneq (section->name, ".debug_line.") /* Note: the following does not apply to .debug_line.dwo sections. @@ -3496,129 +3480,304 @@ display_debug_lines_decoded (struct dwarf_section *section, return 0; } - if (*data != 0) + if (linfo.li_version >= 5) { - unsigned char *ptr_directory_table = data; + unsigned char *format_start, format_count, *format; + dwarf_vma formati, entryi; + unsigned int bytes_read; + + load_debug_section (line_str, fileptr); - while (data < end && *data != 0) + /* Skip directories format. */ + SAFE_BYTE_GET_AND_INC (format_count, data, 1, end); + format_start = data; + for (formati = 0; formati < format_count; formati++) { - data += strnlen ((char *) data, end - data) + 1; - n_directories++; + read_uleb128 (data, & bytes_read, end); + data += bytes_read; + read_uleb128 (data, & bytes_read, end); + data += bytes_read; } - /* PR 20440 */ - if (data >= end) + n_directories = read_uleb128 (data, & bytes_read, end); + data += bytes_read; + if (data == end) { - warn (_("directory table ends unexpectedly\n")); - n_directories = 0; + warn (_("Corrupt directories list\n")); 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) + for (entryi = 0; entryi < n_directories; entryi++) { - directory_table[i] = ptr_directory_table; - ptr_directory_table += strnlen ((char *) ptr_directory_table, - ptr_directory_table - end) + 1; - i++; - } - } - /* Skip the NUL at the end of the table. */ - data++; + unsigned char **pathp = &directory_table[entryi]; - /* Traverse the File Name table just to count the entries. */ - if (data < end && *data != 0) - { - unsigned char *ptr_file_name_table = data; + format = format_start; + for (formati = 0; formati < format_count; formati++) + { + dwarf_vma content_type, form; + dwarf_vma uvalue; - while (data < end && *data != 0) - { - unsigned int bytes_read; + 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 directories list\n")); + break; + } + switch (content_type) + { + case DW_LNCT_path: + switch (form) + { + case DW_FORM_string: + *pathp = data; + break; + case DW_FORM_line_strp: + SAFE_BYTE_GET (uvalue, data, linfo.li_offset_size, + end); + /* Remove const by the cast. */ + *pathp = (unsigned char *) + fetch_indirect_line_string (uvalue); + 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); + } + if (data == end) + { + warn (_("Corrupt directories list\n")); + break; + } + } - /* 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; + /* Skip files format. */ + SAFE_BYTE_GET_AND_INC (format_count, data, 1, end); + format_start = data; + for (formati = 0; formati < format_count; formati++) + { read_uleb128 (data, & bytes_read, end); data += bytes_read; read_uleb128 (data, & bytes_read, end); data += bytes_read; - - n_files++; } - if (data >= end) + n_files = read_uleb128 (data, & bytes_read, end); + data += bytes_read; + if (data == end) { - warn (_("file table ends unexpectedly\n")); - n_files = 0; + warn (_("Corrupt file name list\n")); 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]; + + format = format_start; + for (formati = 0; formati < format_count; formati++) + { + dwarf_vma content_type, form; + dwarf_vma uvalue; - /* Print the Compilation Unit's name and a header. */ - if (directory_table == NULL) + 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); + } + 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\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++; + } hooks/post-receive -- Repository for Project Archer.