(bfd_nonfatal_message, report, list_matching_formats): Likewise.
(list_supported_targets): Tidy.
* objdump.c (free_only_list): Formatting.
(slurp_dynamic_symtab): Non-zero exit status for "not a dynamic
object".
(update_source_path): Delete redundant check for NULL filename.
(disassemble_bytes): Error if disassemble_fn returns a value
that won't increment address.
(disassemble_data): Don't capitalize error message.
(read_section_stabs): Likewise.
(main): Return non-zero exit status on bad options.
+2010-10-05 Alan Modra <amodra@gmail.com>
+
+ * bucomm.c (bfd_nonfatal): Flush stdout before output to stderr.
+ (bfd_nonfatal_message, report, list_matching_formats): Likewise.
+ (list_supported_targets): Tidy.
+ * objdump.c (free_only_list): Formatting.
+ (slurp_dynamic_symtab): Non-zero exit status for "not a dynamic
+ object".
+ (update_source_path): Delete redundant check for NULL filename.
+ (disassemble_bytes): Error if disassemble_fn returns a value
+ that won't increment address.
+ (disassemble_data): Don't capitalize error message.
+ (read_section_stabs): Likewise.
+ (main): Return non-zero exit status on bad options.
+
2010-10-03 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/12088
/* bucomm.c -- Bin Utils COMmon code.
Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1998, 2000, 2001, 2002,
- 2003, 2005, 2006, 2007, 2008, 2009
+ 2003, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GNU Binutils.
void
bfd_nonfatal (const char *string)
{
- const char *errmsg = bfd_errmsg (bfd_get_error ());
+ const char *errmsg;
+ fflush (stdout);
+ errmsg = bfd_errmsg (bfd_get_error ());
if (string)
fprintf (stderr, "%s: %s: %s\n", program_name, string, errmsg);
else
const asection *section,
const char *format, ...)
{
- const char *errmsg = bfd_errmsg (bfd_get_error ());
- const char *section_name = NULL;
+ const char *errmsg;
+ const char *section_name;
va_list args;
+ fflush (stdout);
+ errmsg = bfd_errmsg (bfd_get_error ());
+ section_name = NULL;
va_start (args, format);
fprintf (stderr, "%s", program_name);
void
report (const char * format, va_list args)
{
+ fflush (stdout);
fprintf (stderr, "%s: ", program_name);
vfprintf (stderr, format, args);
putc ('\n', stderr);
void
list_matching_formats (char **p)
{
+ fflush (stdout);
fprintf (stderr, _("%s: Matching formats:"), program_name);
while (*p)
fprintf (stderr, " %s", *p++);
list_supported_targets (const char *name, FILE *f)
{
int t;
- const char **targ_names = bfd_target_list ();
+ const char **targ_names;
if (name == NULL)
fprintf (f, _("Supported targets:"));
else
fprintf (f, _("%s: supported targets:"), name);
+ targ_names = bfd_target_list ();
for (t = 0; targ_names[t] != NULL; t++)
fprintf (f, " %s", targ_names[t]);
fprintf (f, "\n");
{
if (! at_least_one_seen)
{
- non_fatal (_("Section '%s' mentioned in a -j option, but not found in any input file"),
+ non_fatal (_("section '%s' mentioned in a -j option, "
+ "but not found in any input file"),
only->name);
exit_status = 1;
}
if (!(bfd_get_file_flags (abfd) & DYNAMIC))
{
non_fatal (_("%s: not a dynamic object"), bfd_get_filename (abfd));
+ exit_status = 1;
dynsymcount = 0;
return NULL;
}
const char *fname;
int i;
- if (filename == NULL)
- return NULL;
-
p = try_print_file_open (filename, filename);
if (p != NULL)
return p;
inf->stream = stdout;
if (insn_width == 0 && inf->bytes_per_line != 0)
octets_per_line = inf->bytes_per_line;
- if (octets < 0)
+ if (octets < (int) opb)
{
if (sfile.pos)
printf ("%s\n", sfile.buffer);
+ if (octets >= 0)
+ {
+ non_fatal (_("disassemble_fn returned length %d"),
+ octets);
+ exit_status = 1;
+ }
break;
}
}
const bfd_arch_info_type *inf = bfd_scan_arch (machine);
if (inf == NULL)
- fatal (_("Can't use supplied machine %s"), machine);
+ fatal (_("can't use supplied machine %s"), machine);
abfd->arch_info = inf;
}
aux.disassemble_fn = disassembler (abfd);
if (!aux.disassemble_fn)
{
- non_fatal (_("Can't disassemble for architecture %s\n"),
+ non_fatal (_("can't disassemble for architecture %s\n"),
bfd_printable_arch_mach (bfd_get_arch (abfd), 0));
exit_status = 1;
return;
if (! bfd_get_section_contents (abfd, stabsect, contents, 0, size))
{
- non_fatal (_("Reading %s section of %s failed: %s"),
+ non_fatal (_("reading %s section of %s failed: %s"),
sect_name, bfd_get_filename (abfd),
bfd_errmsg (bfd_get_error ()));
- free (contents);
exit_status = 1;
+ free (contents);
return NULL;
}
endian = BFD_ENDIAN_LITTLE;
else
{
- non_fatal (_("unrecognized -E option"));
+ nonfatal (_("unrecognized -E option"));
usage (stderr, 1);
}
break;
else
{
non_fatal (_("unrecognized --endian type `%s'"), optarg);
+ exit_status = 1;
usage (stderr, 1);
}
break;