From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31310 invoked by alias); 6 Dec 2013 16:00:35 -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 31295 invoked by uid 89); 6 Dec 2013 16:00:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Dec 2013 16:00:34 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rB6G0Qru025067 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 6 Dec 2013 11:00:26 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rB6G039l026188; Fri, 6 Dec 2013 11:00:11 -0500 Message-ID: <52A1F482.5010405@redhat.com> Date: Fri, 06 Dec 2013 16:00:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Sergio Durigan Junior CC: GDB Patches , Tom Tromey Subject: Re: [PATCH] Sanitize gdbarch access on probe/SDT API References: <1386225226-18549-1-git-send-email-sergiodj@redhat.com> <52A079DD.5050101@redhat.com> <52A1D61E.1050707@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-12/txt/msg00249.txt.bz2 On 12/06/2013 03:49 PM, Sergio Durigan Junior wrote: >> > With that out of the way, would it work to pass the frame pointer down >> >instead of the gdbarch? > You mean that the callers should pass the frame pointers, instead of the > relying on the callees to get it by themselves? Something like that. I meant, the patch added a gdbarch parameter to a few functions, and then passes get_frame_arch (frame) down. fetch_probe_arguments (struct value **arg0, struct value **arg1) { struct frame_info *frame = get_selected_frame (_("No frame selected")); + struct gdbarch *gdbarch = get_frame_arch (frame); CORE_ADDR pc = get_frame_pc (frame); struct probe *pc_probe; const struct sym_probe_fns *pc_probe_fns; ... + *arg0 = pc_probe_fns->sym_evaluate_probe_argument (pc_probe, 0, gdbarch); + *arg1 = pc_probe_fns->sym_evaluate_probe_argument (pc_probe, 1, gdbarch); etc. etc. I'm wondering whether after making that spot discussed use the probe's obfile's arch, which I think already it has handy through the probe pointer, we can pass down the frame pointer instead of the gdbarch pointer: fetch_probe_arguments (struct value **arg0, struct value **arg1) { struct frame_info *frame = get_selected_frame (_("No frame selected")); CORE_ADDR pc = get_frame_pc (frame); struct probe *pc_probe; const struct sym_probe_fns *pc_probe_fns; ... + *arg0 = pc_probe_fns->sym_evaluate_probe_argument (pc_probe, 0, frame); + *arg1 = pc_probe_fns->sym_evaluate_probe_argument (pc_probe, 1, frame); etc. That would make the intention of the code clearer, I think, as that way we don't need to explain that much what the gdbarch is for, and where it must come from. -- Pedro Alves