From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org, Joel Brobecker <brobecker@adacore.com>
Subject: Re: [PATCH 2/2] Don't lose language determined from the "main" name (fix gdb.ada/minsyms.exp)
Date: Tue, 21 Nov 2017 17:15:00 -0000 [thread overview]
Message-ID: <87o9nvmu38.fsf@redhat.com> (raw)
In-Reply-To: <de014f13-9253-33d7-6e0d-517e13955755@redhat.com> (Pedro Alves's message of "Tue, 21 Nov 2017 16:56:27 +0000")
On Tuesday, November 21 2017, Pedro Alves wrote:
> On 11/21/2017 04:42 PM, Pedro Alves wrote:
>> On 11/21/2017 04:23 PM, Sergio Durigan Junior wrote:
>
>>> Since this is guaranteed to be an stap probe, WDYT about moving this
>>> scoped_restore_current_language to
>>> stap-probe.c:stap_evaluate_probe_argument? This way we won't be bit by
>>> this problem in other parts that also evaluate arguments of probes.
>>>
>>> Arguably, this should be set for every probe type IMHO, but it's fine if
>>> we just do it for stap probes for now.
>>
>> That sounds like a good idea. But we could do it in
>> evaluate_probe_argument then, which handles all probe types?
>>
>> [In your probe C++ification, that translates to evaluate_probe_argument
>> becoming a non-virtual method of probe, which then calls into a
>> protected virtual method that is overridden by the actual probe
>> implementation (see e.g., the do_xxx methods of class ui_out).]
>
> Hmm, maybe what we need instead is to make expression evaluation
> never set the selected frame (and thus language as side effect)
> if it wasn't selected/set already. Like below. This fixes
> the testcase too. I'll run the full testsuite now. WDYT?
That does look better, indeed. I was trying to think if we'd encounter
any situation where setting the language is on of the desired effects,
but couldn't think of any.
Thanks,
> From c5fd954787e058abcc72aca329414b0edb40ac1b Mon Sep 17 00:00:00 2001
> From: Pedro Alves <palves@redhat.com>
> Date: Tue, 21 Nov 2017 16:50:32 +0000
> Subject: [PATCH] alternative
>
> ---
> gdb/eval.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/gdb/eval.c b/gdb/eval.c
> index 14a3e05..086ac59 100644
> --- a/gdb/eval.c
> +++ b/gdb/eval.c
> @@ -1319,7 +1319,6 @@ evaluate_subexp_standard (struct type *expect_type,
>
> {
> struct symbol *sym = exp->elts[pc + 1].symbol;
> - struct frame_info *frame;
>
> if (noside == EVAL_AVOID_SIDE_EFFECTS)
> return value_zero (SYMBOL_TYPE (sym), not_lval);
> @@ -1329,7 +1328,9 @@ evaluate_subexp_standard (struct type *expect_type,
> error (_("Symbol \"%s\" does not have any specific entry value"),
> SYMBOL_PRINT_NAME (sym));
>
> - frame = get_selected_frame (NULL);
> + frame_info *frame = get_selected_frame_if_set ();
> + if (frame == NULL)
> + frame = get_current_frame ();
> return SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry (sym, frame);
> }
>
> @@ -1381,7 +1382,12 @@ evaluate_subexp_standard (struct type *expect_type,
> + gdbarch_num_pseudo_regs (exp->gdbarch))
> val = value_zero (register_type (exp->gdbarch, regno), not_lval);
> else
> - val = value_of_register (regno, get_selected_frame (NULL));
> + {
> + frame_info *frame = get_selected_frame_if_set ();
> + if (frame == NULL)
> + frame = get_current_frame ();
> + val = value_of_register (regno, frame);
> + }
> if (val == NULL)
> error (_("Value of register %s not available."), name);
> else
> --
> 2.5.5
--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
next prev parent reply other threads:[~2017-11-21 17:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-21 16:11 [PATCH 0/2] Fix a couple gdb.ada/minsyms.exp problems Pedro Alves
2017-11-21 16:11 ` [PATCH 2/2] Don't lose language determined from the "main" name (fix gdb.ada/minsyms.exp) Pedro Alves
2017-11-21 16:23 ` Sergio Durigan Junior
2017-11-21 16:42 ` Pedro Alves
2017-11-21 16:53 ` Sergio Durigan Junior
2017-11-21 16:56 ` Pedro Alves
2017-11-21 17:05 ` Pedro Alves
2017-11-21 17:15 ` Sergio Durigan Junior [this message]
2017-11-21 17:22 ` Pedro Alves
2017-11-21 16:11 ` [PATCH 1/2] gdb.ada/minsyms.exp: Don't hardcode the variable's address Pedro Alves
2017-11-21 16:24 ` Sergio Durigan Junior
2017-11-21 16:50 ` Joel Brobecker
2017-11-21 17:08 ` Pedro Alves
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=87o9nvmu38.fsf@redhat.com \
--to=sergiodj@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.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