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


On Tue, Jan 26, 2010 at 12:01 AM, Hui Zhu <teawater@gmail.com> wrote:
> About this patch. ?There are a lot of function call "bfd_check_format".
>
> What about add a wrapper of "bfd_check_format_matches" to gdb. ?This
> wrapper call "bfd_check_format_matches" and if it get
> bfd_error_file_ambiguously_recognized, output the format and other
> help message before it return.
> Change the "bfd_check_format" to the wrapper.
>
> Then when gdb get bfd_error_file_ambiguously_recognized, putput the
> help message directly.
>
> What do you think about it?

AIUC, At first glance I don't like it.
"Detect errors at a low level, handle them at a high level."
[ref: "The Practice of Programming"]
Replacing all calls to bfd_check_format with something that prints
anything is the wrong way to go (bfd_check_format, or its wrapper is
too low a level).

Unless by "output the format and other help message before it return"
you mean to just compute the message and leave it to some higher level
caller to print it.  If that's the case I think I'd just add a new
function to compute the error message for the error printer to use.


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