[patch] More suggestive error_is_running message

Joel Brobecker brobecker@adacore.com
Wed Apr 11 15:35:00 GMT 2012


> gdb/
> 2012-04-10  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	Provide more specific error_is_running error message.
> 	* infrun.c (error_is_running): Extend the error message text.
> 
> --- a/gdb/infrun.c
> +++ b/gdb/infrun.c
> @@ -3038,7 +3045,9 @@ void
>  error_is_running (void)
>  {
>    error (_("Cannot execute this command while "
> -	   "the selected thread is running."));
> +	   "the selected thread is running.  "
> +	   "(You may want to use 'interrupt' "
> +	   "and wait for '[Thread N] #1 stopped.'.)"));
>  }

Just my two cents on this, I don't really have a strong opinion.

I'd put the new output on a second line, and also avoid duplicating
the actual notification. That way, if we change its format, it doesn't
become inconsistent. There's also the case of being in GDB/MI mode, as
well as the case where the ptid is displayed differently on non-Linux
platforms. Similarly, I think we want to avoid the "interrupt" command
name, because I suspect that many users will be using a graphical
frontend and that's not going to be very helpful to them.

Trying to come up with a concise error message, I couldn't really
find something all that great. I think that it's OK to drop the part
that talks about waiting for the stop notification. Once you've used
it once, you'll know, and for the first time, even if you are fast
enough to send the interrupt and emit the command again before the
thread stopped, you'll get the same message, followed by the stop
notification. That should be enough to understand that you had to wait?

So how about:

    Cannot execute this command while the selected thread is running.
    You need to interrupt this thread's execution first.

?

-- 
Joel



More information about the Gdb-patches mailing list