From: Pedro Alves <palves@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>, Tom Tromey <tom@tromey.com>
Cc: Xavier Roirand <roirand@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [RFC] expected behavior for "bt" command used with "set language ..." ?
Date: Thu, 25 Jan 2018 12:13:00 -0000 [thread overview]
Message-ID: <5e5147c1-6790-c18c-6286-f5f97ca9be09@redhat.com> (raw)
In-Reply-To: <20180123115152.26mi46zogpbuodn7@adacore.com>
On 01/23/2018 11:51 AM, Joel Brobecker wrote:
>> Xavier> When printing one frame arguments, should we do it using the language
>> Xavier> of the frame, and it may be different for each frame in a single "bt"
>> Xavier> command or should we leave things as they are, and possibly allow the
>> Xavier> "bt" command to display weird values for frame arguments or even
>> Xavier> worse, crash GDB because the user set language manually so he has to
>> Xavier> know what he's doing ?
>>
>> I tend to think the answer should be:
>>
>> * If the language is "auto", then use each frame's language; otherwise
>> * If the user specified a particular language, use that language for
>> everything.
I think that this is what makes sense.
The way I see it, "bt" should print frames as-if the user had manually
done a sequence of "up", "frame", "up", frame", ...
And in that case, we print each frame's arguments using the
frame's language (if language is "auto"), because "up" selects a
new frame, and that switches the language accordingly. Right?
>
> I don't really have a strong opinion on this. But I thought I'd mention
> that using a language to dump the value of a variable described using
> another language can be a bit iffy, and lead to fairly mysterious
> errors. If I was a fan of FUD, I might even say it can lead to crashes,
> if the code is not careful enough. For instance, who knows what it's
> going to look like asking Ada to print come C++ stuff, or vice-versa...
IMO, the uncertainty comes from lack of tests. So instead of FUDing, we
should add some tests to raise the confidence level.
For example, we could have a testcase that picks a couple Ada constructs
that are quite unique to Ada, and then cycle through all languages,
printing the objects. Same for C++.
And another testcase that calls C++ from Ada, and then does something
like:
while !$outermost_frame
foreach lang $supported_languages
gdb_test "set language $lang"
gdb_test "frame"
gdb_test "up"
Thanks,
Pedro Alves
prev parent reply other threads:[~2018-01-25 12:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-17 17:17 Xavier Roirand
2018-01-19 20:09 ` Tom Tromey
2018-01-23 11:52 ` Joel Brobecker
2018-01-23 13:32 ` Matt Rice
2018-01-24 21:30 ` Tom Tromey
2018-01-25 12:13 ` Pedro Alves [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=5e5147c1-6790-c18c-6286-f5f97ca9be09@redhat.com \
--to=palves@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=roirand@adacore.com \
--cc=tom@tromey.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