public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Bruno Larsen <blarsen@redhat.com>
Cc: Joel Brobecker <brobecker@adacore.com>,
	Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] [gdb/testsuite] test a function call by hand fron pretty printer
Date: Sun, 6 Mar 2022 14:43:33 +0400	[thread overview]
Message-ID: <YiSQVVdMVZj2V4xf@adacore.com> (raw)
In-Reply-To: <edcc19f5-51d1-0815-23a4-b7a35fa76141@redhat.com>

> > > +# This file is part of the GDB testsuite.  It tests Python-based
> > > +# pretty-printing for the CLI.
> > > +
> > > +load_lib gdb-python.exp
> > > +
> > > +standard_testfile
> > > +
> > > +# Start with a fresh gdb.
> > > +gdb_exit
> > > +gdb_start
> > 
> > I think you can drop the gdb_exit/gdb_start part (it is taken care
> > of by prepare_for_testing).
> 
> If I remove this, skip_python_tests throws a TCL error, complaining
> about not having a use_gdb_stub variable. If I change the order of the
> 2 if statements, the error isn't there anymore but we compile the code
> and don't use it. Do I keep the exit+start here and document why I
> need it, or do I change the order of the if statements?

Grumpf. This is a bug in skip_python_tests_prompt, in my opinion,
which seems to make an unwarranted assumption about a GDB being
available. It looks like a simple call to "gdb_start" at the start
of that function should be sufficient to fix the issue, as gdb_start
only starts GDB if one hasn't already been started.

But I don't want this fix to be a precondition to your patch.
In the meantime, I think a comment explaining why is good enough.
I keep flip-flopping between the two options and can't decide,
so I went with the simplest and less wasteful (avoiding to do
build a test program if the testcase is not going to run).

> > There is an oddity here; the name of the function seems to indicate
> > that this should be "off" rather than "on", here. Can you confirm
> > whether this is correct or not?
> 
> It is, the name of the function is wrong. More details below
> 
> > 
> > > +    set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
> > > +    gdb_test_no_output "source ${remote_python_file}" "load python file"
> > > +
> > > +    return 0
> > > +}
> > > +
> > > +proc start_test_pretty {} {
> > 
> > This function seems to be identical to the start_test_no_pretty.
> > Can you perhaps factorize this into a single function, possibly
> > with one argument being the "on/off" value to be used for
> > the "print pretty" setting?
> > 
> > If, for some reason I missed, it is better not to factorize in
> > this case, the same comments I made above should apply here.
> 
> The difference is when the pretty printer is turned on, actually. The
> "no_pretty" option doesn't enter the frame that creates our problems,
> just turns the pretty printer on and waits by the door - setup for
> step and continue, whereas the "pretty" option enters the frame and
> then turns the pretty printer on - setup for backtrace, finish, up and
> down.
> 
> I'll change the function to receive the breaking location instead.
> Sorry about the confusion.

Alright! Thanks for the explanation.


-- 
Joel

  reply	other threads:[~2022-03-06 10:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-23 18:57 Bruno Larsen
2022-02-27 12:39 ` Joel Brobecker
2022-02-28 12:13   ` Bruno Larsen
2022-03-06 10:43     ` Joel Brobecker [this message]
2022-03-07 13:09 ` [PATCH v2] " Bruno Larsen
2022-03-13  6:13   ` Joel Brobecker
2022-03-14 20:39 ` [PATCH v3] [gdb/testsuite] test a function call by hand from " Bruno Larsen
2022-03-19 14:41   ` Joel Brobecker
2022-03-21 20:21   ` Simon Marchi
2022-03-23 15:37     ` Bruno Larsen
2022-03-24 14:18       ` 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=YiSQVVdMVZj2V4xf@adacore.com \
    --to=brobecker@adacore.com \
    --cc=blarsen@redhat.com \
    --cc=gdb-patches@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).