public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Simon Marchi <simon.marchi@ericsson.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Introduce gdb_interact in testsuite
Date: Wed, 21 Jan 2015 01:42:00 -0000	[thread overview]
Message-ID: <CADPb22TbuWnvcWV8FfcAB0aDctW0EwbQ4HQakda6NzwJQVJaGg@mail.gmail.com> (raw)
In-Reply-To: <1421340032-30709-1-git-send-email-simon.marchi@ericsson.com>

On Thu, Jan 15, 2015 at 8:40 AM, Simon Marchi <simon.marchi@ericsson.com> wrote:
>
> gdb_interact is a small utility that we have found quite useful to debug
> test cases.
>
> Putting gdb_interact in a test suspends it and allows to interact with
> gdb to inspect whatever you want. You can then type ">>>" to resume the
> test execution. Of course, this is only for gdb devs. It wouldn't make
> sense to leave a gdb_interact permanently in a test case.
>
> When starting the interaction with the user, the script prints this
> banner:
>
> +------------------------------------------+
> | Script interrupted, you can now interact |
> | with by gdb. Type >>> to continue.       |
> +------------------------------------------+
>
> Notes:
> * When gdb is launched, the gdb_spawn_id variable (lib/gdb.exp) is
>   assigned -1. Given the name, I would expect it to contain the gdb
>   expect spawn id, which is needed for interact. I changed all places
>   that set gdb_spawn_id to -1 to set it to the actual gdb spawn id
>   instead.
>
> * When entering the "interact" mode, the last (gdb) prompt is already
>   eaten by expect, so it doesn't show up on the terminal. Subsequent
>   prompts do appear though. We tried to print "(gdb)" just before the
>   interact to replace it. However, it could be misleading if you are
>   debugging an MI test case, it makes you think that you are typing in a
>   CLI prompt, when in reality it's MI. In the end I decided that since
>   the feature is for developers who know what they're doing and that one
>   is normally consciously using gdb_interact, the script doesn't need
>   to babysit the user.
>
> * There are probably some quirks depending on where in the script
>   gdb_interact appears (e.g. it could interfere with following
>   commands and make them fail), but it works for most cases. Quirks can
>   always be fixed later.
>
> The idea and original implementation was contributed by Anders
> Granlund, a colleague of mine. Thanks to him.
>
> gdb/testsuite/ChangeLog:
>
>         * gdb.base/statistics.exp: Assign spawn id to gdb_spawn_id.
>         * gdb.base/valgrind-db-attach.exp: Same.
>         * gdb.base/valgrind-infcall.exp: Same.
>         * lib/mi-support.exp (default_mi_gdb_start): Same.
>         * lib/prompt.exp (default_prompt_gdb_start): Same.
>         * lib/gdb.exp (default_gdb_spawn): Same.
>         (gdb_interact): New.

[Apologies for the resend.]

I'm not sure why we're assigning -1 instead of a usable value,
but I can't find anything to suggest assigning a real id will
cause problems.

Plus given how trivial gdb_interact is, the patch is fine by me.

Another way such things are debugged is by first running tests
with TRANSCRIPT=y, and then massaging the transcript.N files
afterwards.  I'm all for adding more ways of debugging tests.
Thanks!

  reply	other threads:[~2015-01-21  1:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-15 16:41 Simon Marchi
2015-01-21  1:42 ` Doug Evans [this message]
2015-01-23  0:21   ` Simon Marchi
2015-01-23  0:26     ` Simon Marchi

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=CADPb22TbuWnvcWV8FfcAB0aDctW0EwbQ4HQakda6NzwJQVJaGg@mail.gmail.com \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@ericsson.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).