X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=binutils%2Fdwarf.c;h=c2e73f72fe8495c395d68f666e0d8d3a8907b247;hb=a78a19b15254de31c3d38b7e27469aaef0a30e97;hp=61373bf44a2c6411921b64fa6c95917053a0883b;hpb=070b775f03ebdab6d0d007787fe19b916af4439c;p=deliverable%2Fbinutils-gdb.git diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 61373bf44a..c2e73f72fe 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -98,6 +98,7 @@ int do_debug_cu_index; int do_wide; int do_debug_links; int do_follow_links; +bfd_boolean do_checks; int dwarf_cutoff_level = -1; unsigned long dwarf_start_die; @@ -3266,6 +3267,7 @@ process_debug_info (struct dwarf_section * section, if ((do_loc || do_debug_loc || do_debug_ranges) && num_debug_info_entries == 0 + && alloc_num_debug_info_entries > unit && ! do_types) { debug_information [unit].cu_offset = cu_offset; @@ -3739,6 +3741,10 @@ display_formatted_table (unsigned char * data, const char * table_name = is_dir ? N_("Directory Table") : N_("File Name Table"); SAFE_BYTE_GET_AND_INC (format_count, data, 1, end); + if (do_checks && format_count > 5) + warn (_("Unexpectedly large number of columns in the %s (%u)\n"), + table_name, format_count); + format_start = data; for (formati = 0; formati < format_count; formati++) { @@ -3752,17 +3758,18 @@ display_formatted_table (unsigned char * data, } READ_ULEB (data_count, data, end); - if (data == end) + if (data_count == 0) { - warn (_("%s: Corrupt entry count\n"), table_name); + printf (_("\n The %s is empty.\n"), table_name); return data; } - - if (data_count == 0) + else if (data == end) { - printf (_("\n The %s is empty.\n"), table_name); + warn (_("%s: Corrupt entry count - expected %s but none found\n"), + table_name, dwarf_vmatoa ("x", data_count)); return data; } + else if (format_count == 0) { warn (_("%s: format count is zero, but the table is not empty\n"), @@ -4343,8 +4350,9 @@ display_debug_lines_decoded (struct dwarf_section * section, /* Skip directories format. */ SAFE_BYTE_GET_AND_INC (format_count, data, 1, end); - if (format_count > 1) - warn ("Unexpectedly large number of columns in the directory name table (%u)\n", format_count); + if (do_checks && format_count > 1) + warn (_("Unexpectedly large number of columns in the directory name table (%u)\n"), + format_count); format_start = data; for (formati = 0; formati < format_count; formati++) { @@ -4416,9 +4424,9 @@ display_debug_lines_decoded (struct dwarf_section * section, /* Skip files format. */ SAFE_BYTE_GET_AND_INC (format_count, data, 1, end); - if (format_count > 5) - warn ("Unexpectedly large number of columns in the file name table (%u)\n", format_count); - format_count = 2; + if (do_checks && format_count > 5) + warn (_("Unexpectedly large number of columns in the file name table (%u)\n"), + format_count); format_start = data; for (formati = 0; formati < format_count; formati++) { @@ -7402,7 +7410,8 @@ regname_internal_riscv (unsigned int regno) document. */ switch (regno) { -#define DECLARE_CSR(NAME,VALUE,CLASS) case VALUE + 4096: name = #NAME; break; +#define DECLARE_CSR(NAME,VALUE,CLASS,DEFINE_VER,ABORT_VER) \ + case VALUE + 4096: name = #NAME; break; #include "opcode/riscv-opc.h" #undef DECLARE_CSR