From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 43006 invoked by alias); 21 Nov 2017 17:15:34 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 42897 invoked by uid 89); 21 Nov 2017 17:15:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_STOCKGEN,KB_WAM_FROM_NAME_SINGLEWORD,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 21 Nov 2017 17:15:26 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B7F7E2DD778; Tue, 21 Nov 2017 17:15:24 +0000 (UTC) Received: from localhost (unused-10-15-17-193.yyz.redhat.com [10.15.17.193]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B5CF5D97D; Tue, 21 Nov 2017 17:15:24 +0000 (UTC) From: Sergio Durigan Junior To: Pedro Alves Cc: gdb-patches@sourceware.org, Joel Brobecker Subject: Re: [PATCH 2/2] Don't lose language determined from the "main" name (fix gdb.ada/minsyms.exp) References: <1511280661-14725-1-git-send-email-palves@redhat.com> <1511280661-14725-3-git-send-email-palves@redhat.com> <87a7zfob1w.fsf@redhat.com> <687c9d8c-25e5-63e0-c506-dfb1ce79f2f9@redhat.com> Date: Tue, 21 Nov 2017 17:15:00 -0000 In-Reply-To: (Pedro Alves's message of "Tue, 21 Nov 2017 16:56:27 +0000") Message-ID: <87o9nvmu38.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg00451.txt.bz2 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 > 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/