From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2 1/3] Change how Python architecture and language are handled
Date: Mon, 31 Jan 2022 08:20:23 -0500 [thread overview]
Message-ID: <3fcf8cec-cf61-95b3-dde9-fc21f10e707f@polymtl.ca> (raw)
In-Reply-To: <20220110215144.1714909-2-tromey@adacore.com>
On 2022-01-10 16:51, Tom Tromey via Gdb-patches wrote:
> Currently, gdb's Python layer captures the current architecture and
> language when "entering" Python code. This has some undesirable
> effects, and so this series changes how this is handled.
>
> First, there is code like this:
>
> gdbpy_enter enter_py (python_gdbarch, python_language);
>
> This is incorrect, because both of these are NULL when not otherwise
> assigned. This can cause crashes in some cases -- I've added one to
> the test suite. (Note that this crasher is just an example, other
> ones along the same lines are possible.)
>
> Second, when the language is captured in this way, it means that
> Python code cannot affect the current language for its own purposes.
> It's reasonable to want to write code like this:
>
> gdb.execute('set language mumble')
> ... stuff using the current language
> gdb.execute('set language previous-value')
>
> However, this won't actually work, because the language is captured on
> entry. I've added a test to show this as well.
>
> This patch changes gdb to try to avoid capturing the current values.
> The Python concept of the current gdbarch is only set in those few
> cases where a non-default value is computed or needed; and the
> language is not captured at all -- instead, in the cases where it's
> required, the current language is temporarily changed.
Hi Tom,
Starting with this patch, I get this failure, consistently:
78 (gdb) print pid^M
79 $1 = 1915550^M
80 (gdb) PASS: gdb.threads/killed-outside.exp: get pid of inferior
81 Executing on target: kill -9 1915550 (timeout = 300)
82 builtin_spawn -ignore SIGHUP kill -9 1915550^M
83 continue^M
84 Continuing.^M
85 Couldn't get registers: No such process.^M
86 (gdb) FAIL: gdb.threads/killed-outside.exp: prompt after first continue
Do you see it?
Simon
next prev parent reply other threads:[~2022-01-31 13:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-10 21:51 [PATCH v2 0/3] Improvements to Python parameters Tom Tromey
2022-01-10 21:51 ` [PATCH v2 1/3] Change how Python architecture and language are handled Tom Tromey
2022-01-31 13:20 ` Simon Marchi [this message]
2022-01-10 21:51 ` [PATCH v2 2/3] Fix another crash with gdb parameters in Python Tom Tromey
2022-01-10 21:51 ` [PATCH v2 3/3] Add a way to temporarily set a gdb parameter from Python Tom Tromey
2022-01-13 8:50 ` Lancelot SIX
2022-01-13 19:46 ` Tom Tromey
2022-01-26 14:06 ` [PATCH v2 0/3] Improvements to Python parameters Tom Tromey
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=3fcf8cec-cf61-95b3-dde9-fc21f10e707f@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
--cc=tromey@adacore.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).