public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: use make_scoped_restore to restore gdbpy_current_objfile
Date: Fri, 12 Mar 2021 07:19:46 -0700	[thread overview]
Message-ID: <875z1w4fp9.fsf@tromey.com> (raw)
In-Reply-To: <20210312122217.2883834-1-andrew.burgess@embecosm.com> (Andrew Burgess's message of "Fri, 12 Mar 2021 12:22:17 +0000")

>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:

Andrew> The current mechanism by which the Python gdb.current_objfile is
Andrew> maintained does not allow for nested auto-load events.  It is assumed
Andrew> that one an auto-load script has finished loading then the current
Andrew> objfile should be set back to NULL.  In a nested situation, we should
Andrew> be restoring the previous value.

Andrew> We already have an RAII class to handle save/restore type behaviour,
Andrew> so lets just switch to use that.

Andrew> The test is a little contrived, but is simple enough, and triggers the
Andrew> bug.  The real use case might involve the auto-load script calling
Andrew> functions (either in the just-loaded object file, or in the main
Andrew> executable), which in turn trigger further auto-loads to occur.

That test sure looks like a lot of work :-)

Andrew> 	* python/python.c (gdbpy_source_objfile_script): Use
Andrew> 	make_scoped_restore to restore gdbpy_current_objfile.
Andrew> 	(gdbpy_execute_objfile_script): Likewise.

This looks good to me.

Tom

      reply	other threads:[~2021-03-12 14:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12 12:22 Andrew Burgess
2021-03-12 14:19 ` Tom Tromey [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=875z1w4fp9.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=andrew.burgess@embecosm.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).