From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by sourceware.org (Postfix) with ESMTPS id 2F2843858024 for ; Thu, 1 Apr 2021 00:40:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2F2843858024 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1310VACH062224 for ; Thu, 1 Apr 2021 00:40:32 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 37n2a004jx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 01 Apr 2021 00:40:31 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1310TYvJ019216 for ; Thu, 1 Apr 2021 00:40:31 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2173.outbound.protection.outlook.com [104.47.56.173]) by userp3030.oracle.com with ESMTP id 37n2as2e1j-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 01 Apr 2021 00:40:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gQD5IfUjtfUB7WMi6m0/uEt/Vb04hSjhaR0Vh63Wuni21ay88hm8BgtJ2S7GhSHW3pRXaA6afu8368XHJc4qj3IWEZEhcmIEQULmrrCq1mEoY+lVyoYNREa5XMw0v0cvIgIwhoeWpu1W9JCUCMwTcK4S4CfiEwj2ct6AoiRPkmaKiU4Xf38o3BjASyIXc1GGP4bnDAlTl7971iqKN3vsBy2ZeLr89E3O1Hd1/WfFpdfz8AgGcyl1QLwRQW6aMUCb8UMLCng3YtAKQKJQojghkMvmJGPLe89svua6jbo3Axpx6YFbedTp9RCwKkqe+hG7p04rNnVdnJPwQ7fh7bNByg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fXLJVQgAIw2YV0ZX8hrv6pAyJKn96K61PFfRzK1zlGo=; b=oRHt/+Jn1J+MYCwcJy0m1nQvs0WYUa9mcsIoPebymFwY04iohQ/6VatfJ5SGAheIJYJ5XDH/wNw+erHR6U3YGprvWGFHNMnTxABRs1Lu5pbG5RA5IwVDDodJipznfPObLubs190dLKKNQJseDMxv3RF3/FN8gGGnFAvvz1Cy+AAyK3lQBqU7/7fyzy3Iy64wAz6Ik0Bm4MjB36EQ5a9sqrmcy68IjJfhwUXAopLam/NUh9rEAxHaGVougEz1LKW9zNSEGcXyPckDFTsc+aOlJGgSVtV6oQGx1lwF+2CGmEnB1fZ8ZHxbF+7OwgAkCbQangupBIAlGOeNkKWOcpSFlQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from BN6PR10MB1748.namprd10.prod.outlook.com (2603:10b6:405:9::16) by BN0PR10MB5288.namprd10.prod.outlook.com (2603:10b6:408:12c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.25; Thu, 1 Apr 2021 00:40:28 +0000 Received: from BN6PR10MB1748.namprd10.prod.outlook.com ([fe80::250a:e1c3:3146:8e02]) by BN6PR10MB1748.namprd10.prod.outlook.com ([fe80::250a:e1c3:3146:8e02%9]) with mapi id 15.20.3999.028; Thu, 1 Apr 2021 00:40:28 +0000 From: Weimin Pan To: gdb-patches@sourceware.org Subject: [PATCH,V3 2/3] CTF: handle forward reference type Date: Wed, 31 Mar 2021 20:39:53 -0400 Message-Id: <1617237594-24175-3-git-send-email-weimin.pan@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1617237594-24175-2-git-send-email-weimin.pan@oracle.com> References: <1617237594-24175-1-git-send-email-weimin.pan@oracle.com> <1617237594-24175-2-git-send-email-weimin.pan@oracle.com> Content-Type: text/plain X-Originating-IP: [148.87.23.11] X-ClientProxiedBy: MW4PR03CA0214.namprd03.prod.outlook.com (2603:10b6:303:b9::9) To BN6PR10MB1748.namprd10.prod.outlook.com (2603:10b6:405:9::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.us.oracle.com (148.87.23.11) by MW4PR03CA0214.namprd03.prod.outlook.com (2603:10b6:303:b9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27 via Frontend Transport; Thu, 1 Apr 2021 00:40:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c6a9b216-7908-4072-3f12-08d8f4a6bc30 X-MS-TrafficTypeDiagnostic: BN0PR10MB5288: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vJFMEYeEjdQ4hJ4W/EraRdsEt9wVL9XDpqyZ9kMbHJJrG0MxGd8wziyTnkcxcTyA02d8XLEEQEBTRCr1mBhpVCdHDKJXt4ZoRpOHAC9Q4h7GAvzsUmj3MqwXjpDLX7c09PblXWHcVp8+Yr6p57uljCuf47oZIDtD6DX0YqGO+7DSkr3odA0wNtSa8/oinVwFaeZHbEjzOFiIA9nEyLZcyPse7lr7B4EYryj6mLXmYnvRhrYY5P4ItD9t26vBIW2xmSTvLFBAyhLpR10aTQp7VLA7qE8TGlZRhTGhzTwZXGS2JUSvtC8JIhMykyVxso+ik5y/MDXGU73/hpEJLYmuXbBmu2zJMtQQB+Dm0iCodLXUl95wgxxgbz6vB5rKKghhI6Rqxxr4+FZ+jV5ixDkYO3fUtpwrDjm76RkVYgZ1wGCxP8ccYr9SUfqRlt5JFO2d13P0m8mXxLSPyVy8N1oD25R+KCmi2Qwc6HFENcwAF7KZ/UQoFdAAWUFNYruWrGyGrA27GmKwQL+88imNwhKwKZj/d+ip3aCPuLHf9rUVpiq75aFXPKyNIMynpGiW0yzIuYE8fa/p5KzfUmydQ6gikUb5RDLeu93z0H+qbLSDDk2h42fytwQHqmeSBIJy4ZbeIvX6HplYHitb4599AdUa0w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN6PR10MB1748.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(39850400004)(366004)(136003)(396003)(376002)(346002)(2906002)(7696005)(478600001)(6486002)(66556008)(66476007)(2616005)(6666004)(52116002)(956004)(26005)(8936002)(44832011)(38100700001)(66946007)(6916009)(83380400001)(186003)(16526019)(8676002)(5660300002)(86362001)(36756003)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?YWykmsZGkOiVmuluOOcUIL15WHMegpPzgRVUt6SBZK8OSBW7IiSDKZXlkCeu?= =?us-ascii?Q?Aqx0+tak7h8aB2gSxbhGd0b+OiiCfZnlaumurqLscituHoZBsUPKc57aCHs9?= =?us-ascii?Q?9OBoB6zBQpE/1mYAECskUjD3ZYRuKyd75X3PrbVe1BJmgCqFgDFwhQpzyb0u?= =?us-ascii?Q?YAEcpZrJCXSRfFuXBHvvYxWs3QR7UkVyzDnkH9XXKDipbnYRs/cERfYjCNw9?= =?us-ascii?Q?ATayA57N+bT0iEss6Ud3PtO4On6+r+N1lxiS8thJmpGyE+Y5it/9VIprLQ3B?= =?us-ascii?Q?RPOZNmL1xLqccPfP/dB413R7Dwmu5V9ZKDDE/F1znxUkvrWFel5MXFbITVz+?= =?us-ascii?Q?zpCOx2A8L5w7qqA0Aeg5+JtpJwr9ajLqQz7lrR2l6Pf+Ly39haP3YfweJKhP?= =?us-ascii?Q?3VynV9M3Lmy3NcUZ0cDjb5Ov+C/5xWBHYqjW6HL1UfA2is+2FUKR/dHWfJ6U?= =?us-ascii?Q?3H8cT3Bv/7GJGLheaDazT3axwXeWgSxdsHjNjb78EAfigxon66qq/04ga3oE?= =?us-ascii?Q?Ak8PA6spwYKDx77B1Zh77TLmZkdFiPEfjbMkdE479p96hrjOXKYUzD8y9LMk?= =?us-ascii?Q?UCd2iDHbaUlwi72rJ8XyRh1CaHhzDhTJF45qa6jo06oxPSs61f793EPo/AS5?= =?us-ascii?Q?UzT6NidnEVD/uKq9WMRLmPq8bLAMe/VPoQshqr92GKH9odtvY5Z6c7sloNf1?= =?us-ascii?Q?GqrsHDurJ4RiIc9UdwMYMU7NAnu9qCvNSeF3xEnPlI+WTWuedmmq8x1CpwFq?= =?us-ascii?Q?q4Ja80+RSsboWSF3Q9Kt/OUiOdtkaWXyct2N/NJwoGPIrCOm6o0RRnXws7P4?= =?us-ascii?Q?peBocC0+Ja7GCLMUpTAGyThn54uxqVPyX2Va0oQKVDorGH5ScGdFsRyY2vF7?= =?us-ascii?Q?ZghoW4uqlTn9pssfoIZ26V3uETcy02olJs9ZooiYW2U5O+gAfAZmwHXUNWWB?= =?us-ascii?Q?WONcVTOFWnlDo9ejN5USiokPB5ki46KDqEv/DiZi/MC5y/dLPz6NQrCelT2Q?= =?us-ascii?Q?Tjv6BhoTrSGS61qh8uc1uRW5sy4hGuzWjxdsWZjAWesRLVAhDC7BiKniaCsW?= =?us-ascii?Q?Fx+EwU7EOYyo7t6gySW6YY+VaCPONzsOyOtjaY6irjj3c6Y2uzArkzS8f4HN?= =?us-ascii?Q?Ren3TxxUdFuWM7icm2J4taFd7o1+kkmwxKGxZ+EBaU6uEzp++GtNYUMI2w0L?= =?us-ascii?Q?Bn4Qwod9aOFZ32Yx75QnQ9tgkcdHn5FcnJPZMxz4X/nQb51H4VKNIhgwdISr?= =?us-ascii?Q?EDIQbjO1GalF68SskC/K8rTkP1KUfYp+Sr3f0s3c/IWsszS0aUJ6Jc31DZBq?= =?us-ascii?Q?sW4Y4RuaXMdnIsUx8ns66mrE?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c6a9b216-7908-4072-3f12-08d8f4a6bc30 X-MS-Exchange-CrossTenant-AuthSource: BN6PR10MB1748.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2021 00:40:23.3491 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: e5WwQI4ekjsuLmKr0/aEiWf5PqxYwLeV0j5QY4osfmvJaIbqcZZ9D1CkvzTWmzINqW1N+h1C3E6e4hOutSHdkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5288 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9940 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103310000 definitions=main-2104010001 X-Proofpoint-GUID: jNBHxAa_ZY88McFO4YiKzSuvYE3qP2lY X-Proofpoint-ORIG-GUID: jNBHxAa_ZY88McFO4YiKzSuvYE3qP2lY X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9940 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 impostorscore=0 adultscore=0 clxscore=1015 mlxlogscore=999 phishscore=0 bulkscore=0 priorityscore=1501 spamscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103310000 definitions=main-2104010001 X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_STOCKGEN, MSGID_FROM_MTA_HEADER, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 00:40:35 -0000 Added function fetch_tid_type which calls get_tid_type and will set up the type, associated with a tid, if it is not read in yet. Also implement function read_forward_type which handles the CTF_K_FORWARD kind. Expanded gdb.base/ctf-ptype.exp to add cases with forward references. --- gdb/ChangeLog | 6 +++ gdb/ctfread.c | 78 ++++++++++++++++++++++++++++++------ gdb/testsuite/ChangeLog | 6 +++ gdb/testsuite/gdb.base/ctf-ptype.c | 12 ++++++ gdb/testsuite/gdb.base/ctf-ptype.exp | 2 + 5 files changed, 91 insertions(+), 13 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b555825..82602a5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2021-03-19 Weimin Pan + * ctfread.c (fetch_tid_type): New function, use throughout file. + (read_forward_type): New function. + (read_type_record): Call read_forward_type. + +2021-03-19 Weimin Pan + * ctfread.c (new_symbol): Set function address. (read_func_kind_type): Remove incorrect type name setting. Don't copy name returned from ctf_type_aname_raw throughout file. diff --git a/gdb/ctfread.c b/gdb/ctfread.c index b82deee..f3374eb 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -186,6 +186,8 @@ static struct type *read_typedef_type (struct ctf_context *cp, ctf_id_t tid, static void process_struct_members (struct ctf_context *cp, ctf_id_t tid, struct type *type); +static struct type *read_forward_type (struct ctf_context *cp, ctf_id_t tid); + static struct symbol *new_symbol (struct ctf_context *cp, struct type *type, ctf_id_t tid); @@ -269,6 +271,25 @@ struct ctf_tid_and_type return nullptr; } +/* Fetch the type for TID in CCP OF's tid_and_type hash, add the type to + context CCP if hash is empty or TID does not have a saved type. */ + +static struct type * +fetch_tid_type (struct ctf_context *ccp, ctf_id_t tid) +{ + struct objfile *of = ccp->of; + struct type *typ; + + typ = get_tid_type (of, tid); + if (typ == nullptr) + { + ctf_add_type_cb (tid, ccp); + typ = get_tid_type (of, tid); + } + + return typ; +} + /* Return the size of storage in bits for INTEGER, FLOAT, or ENUM. */ static int @@ -368,7 +389,7 @@ struct ctf_tid_and_type FIELD_NAME (*fp) = name; kind = ctf_type_kind (ccp->fp, tid); - t = get_tid_type (ccp->of, tid); + t = fetch_tid_type (ccp, tid); if (t == nullptr) { t = read_type_record (ccp, tid); @@ -658,7 +679,7 @@ struct ctf_tid_and_type type->set_code (TYPE_CODE_FUNC); ctf_func_type_info (fp, tid, &cfi); - rettype = get_tid_type (of, cfi.ctc_return); + rettype = fetch_tid_type (ccp, cfi.ctc_return); TYPE_TARGET_TYPE (type) = rettype; set_type_align (type, ctf_type_align (fp, tid)); @@ -785,11 +806,11 @@ struct ctf_tid_and_type return nullptr; } - element_type = get_tid_type (objfile, ar.ctr_contents); + element_type = fetch_tid_type (ccp, ar.ctr_contents); if (element_type == nullptr) return nullptr; - idx_type = get_tid_type (objfile, ar.ctr_index); + idx_type = fetch_tid_type (ccp, ar.ctr_index); if (idx_type == nullptr) idx_type = objfile_type (objfile)->builtin_int; @@ -817,7 +838,7 @@ struct ctf_tid_and_type struct objfile *objfile = ccp->of; struct type *base_type, *cv_type; - base_type = get_tid_type (objfile, btid); + base_type = fetch_tid_type (ccp, btid); if (base_type == nullptr) { base_type = read_type_record (ccp, btid); @@ -841,7 +862,7 @@ struct ctf_tid_and_type ctf_dict_t *fp = ccp->fp; struct type *base_type, *cv_type; - base_type = get_tid_type (objfile, btid); + base_type = fetch_tid_type (ccp, btid); if (base_type == nullptr) { base_type = read_type_record (ccp, btid); @@ -867,7 +888,7 @@ struct ctf_tid_and_type struct objfile *objfile = ccp->of; struct type *base_type, *cv_type; - base_type = get_tid_type (objfile, btid); + base_type = fetch_tid_type (ccp, btid); if (base_type == nullptr) { base_type = read_type_record (ccp, btid); @@ -893,7 +914,7 @@ struct ctf_tid_and_type this_type = init_type (objfile, TYPE_CODE_TYPEDEF, 0, name); set_tid_type (objfile, tid, this_type); - target_type = get_tid_type (objfile, btid); + target_type = fetch_tid_type (ccp, btid); if (target_type != this_type) TYPE_TARGET_TYPE (this_type) = target_type; else @@ -912,7 +933,7 @@ struct ctf_tid_and_type struct objfile *of = ccp->of; struct type *target_type, *type; - target_type = get_tid_type (of, btid); + target_type = fetch_tid_type (ccp, btid); if (target_type == nullptr) { target_type = read_type_record (ccp, btid); @@ -929,6 +950,34 @@ struct ctf_tid_and_type return set_tid_type (of, tid, type); } +/* Read all information from a TID of CTF_K_FORWARD. */ + +static struct type * +read_forward_type (struct ctf_context *ccp, ctf_id_t tid) +{ + struct objfile *of = ccp->of; + ctf_dict_t *fp = ccp->fp; + struct type *type; + uint32_t kind; + + type = alloc_type (of); + + gdb::unique_xmalloc_ptr name (ctf_type_aname_raw (fp, tid)); + if (name != NULL && strlen (name.get() ) != 0) + type->set_name (obstack_strdup (&of->objfile_obstack, name.get ())); + + kind = ctf_type_kind_forwarded (fp, tid); + if (kind == CTF_K_UNION) + type->set_code (TYPE_CODE_UNION); + else + type->set_code (TYPE_CODE_STRUCT); + + TYPE_LENGTH (type) = 0; + type->set_is_stub (true); + + return set_tid_type (of, tid, type); +} + /* Read information associated with type TID. */ static struct type * @@ -985,6 +1034,9 @@ struct ctf_tid_and_type case CTF_K_ARRAY: type = read_array_type (ccp, tid); break; + case CTF_K_FORWARD: + type = read_forward_type (ccp, tid); + break; case CTF_K_UNKNOWN: break; default: @@ -1131,7 +1183,7 @@ struct ctf_tid_and_type if ((tid = ctf_lookup_by_symbol (ccp->fp, idx)) == CTF_ERR) return nullptr; - type = get_tid_type (ccp->of, tid); + type = fetch_tid_type (ccp, tid); if (type == nullptr) return nullptr; @@ -1165,7 +1217,7 @@ struct ctf_tid_and_type return nullptr; tid = ctf_lookup_by_symbol (ccp->fp, idx); - ftype = get_tid_type (ccp->of, tid); + ftype = fetch_tid_type (ccp, tid); if ((finfo.ctc_flags & CTF_FUNC_VARARG) != 0) ftype->set_has_varargs (true); ftype->set_num_fields (argc); @@ -1179,7 +1231,7 @@ struct ctf_tid_and_type to find the argument type. */ for (int iparam = 0; iparam < argc; iparam++) { - atyp = get_tid_type (ccp->of, argv[iparam]); + atyp = fetch_tid_type (ccp, argv[iparam]); if (atyp) ftype->field (iparam).set_type (atyp); else @@ -1187,7 +1239,7 @@ struct ctf_tid_and_type } sym = new_symbol (ccp, ftype, tid); - rettyp = get_tid_type (ccp->of, finfo.ctc_return); + rettyp = fetch_tid_type (ccp, finfo.ctc_return); if (rettyp != nullptr) SYMBOL_TYPE (sym) = rettyp; else diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index cf86d1b..22ee55c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2021-03-19 Weimin Pan + * gdb.base/ctf-ptype.c: Add struct link containing a forward + reference type. + * gdb.base/ctf-ptype.exp: Add "ptype struct link" + +2021-03-19 Weimin Pan + * gdb.ctf/funcreturn.exp: New file. * gdb.ctf/whatis.c: Copy from gdb.base. diff --git a/gdb/testsuite/gdb.base/ctf-ptype.c b/gdb/testsuite/gdb.base/ctf-ptype.c index cbc7815..51c7c68 100644 --- a/gdb/testsuite/gdb.base/ctf-ptype.c +++ b/gdb/testsuite/gdb.base/ctf-ptype.c @@ -124,6 +124,18 @@ struct { a symbol. */ t_struct3 v_struct3; +/**** Some misc more complicated things *******/ + +struct link { + struct link *next; +#ifdef __STDC__ + struct link *(*linkfunc) (struct link *self, int flags); +#else + struct link *(*linkfunc) (); +#endif + struct t_struct stuff[3]; +} *s_link; + /**** unions *******/ union t_union { diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp b/gdb/testsuite/gdb.base/ctf-ptype.exp index 056f712..7dd6d95 100644 --- a/gdb/testsuite/gdb.base/ctf-ptype.exp +++ b/gdb/testsuite/gdb.base/ctf-ptype.exp @@ -76,6 +76,8 @@ if [gdb_test "ptype v_t_struct_p->v_float_member" "type = float"]<0 then { return -1 } +gdb_test "ptype struct link" "type = struct link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.3.;\[\r\n\]+\}.*" "ptype linked list structure" + # # test ptype command with unions # -- 1.8.3.1