On Thu, Jun 20, 2019 at 12:52 PM Leonard Crestez
<[email protected]> wrote:
>
> On 19.06.2019 11:23, Antonio Borneo wrote:
> > On Mon, Jun 17, 2019 at 2:47 PM Leonard Crestez <[email protected]> 
> > wrote:
>
> >> This is a continuation of my questions on irc. There were some recent
> >> changes regarding how OpenOCD handles command output and as far as I can
> >> tell the default was switched so that all commands will "return" instead
> >> of "display" by default.
> >
> > Yes, I participated at this change.
> > For me the change was necessarily to remove the old crust of printing
> > everything and returning nothing, with the "ocd_" prefix to "try" to
> > get a return value.
>
> I tried playing with ocd_ prefix in older releases but all I remember is
> confusion.
>
> The right solution for grabbing the output of a command is the `capture`
> function, correct?

Oops, apologise. Completely lost this message.

The fact that ocd_ prefix was not working properly is part of the
problem that the implementation of the commands is not always correct.
"capture" should be the right command to do that, but we still miss a
full audit of all the existing commands, so it's still possible it
doesn't work as expected.

> > But the job is not terminated, as you mention for the commands mdX
> >
> >> This doesn't make much sense to me because most commands have
> >> human-readable output which is not intended for machine consumption. For
> >> example "mdw" does pretty alignments, "targets" shows a table and "reg"
> >> shows register names.
> > Yes, the commands mdX should printout the value with all the nice and
> > funny format, and only return the eventual error value.
> > For reading a value from memory we already have mem2array and the
> > wrappers mrX, so no need to use mdX.
>
> > I think the proper function for printing in mdX (and in most other
> > places) should be command_output_text(). This prints only to the
> > terminal that issued the command without polluting the other terminals
> > (in case you have several telnet and gdb connections to a single
> > openocd).
>
> So you're saying that patches switching mdX back to "display" would be
> welcome, correct?

Definitively yes!
>From my last post in this thread I have spent some time reviewing the
different LOG_xxx(), command_output_text() and command_print(), the
impact on changing current code, and I have changed my mind.
At least for the mdX functions, the fix should simply require to
change command_print() to LOG_USER() in target_handle_md_output(). Do
not use command_output_text() as I wrote above.

Would you like to propose a patch for mdX and any other oddities you have found?

Antonio


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to