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;
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++)
{
}
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"),
/* Skip directories format. */
SAFE_BYTE_GET_AND_INC (format_count, data, 1, end);
+ 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++)
{
break;
}
- directory_table = (unsigned char **)
- xmalloc (n_directories * sizeof (unsigned char *));
+ if (n_directories == 0)
+ directory_table = NULL;
+ else
+ directory_table = (unsigned char **)
+ xmalloc (n_directories * sizeof (unsigned char *));
for (entryi = 0; entryi < n_directories; entryi++)
{
/* Skip files format. */
SAFE_BYTE_GET_AND_INC (format_count, data, 1, end);
+ 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++)
{
}
READ_ULEB (n_files, data, end);
- if (data == end)
+ if (data == end && n_files > 0)
{
warn (_("Corrupt file name list\n"));
break;
}
- file_table = (File_Entry *) xcalloc (1, n_files
- * sizeof (File_Entry));
+ if (n_files == 0)
+ file_table = NULL;
+ else
+ file_table = (File_Entry *) xcalloc (1, n_files
+ * sizeof (File_Entry));
for (entryi = 0; entryi < n_files; entryi++)
{
/* Print the Compilation Unit's name and a header. */
if (file_table == NULL)
- ;
+ printf (_("CU: No directory table\n"));
else if (directory_table == NULL)
printf (_("CU: %s:\n"), file_table[0].name);
else
printf ("%s:\n", file_table[0].name);
}
- printf (_("File name Line number Starting address View Stmt\n"));
+ if (n_files > 0)
+ printf (_("File name Line number Starting address View Stmt\n"));
+ else
+ printf (_("CU: Empty file name table\n"));
saved_linfo = linfo;
}
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