+1999-08-09 Ian Lance Taylor <ian@zembu.com>
+
+ * objdump.c (exit_status): New static variable.
+ (nonfatal): New static function.
+ (disassemble_data): Set exit_status on error.
+ (read_section_stabs): Likewise.
+ (display_bfd): Likewise. Call nonfatal rather than bfd_nonfatal.
+ (display_file): Call nonfatal rather than bfd_nonfatal.
+ (display_target_list, display_info_table): Likewise.
+ (main): Return exit_status rather than 0.
+
1999-08-08 Ian Lance Taylor <ian@zembu.com>
* objdump.c (dump_section_header): Update for renaming of
extern int fprintf PARAMS ((FILE *, const char *, ...));
#endif
+/* Exit status. */
+static int exit_status = 0;
+
static char *default_target = NULL; /* default at runtime */
static int show_version = 0; /* show the version number */
static void
usage PARAMS ((FILE *, int));
+static void
+nonfatal PARAMS ((const char *));
+
static void
display_file PARAMS ((char *filename, char *target));
};
\f
static void
+nonfatal (msg)
+ const char *msg;
+{
+ bfd_nonfatal (msg);
+ exit_status = 1;
+}
+\f
+static void
dump_section_header (abfd, section, ignored)
bfd *abfd ATTRIBUTE_UNUSED;
asection *section;
fprintf (stderr, _("%s: Can't disassemble for architecture %s\n"),
program_name,
bfd_printable_arch_mach (bfd_get_arch (abfd), 0));
+ exit_status = 1;
return;
}
{
fprintf (stderr, _("%s: %s has no %s section\n"), program_name,
bfd_get_filename (abfd), strsect_name);
+ exit_status = 1;
return false;
}
bfd_errmsg (bfd_get_error ()));
free (stabs);
free (strtab);
+ exit_status = 1;
return false;
}
bfd_errmsg (bfd_get_error ()));
free (stabs);
free (strtab);
+ exit_status = 1;
return false;
}
if (!bfd_check_format_matches (abfd, bfd_object, &matching))
{
- bfd_nonfatal (bfd_get_filename (abfd));
+ nonfatal (bfd_get_filename (abfd));
if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
{
list_matching_formats (matching);
if (dhandle != NULL)
{
if (! print_debugging_info (stdout, dhandle))
- fprintf (stderr, _("%s: printing debugging information failed\n"),
- bfd_get_filename (abfd));
+ {
+ fprintf (stderr,
+ _("%s: printing debugging information failed\n"),
+ bfd_get_filename (abfd));
+ exit_status = 1;
+ }
}
}
if (syms)
file = bfd_openr (filename, target);
if (file == NULL)
{
- bfd_nonfatal (filename);
+ nonfatal (filename);
return;
}
if (arfile == NULL)
{
if (bfd_get_error () != bfd_error_no_more_archived_files)
- {
- bfd_nonfatal (bfd_get_filename (file));
- }
+ nonfatal (bfd_get_filename (file));
break;
}
if (abfd == NULL)
{
- bfd_nonfatal (dummy_name);
+ nonfatal (dummy_name);
continue;
}
if (! bfd_set_format (abfd, bfd_object))
{
if (bfd_get_error () != bfd_error_invalid_operation)
- bfd_nonfatal (p->name);
+ nonfatal (p->name);
continue;
}
if (abfd == NULL)
{
- bfd_nonfatal (p->name);
+ nonfatal (p->name);
ok = false;
}
if (! bfd_set_format (abfd, bfd_object))
{
if (bfd_get_error () != bfd_error_invalid_operation)
- bfd_nonfatal (p->name);
+ nonfatal (p->name);
ok = false;
}
}
endian = BFD_ENDIAN_LITTLE;
else
{
- fprintf (stderr, _("%s: unrecognized -E option\n"), program_name);
+ fprintf (stderr, _("%s: unrecognized -E option\n"),
+ program_name);
usage (stderr, 1);
}
break;
END_PROGRESS (program_name);
- return 0;
+ return exit_status;
}