This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Show some tips when file cmd get bfd_error_file_ambiguously_recognized


Thanks Jan.

I make a new patch according to your mail.
And keep the "formats".  Because in before, we use "not in executable
format".  And in other program like nm.c size.c, they all use
"format".  So I think format is better.

Hui

2010-01-19  Hui Zhu  <teawater@gmail.com>

	* exec.c (exec_file_attach): Output some tips when
	bfd_get_error is bfd_error_file_ambiguously_recognized.

On Thu, Jan 14, 2010 at 18:13, Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
> On Thu, 14 Jan 2010 03:43:58 +0100, Hui Zhu wrote:
>> ?exec_file_attach (char *filename, int from_tty)
>> ?{
>> + ?char **matching;
>
> This new variable could be moved to one more inner block.
>
>> + ? ? ? ? ?if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
>> + ? ? ? ? ? ?{
>> + ? ? ? ? ? ? ?char **p = matching;
>
> There is commonly an empty line between declarations and first code line.
>
>> + ? ? ? ? ? ? ?fprintf_filtered (gdb_stderr, _("\"%s\":Matching formats:"),
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?scratch_pathname);
>
> Missing space before "Matching formats".
>
> Isn't it "Matching targets" instead?
>
> Anyway I would still prefer to print even bfd_errmsg() for it as it is now IMO
> unclear why "Matching formats" has been printed and that any error occured:
>
>> "/ls":Matching formats: elf32-nbigmips elf32-ntradbigmips
>> Use command "set gnutarget" handle it.
>
>
>> + ? ? ? ? ? ? ?while (*p)
>> + ? ? ? ? ? ? ? ?fprintf_filtered (gdb_stderr, " %s", *p++);
>
> (Only a personal preference: for (p = matching; *p != NULL; p++)
> ?as this is the most common iterating loop, nothing special to use `while'.)
>
>> + ? ? ? ? ? ? ?fprintf_filtered (gdb_stderr, "\n");
>
> (There exists also fputc_filtered.)
>
>> + ? ? ? ? ? ? ?free (matching);
>
> Use xfree (see gdbint); despite the memory does not come from xmalloc.
>
>> + ? ? ? ? ? ? ?error (_("Use command \"set gnutarget\" handle it."));
>
> Missing "to" - "to handle it"; or just use _("Use command \"...\".").
>
>> + ? ? ? ? ? ?}
>> + ? ? ? ? ?else
>> + ? ? ? ? error (_("\"%s\": not in executable format: %s"),
>> + ? ? ? ? ? ? ? ?scratch_pathname, bfd_errmsg (bfd_get_error ()));
>> ? ? ? }
>>
>> ? ? ? ?/* FIXME - This should only be run for RS6000, but the ifdef is a poor
>
> Your patch has been sent with spaces (' ') instead of tabs ('\t') to follow
> the GNU coding style (not using `indent -nut').
>
>
> Regards,
> Jan
>

Attachment: tips.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]