From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45536 invoked by alias); 11 Feb 2019 17:44:05 -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 45520 invoked by uid 89); 11 Feb 2019 17:44:05 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: mx2.freebsd.org Received: from mx2.freebsd.org (HELO mx2.freebsd.org) (8.8.178.116) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Feb 2019 17:44:04 +0000 Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 41E8991465; Mon, 11 Feb 2019 17:44:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 76C19818F0; Mon, 11 Feb 2019 17:44:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-3.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id EF45698E4; Mon, 11 Feb 2019 17:44:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: [PATCH v2 06/11] Add a more general version of lookup_struct_elt_type. To: Philipp Rudo Cc: Omair Javaid , gdb-patches@sourceware.org References: <9a5a86e3591c8fe6c0fc8efb6151547902a63d3c.1549672588.git.jhb@FreeBSD.org> <20190211112733.698a1b72@laptop-ibm> From: John Baldwin Openpgp: preference=signencrypt Message-ID: <652c13a9-c888-2a3a-7bf8-926bdcf02d0b@FreeBSD.org> Date: Mon, 11 Feb 2019 17:44:00 -0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <20190211112733.698a1b72@laptop-ibm> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 76C19818F0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.967,0]; ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, country:US] X-IsSubscribed: yes X-SW-Source: 2019-02/txt/msg00122.txt.bz2 On 2/11/19 2:27 AM, Philipp Rudo wrote: > Hey Jon > > On Fri, 8 Feb 2019 17:07:22 -0800 > John Baldwin wrote: > >> On 2/8/19 4:40 PM, John Baldwin wrote: >>> lookup_struct_elt is a new function which returns a tuple of >>> information about a component of a structure or union. The returned >>> tuple contains a pointer to the struct field object for the component >>> as well as a bit offset of that field within the structure. If the >>> field names a field in an anonymous substructure, the offset is the >>> "global" offset relative to the original structure type. If noerr is >>> set, then the returned tuple will set the field pointer to NULL to >>> indicate a missing component rather than throwing an error. >>> >>> lookup_struct_elt_type is now reimplemented in terms of this new >>> function. It simply returns the type of the returned field. >> >> Hopefully this is close enough to lk_find_field that you can reuse it. >> One difference is that it defines its own dedicated type and the second is >> that it returns the raw bitpos so that it is hopefully easier to reuse in >> other places. I think you can probably call it and just pass the members >> the returned structure (with an added divide for the offset to convert to >> bytes) to construct an lk_symbol. > > sorry, I totally missed your v1. Oh, this patch wasn't in the v1 is why. I was using parse_and_eval_long with hand-coded offsetof equivalents previously. > The patch looks sane to me. It should be possible to use it in lk_find_field. > I'm not fully sure what the 'check on baseclasses' does for C structs, but I > guess it doesn't harm. Otherwise there would have already been an outcry :) Ok. -- John Baldwin                                                                            Â