From owner-svn-src-stable-11@freebsd.org Fri Feb 3 01:23:40 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6951CCD322; Fri, 3 Feb 2017 01:23:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6BD94122B; Fri, 3 Feb 2017 01:23:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v131NdH4094369; Fri, 3 Feb 2017 01:23:39 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v131Ndww094368; Fri, 3 Feb 2017 01:23:39 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201702030123.v131Ndww094368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 3 Feb 2017 01:23:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313129 - stable/11/cddl/contrib/opensolaris/common/ctf X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2017 01:23:40 -0000 Author: markj Date: Fri Feb 3 01:23:39 2017 New Revision: 313129 URL: https://svnweb.freebsd.org/changeset/base/313129 Log: MFC r305055: Recursively enumerate anonymous structs and unions in ctf_member_info(). Modified: stable/11/cddl/contrib/opensolaris/common/ctf/ctf_types.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/common/ctf/ctf_types.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/common/ctf/ctf_types.c Fri Feb 3 01:21:56 2017 (r313128) +++ stable/11/cddl/contrib/opensolaris/common/ctf/ctf_types.c Fri Feb 3 01:23:39 2017 (r313129) @@ -644,11 +644,8 @@ ctf_type_compat(ctf_file_t *lfp, ctf_id_ } } -/* - * Return the type and offset for a given member of a STRUCT or UNION. - */ -int -ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name, +static int +_ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name, ulong_t off, ctf_membinfo_t *mip) { ctf_file_t *ofp = fp; @@ -673,9 +670,13 @@ ctf_member_info(ctf_file_t *fp, ctf_id_t ((uintptr_t)tp + increment); for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, mp++) { + if (mp->ctm_name == 0 && + _ctf_member_info(fp, mp->ctm_type, name, + mp->ctm_offset + off, mip) == 0) + return (0); if (strcmp(ctf_strptr(fp, mp->ctm_name), name) == 0) { mip->ctm_type = mp->ctm_type; - mip->ctm_offset = mp->ctm_offset; + mip->ctm_offset = mp->ctm_offset + off; return (0); } } @@ -684,9 +685,14 @@ ctf_member_info(ctf_file_t *fp, ctf_id_t ((uintptr_t)tp + increment); for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, lmp++) { + if (lmp->ctlm_name == 0 && + _ctf_member_info(fp, lmp->ctlm_name, name, + (ulong_t)CTF_LMEM_OFFSET(lmp) + off, mip) == 0) + return (0); if (strcmp(ctf_strptr(fp, lmp->ctlm_name), name) == 0) { mip->ctm_type = lmp->ctlm_type; - mip->ctm_offset = (ulong_t)CTF_LMEM_OFFSET(lmp); + mip->ctm_offset = + (ulong_t)CTF_LMEM_OFFSET(lmp) + off; return (0); } } @@ -696,6 +702,17 @@ ctf_member_info(ctf_file_t *fp, ctf_id_t } /* + * Return the type and offset for a given member of a STRUCT or UNION. + */ +int +ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name, + ctf_membinfo_t *mip) +{ + + return (_ctf_member_info(fp, type, name, 0, mip)); +} + +/* * Return the array type, index, and size information for the specified ARRAY. */ int