This is the mail archive of the mailing list for the binutils 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: [PATCH] [ARC] Fix handling of cpu=... disassembler option value

On 06/19/2017 04:17 PM, Anton Kolesov wrote:
> Hi Pedro,

Hi Anton,

>> Actually I find it a bug that this code even prints to stderr directly in the first
>> place.  That'll be the wrong thing to do when this code is being called by GDB
>> -- a gdb Python script can disassemble with output redirected to a string, for
>> example.
> I don't see where it could print right now though - according to the name and
> comment disassemble_info->memory_error_func is used for cases when there is an
> error reading from memory, not an error parsing options.  To address this
> problem, I think a new field should be added to disassembler_info - either a
> function that prints to desired error stream or pointer to error stream itself.

I think it'd have to be a function.  GDB's streams are not FILE pointers;
they're ui_file pointers, which are wrappers around FILE and/or other
kinds of streams [gdb/ui-file.h].

Maybe a better change would be something around making the
"disassemble_init_XXX" routines return/propagate the options parse error
indication up to the caller.  Currently if you pass down an invalid
option you get that "Unrecognized option" sent to stderr, but then
we try disassembling anyway.

TBC, this is not ARC specific and I'm not suggesting that you
should fix this as a sort of prerequisite.

Pedro Alves

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