Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Nick Roberts <nickrob@snap.net.nz>,
	 Vladimir Prus <ghost@cs.msu.su>,
	 gdb-patches@sources.redhat.com
Subject: Re: cleanup mi error message handling
Date: Tue, 01 Apr 2008 02:00:00 -0000	[thread overview]
Message-ID: <200804010118.22536.pedro@codesourcery.com> (raw)
In-Reply-To: <18416.13342.147430.549879@kahikatea.snap.net.nz>

A Monday 31 March 2008 01:45:18, Nick Roberts wrote:
>  > The only thing from you I can find is:
>  >
>  >   At other times duplicated error messages are desirable, e.g.,
>  >
>  >   -exec-continue
>  >   ^running
>  >   (gdb)
>  >   &"The program is not being run.\n"
>  >   ^error,msg="The program is not being run."
>  >
>  >   because the first goes to the console for the user to see, the second
>  > to the frontend to be handled as appropriate.
>  >
>  > You still did not say why showing the error message is console is
>  > desirable. If -exec-continue itself is now show in the console, the
>  > error message makes no sense. If -exec-continue is shown, then the error
>  > message is not necessary. Where the flaw in this logic.
>
> I can't understand these sentences.  The command -exec-continue won't
> appear in the console but "The program is not being run." will.  These
> `errors' and other similar ones like "No stack." are reported through error
> () and are normal Gdb output for the user to see.  Currently the console
> can display such messages by reading LOG-STREAM-OUTPUT.
>
> Other errors like:
>
> (gdb)
> -interpreter-exec
> ^error,msg="mi_cmd_interpreter_exec: Usage: -interpreter-exec interp
> command" (gdb)
>
> would be due to a frontend error, so I think it would be probably be best
> to display them elsewhare, e.g., status bar.
>

I think the screen should flash and beep three times, and an email
should be automatically sent the the frontend author :-)  Seriously,
the status bar doesn't feel right for this.  This is not status.  This
is GDB complaining to the frontend -- which means the frontend is broken
and isn't doing what the user wants to.  A message box with a
"submit bug report" button is in order.  If the frontend wants to
probe for gdb version by trying parameters to a command, then, if
all output goes to ^error, and the frontend uses tokens, it is
easy to selectively not display those errors.

> The only way for the frontend to distinguish between the two types of error
> is if the Gdb developer uses the appropriate mechanism, i.e. error () or
> mi_error_message in each case.
>

Then the proper way would be to either add a new ^mi-error, or add
an error class to the output of error, like ^error,class="critical".
Although, I don't advocate the a for this.

> I wouldn't make any changes until a real problem is reported (not just
> Pedro tidying things up).  If a change has to be made I would suggest the
> one below. However this would mean going through all the errors reported in
> MI to work out which ones need mi_error_message but currently use error (),
> e.g., "mi_cmd_stack_list_locals: Usage: PRINT_VALUES".
>

The log stream output doesn't have any token associated, so as we move
to non-stop mode and multi-process debugging, you can't associate
the log stream output with a command, unless the frontend is waiting
for every command to complete before issuing the next -- possibly
to another process or thread.  My point of view is that, all
errors comming from gdb for a particular command should be output
to ^error, and should be collected in a batch and output in one
MI line only.  We can arrange for the those messages that are only
output to & currently to show up in in ^error channel too.  E.g.:

Today:

 333-var-create int * int
 &"Attempt to use a type name as an expression.\n"
 &"mi_cmd_var_create: unable to create variable object\n"
 333^error,msg="mi_cmd_var_create: unable to create variable object"
 (gdb)

Should be:

 333-var-create int * int
 333^error,msg="Unable to create variable object.\nAttempt to use a type name 
as an expression.\n"
 (gdb)

Or, extending MI:

 333-var-create int * int
 333^error,msg="Unable to create variable object.",reason="Attempt to use a  
type name as an expression.\n"
 (gdb)

If the frontend/user wants, it can put the msg in from ^error,msg= in the 
console too, so there's no loss.

-- 
Pedro Alves


WARNING: multiple messages have this Message-ID
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Nick Roberts <nickrob@snap.net.nz>,
	 Vladimir Prus <ghost@cs.msu.su>,
	 gdb-patches@sources.redhat.com
Subject: Re: cleanup mi error message handling
Date: Tue, 01 Apr 2008 00:18:00 -0000	[thread overview]
Message-ID: <200804010118.22536.pedro@codesourcery.com> (raw)
Message-ID: <20080401001800.mwjJF0UC4cOQ9gulLMMVlNb2b-kSgxTz7krRr9ZsP8I@z> (raw)
In-Reply-To: <18416.13342.147430.549879@kahikatea.snap.net.nz>

A Monday 31 March 2008 01:45:18, Nick Roberts wrote:
>  > The only thing from you I can find is:
>  >
>  >   At other times duplicated error messages are desirable, e.g.,
>  >
>  >   -exec-continue
>  >   ^running
>  >   (gdb)
>  >   &"The program is not being run.\n"
>  >   ^error,msg="The program is not being run."
>  >
>  >   because the first goes to the console for the user to see, the second
>  > to the frontend to be handled as appropriate.
>  >
>  > You still did not say why showing the error message is console is
>  > desirable. If -exec-continue itself is now show in the console, the
>  > error message makes no sense. If -exec-continue is shown, then the error
>  > message is not necessary. Where the flaw in this logic.
>
> I can't understand these sentences.  The command -exec-continue won't
> appear in the console but "The program is not being run." will.  These
> `errors' and other similar ones like "No stack." are reported through error
> () and are normal Gdb output for the user to see.  Currently the console
> can display such messages by reading LOG-STREAM-OUTPUT.
>
> Other errors like:
>
> (gdb)
> -interpreter-exec
> ^error,msg="mi_cmd_interpreter_exec: Usage: -interpreter-exec interp
> command" (gdb)
>
> would be due to a frontend error, so I think it would be probably be best
> to display them elsewhare, e.g., status bar.
>

I think the screen should flash and beep three times, and an email
should be automatically sent the the frontend author :-)  Seriously,
the status bar doesn't feel right for this.  This is not status.  This
is GDB complaining to the frontend -- which means the frontend is broken
and isn't doing what the user wants to.  A message box with a
"submit bug report" button is in order.  If the frontend wants to
probe for gdb version by trying parameters to a command, then, if
all output goes to ^error, and the frontend uses tokens, it is
easy to selectively not display those errors.

> The only way for the frontend to distinguish between the two types of error
> is if the Gdb developer uses the appropriate mechanism, i.e. error () or
> mi_error_message in each case.
>

Then the proper way would be to either add a new ^mi-error, or add
an error class to the output of error, like ^error,class="critical".
Although, I don't advocate the a for this.

> I wouldn't make any changes until a real problem is reported (not just
> Pedro tidying things up).  If a change has to be made I would suggest the
> one below. However this would mean going through all the errors reported in
> MI to work out which ones need mi_error_message but currently use error (),
> e.g., "mi_cmd_stack_list_locals: Usage: PRINT_VALUES".
>

The log stream output doesn't have any token associated, so as we move
to non-stop mode and multi-process debugging, you can't associate
the log stream output with a command, unless the frontend is waiting
for every command to complete before issuing the next -- possibly
to another process or thread.  My point of view is that, all
errors comming from gdb for a particular command should be output
to ^error, and should be collected in a batch and output in one
MI line only.  We can arrange for the those messages that are only
output to & currently to show up in in ^error channel too.  E.g.:

Today:

 333-var-create int * int
 &"Attempt to use a type name as an expression.\n"
 &"mi_cmd_var_create: unable to create variable object\n"
 333^error,msg="mi_cmd_var_create: unable to create variable object"
 (gdb)

Should be:

 333-var-create int * int
 333^error,msg="Unable to create variable object.\nAttempt to use a type name 
as an expression.\n"
 (gdb)

Or, extending MI:

 333-var-create int * int
 333^error,msg="Unable to create variable object.",reason="Attempt to use a  
type name as an expression.\n"
 (gdb)

If the frontend/user wants, it can put the msg in from ^error,msg= in the 
console too, so there's no loss.

-- 
Pedro Alves


  parent reply	other threads:[~2008-04-01  0:18 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-24 18:30 Pedro Alves
2008-03-24 19:08 ` Pedro Alves
2008-03-24 22:04 ` Nick Roberts
2008-03-24 22:39   ` Daniel Jacobowitz
2008-03-24 23:37     ` Nick Roberts
2008-03-25  1:00       ` Daniel Jacobowitz
2008-03-25  1:29         ` Nick Roberts
2008-03-25  2:12           ` Daniel Jacobowitz
2008-03-29 14:22             ` Vladimir Prus
2008-03-30  5:13               ` Nick Roberts
2008-03-30  6:06                 ` Vladimir Prus
2008-03-31  0:46                   ` Nick Roberts
2008-03-31  1:59                     ` Daniel Jacobowitz
2008-03-31  2:23                     ` Nick Roberts
2008-03-31  5:07                     ` Vladimir Prus
2008-03-31  6:36                       ` Nick Roberts
2008-03-31  7:10                         ` Vladimir Prus
2008-03-31 15:17                         ` Pedro Alves
2008-03-31 11:24                           ` Pedro Alves
2008-04-01  2:00                     ` Pedro Alves [this message]
2008-04-01  0:18                       ` Pedro Alves
2008-04-01 13:17                       ` Nick Roberts
2008-04-01  3:28                         ` Nick Roberts
2008-03-25  3:52   ` Pedro Alves
2008-04-04 13:33 ` Vladimir Prus
2008-04-04 23:08   ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200804010118.22536.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=ghost@cs.msu.su \
    --cc=nickrob@snap.net.nz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox