From: Gary Benson <gbenson@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: Ruslan Kabatsayev <b7.10110111@gmail.com>,
psmith@gnu.org, gdb@sourceware.org
Subject: Re: gdb -batch always exits with status 0
Date: Wed, 22 Aug 2018 09:07:00 -0000 [thread overview]
Message-ID: <20180822090706.GA26554@blade.nx> (raw)
In-Reply-To: <3408f7e7-91c9-1230-dbf1-51a3bdd0c6f6@redhat.com>
On 17 August 2018 at 19:29, Pedro Alves <palves@redhat.com> wrote:
> To me, it feels like you're not discussing the real issue.
>
> GDB _does_ stop processing scripts on first error.
>
> $ cat file1
> fail1
> fail2
> fail3
> $ cat file2
> fail4
> fail5
> fail6
> $ gdb -q -x file1 -x file2
> file1:1: Error in sourced command file:
> Undefined command: "fail1". Try "help".
> file2:1: Error in sourced command file:
> Undefined command: "fail4". Try "help".
> (gdb)
>
> Note, fail2, fail3, fail5 and fail6 were not run.
>
> What GDB does not do is consider an error from inside a script
> sourced from the shell command line as reason to fail out. So for
> example above, I think Gary is arguing that GDB should have behaved
> like this:
>
> $ gdb -q -x file1 -x file2
> file1:1: Error in sourced command file:
> Undefined command: "fail1". Try "help".
> (gdb)
>
> I.e., "file2" was not sourced.
>
> In this aspect, "-ex" behaves exactly like "-x" -- you can think
> of -ex as gdb internally pasting the -ex command in a script
> and then sourcing it with -x.
I don't know if I'm overthinking things, but basically I looked at
the different places a command error can occur:
/etc/gdbinit
~/.gdbinit
-ix
-iex
-cd
-d
PROG
-p
CORE
.gdbinit in cwd
-x
-ex
For some of these it does seem to make sense to exit, e.g. if
processing "-p PID" fails to end up attached to a process.
But nobody is asking for change, nobody's having a problem
with this, so I'm going to leave this here.
Cheers,
Gary
prev parent reply other threads:[~2018-08-22 9:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-05 14:47 Gary Benson
2018-07-05 14:55 ` Ruslan Kabatsayev
2018-07-05 15:23 ` Paul Smith
2018-08-17 11:03 ` Gary Benson
2018-08-17 11:25 ` Ruslan Kabatsayev
2018-08-17 13:24 ` Paul Smith
2018-08-17 15:23 ` Gary Benson
2018-08-17 15:44 ` Ruslan Kabatsayev
2018-08-17 16:03 ` Gary Benson
2018-08-17 18:30 ` Pedro Alves
2018-08-22 9:07 ` Gary Benson [this message]
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=20180822090706.GA26554@blade.nx \
--to=gbenson@redhat.com \
--cc=b7.10110111@gmail.com \
--cc=gdb@sourceware.org \
--cc=palves@redhat.com \
--cc=psmith@gnu.org \
/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