Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch 2/2] Do not bpstat_clear_actions on throw_exception #3
Date: Fri, 26 Aug 2011 13:51:00 -0000	[thread overview]
Message-ID: <201108261451.15850.pedro@codesourcery.com> (raw)
In-Reply-To: <20110826131658.GA1741@host1.jankratochvil.net>

On Friday 26 August 2011 14:16:58, Jan Kratochvil wrote:
> On Fri, 26 Aug 2011 13:45:32 +0200, Pedro Alves wrote:
> > We're not terribly consistent in the printing stuff --- in some cases
> > we end up showing that "<error reading variable: %s>", while in
> > other cases we let the error escape, like in "p *0".
> +
> > I'd find it wrong that a command sequence continues
> > blindly ignoring previous errors by default.
> 
> The problem is this "inconsistence" affects when the command sequences break
> vs. when they continue.
> 
> What about save_gdb_index_command TRY_CATCH there?
> TRY_CATCH + exception_fprintf
> 	Error while writing index for `objfile->name': except.message
> This means the command succeeds even if some .gdb_index files could not be
> produced.  I guess in this case there should have been rather final
> throw_error so that save_gdb_index_command as whole throws one exception.

Yeah, this one's not clear.  The command loops over all objfiles, so
some indexes may have been written.  Maybe it's a matter of documenting
the behavior.

> But it is a nice direction that any command with uncaught exception should
> stop execution + clear all bpstats.  And any command that has all the
> exceptions caught should continue execution + must not clear any bpstats.
>
> Whatever violates these rules is a bug in the command implementation and not
> in the GDB scripts execution control.

Exactly.

> > I think the neatest fix would be to add some try/catch/finaly
> > syntax to the cli.  There was a patch for that posted eons ago:
> > 
> > http://sourceware.org/ml/gdb-patches/2001-12/msg00449.html
> 
> I find this more as obsolete now, for advanced scripting there is already
> Python or a control via MI by Perl, it does not make sense to further extend
> the canned sequences of commands.

I don't agree, but I'm not going to pursue it either now.

I did have a dream of replacing the whole CLI implentation
by a tcl based one (since the syntax is quite similar) sometime
ago.  :-)

> > > (b) bpstat_clear_actions should also abort script_from_file.
> > 
> > Hmm?
> 
> Currently a caught exception:
> Calls bpstat_clear_actions but it continues execution of script_from_file.
> and uncaught exception:
> Calls bpstat_clear_actions and also abort execution of script_from_file.
> 
> I was proposing that any exception - even the caught one should:
> Call bpstat_clear_actions and also abort execution of script_from_file.
> 
> You are proposing and I am going to follow that a caught exception:
> Does not call bpstat_clear_actions, it continues execution of script_from_file.
> while an uncaught exception:
> Call bpstat_clear_actions and also abort execution of script_from_file.
> 
> My goal was to unify bpstat_clear_actions and script_from_file abortion which
> gets accomplished also with your proposal.

Great, thanks.

> > > (c) There should be a new setting "set error-stops-script" with default "on"
> > >     (backward compatibility) where "off" would disable bpstat_clear_actions
> > >     completely.  And I will happily use "set error-stops-script off" in my
> > >     ~/.gdbinit so that I can finally run `gdb -nx -x ./transcript.1'.
> > 
> > Some patch for something like that has been posted before too:
> > 
> >  <http://sourceware.org/ml/gdb-patches/2005-08/msg00120.html>
> 
> This simple patch looks cooked almost in acceptable state, I will hopefully
> finish / check it in to make the testsuite more debuggable.

-- 
Pedro Alves


  reply	other threads:[~2011-08-26 13:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22 14:52 Jan Kratochvil
2011-08-22 17:06 ` Pedro Alves
2011-08-23 20:33   ` Jan Kratochvil
2011-08-24 10:19     ` Pedro Alves
2011-08-26 10:14       ` Jan Kratochvil
2011-08-26 11:45         ` Pedro Alves
2011-08-26 13:17           ` Jan Kratochvil
2011-08-26 13:51             ` Pedro Alves [this message]
2011-08-26 17:38           ` Tom Tromey
2011-08-26 21:04       ` Jan Kratochvil
2011-08-26 21:36         ` Pedro Alves
2011-08-26 21:46           ` Jan Kratochvil

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=201108261451.15850.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    /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