From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 4FDCF3858423 for ; Wed, 27 Oct 2021 16:07:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4FDCF3858423 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19RF5Kcm028947; Wed, 27 Oct 2021 16:07:05 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 3bx4fjm77r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Oct 2021 16:07:05 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 19RG1aQx125555; Wed, 27 Oct 2021 16:07:03 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2173.outbound.protection.outlook.com [104.47.56.173]) by aserp3020.oracle.com with ESMTP id 3bx4gcxam9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Oct 2021 16:07:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WYnaa3GJs+Nx+8lq24jM4v0s4L2FUHIiFA0Ph1xOpYqXR8utWjvv0+HwK5YrMdg9lVSxBNMYQFnl/yF61HIcVVP/wdrLFuUcZQsgEKjwMGTM9Hd6Sb3pWLZe8Ju8twgB41ARQAq2Iyz7xzuPduTklI7dTxcDyelVkzOovvU8Y9nfrfplUCt0BRF28CjbK8ea1W3cSmgGDAL3x2J/D6nbua+KgLnFR3MuNKd+S0G/G+l7cVEEbJwf8LhgW44cywzSgMAwf7wltnlx+o77z7+hBHjgR0AuphR9wjGmF/wjtmSUXwmWT2eGYtw07zGXir0i/W13d/5HRLWaMwpHR4U7bw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=h7jFNSTyxOkRjUx6eKNfBe+bAZkgzVBwNZURPv8sr0k=; b=oBPa+r7Yx0hGs6JeAYorASimb0mHT+1tbOOpiwcfAFq11l5/x33C8Aw82PNM5H+41NyxJYwlSd3RmyP+Oi0YRi+y5b93pcFTb8SzSuxJN6TW2l5PIikDHBDtN+VarFEr2xQIpVdwuK2SJtR/fyo6HsM0PMWAS3LTz+oGtO1Fpc7k+LLMSI+YUJJIBR4bBH6NimqjEa3twi2BDncYeXHyG0SGVU49uNmkbZXAReEwQUyEhLuHjBSf2YWPHmjYUYORcjhTqBYc95mow6icGzv7JbhVte4lQeMLY1w+1VtMErAqTYSqow0uZmAjfkA1tqcXJIRj8t8TX4x04Bmtw6sseQ== 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 BYAPR10MB2888.namprd10.prod.outlook.com (2603:10b6:a03:88::32) by BYAPR10MB3623.namprd10.prod.outlook.com (2603:10b6:a03:11b::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14; Wed, 27 Oct 2021 16:07:00 +0000 Received: from BYAPR10MB2888.namprd10.prod.outlook.com ([fe80::48bf:86b4:32e1:6574]) by BYAPR10MB2888.namprd10.prod.outlook.com ([fe80::48bf:86b4:32e1:6574%4]) with mapi id 15.20.4628.020; Wed, 27 Oct 2021 16:07:00 +0000 From: "Jose E. Marchesi" To: Dodji Seketeli Cc: "Jose E. Marchesi via Libabigail" Subject: Re: [PATCH] Add support for the CTF debug format to libabigail. References: <20211011084509.9044-1-jose.marchesi@oracle.com> <87lf2ealn8.fsf@seketeli.org> Date: Wed, 27 Oct 2021 18:06:53 +0200 In-Reply-To: <87lf2ealn8.fsf@seketeli.org> (Dodji Seketeli's message of "Wed, 27 Oct 2021 10:59:23 +0200") Message-ID: <87bl3aih9e.fsf@oracle.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Content-Type: text/plain X-ClientProxiedBy: LO4P123CA0171.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18a::14) To BYAPR10MB2888.namprd10.prod.outlook.com (2603:10b6:a03:88::32) MIME-Version: 1.0 Received: from termi.oracle.com (141.143.193.71) by LO4P123CA0171.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16 via Frontend Transport; Wed, 27 Oct 2021 16:06:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 09efe873-ddb8-4799-a090-08d99963ced6 X-MS-TrafficTypeDiagnostic: BYAPR10MB3623: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cR5MhCC6A5DcS8lw+chcnOTMyIWBShFy1s/ARSqky5Qpajn/ICKessdjDIISnrKcd9v6j37zKLzCqKo1BUZhjmyogpU9PtXzmcSk1UU0CipaJU4pIu/KfbKKh+WikRQ7UpOdOq8g5BuoEvDMDJYdhyxHr5Tsv11FXCZjC/hMwITctiRZGtAyyBY0ybdF4poP/ZfwSATqk22uv3qC4GB+0entJU7dcKlRVChL63gnxmHYU2v4RcBegz70UChVuQZ9+G13JtaMpONRcTI1fEYBpn9yb9d5qMAnVr53RZItaa+DUxm8vwc+JkcOTeYWZmmf+q0TNfwdKPlGFAhEfu02EmPxRgVsuSpRun05b46InX1KvKRV+9E+p1qB1RWeQFJvN2CTfkPLXtXrSCNc/6X3mfcEnn7u+UcEgg653dsp+ywTBKq69F8GGv1GlSz99pqw4XiPiF1vKvc0MEbNwvdC70zayfCpxEf03auTym/M4rcVpOLkytfz7ykFwkpLqT/7JRyzsdZoQh1EGokCs9DdeJ3s3t0r1z5GCDwcNcArvuU1kW4CW/zQDErTpCoWE3a/rVfx1MX5RRhvIkZpWRkYxN157ymNcZ6o0FqVu7v0RBXAFzhFnyloheri5zwGk49snKsCvupKnmnGgR1mQlN7A+gyiiHDPvh3fg7FDoFsZZHK2WSxJuIwZ9512XgokBWYx9Z3mWMWwtENmSUqk26pNmoe6C20zazgw9/jtHkMV5jK8/bq85hNc/xjhwH9y/ZD0BwJES/zefIbyu7Moybk+oKB4HUHEiEiAlpyJLMatLegH89YajKfAkglbYeQ56xX X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB2888.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(508600001)(6666004)(2616005)(966005)(38100700002)(4326008)(86362001)(38350700002)(30864003)(6486002)(2906002)(4001150100001)(66556008)(66946007)(66476007)(5660300002)(36756003)(956004)(7696005)(26005)(186003)(8676002)(83380400001)(52116002)(6916009)(8936002)(316002)(21314003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?30u1H2A2j0WRRFlHXUcGkIjvAp7WvNErT6RyHvxsV+4FGA7Zv8AmPmjdd2uz?= =?us-ascii?Q?IXPkOOh2Vg9PrRBf8IDKCl0maCYj8B3Pjmh8p5oZjDDEHpLKGpO5sPh0ZFY1?= =?us-ascii?Q?T2hKupwT/IHovAqKuD1ZjDvROYGeHtnsXaOeMGt6oSzUMKG227XqogoT3qzT?= =?us-ascii?Q?uDRR5LPPWbrjqKzhneyyl5KMoRTkYrINUNScWGL9FriqjN5fE7lwJ5MWdoBY?= =?us-ascii?Q?N1h6IePxvFkvS2lH+01EF3cDqKNgyj+IjUZWVmlbq4tYY/Rqjcy+B+f+BT+G?= =?us-ascii?Q?BxQdOyLaqt059sODFDERGeGz8vMj92jZuEpE2qKRpF2Nz15KvR35HZxH08Iz?= =?us-ascii?Q?YXWGfB40ZVx6UNibHPt9j3hM7ucT8ZlDYt5P4dcAAVOhyL7Brrb4GL9ZOMCr?= =?us-ascii?Q?F86OqmRKqiI1kqdtiQRRvRuj9Ca1UOKNsf10l2ZlVJOqfL4nzGl6h9f/Mk0y?= =?us-ascii?Q?fUu/syoxXQUYxQ7OkobKSbdu/SpfwsJCj8Roqx/ZLiglf3SzlIOpV8txWJ1E?= =?us-ascii?Q?0YmOKXFaZQQxf+JC3yl7mogodyBhVKoTzKMTdu1NC21yS8CFkwGaFDpcjik4?= =?us-ascii?Q?dT2ljkYMFIU1/74UpjocJyc2UlLocYpL9Pb8QRqgeEbAqbgKszvoTBwykdiv?= =?us-ascii?Q?GrlUeIp/OqbdX/TRPHVb5i5vFa03bhHt1bOmcBIEUkxUigOdjxwGwBESeEgD?= =?us-ascii?Q?qd51XlX70yqlD7AAJ96BisflrrNoMRZJc7/PQL//XiCrBMbLoXKh2QMUePqM?= =?us-ascii?Q?NpuHfqhkAP9zVR9L0sbPBsdRyNGQx1yfHbLz4SxpFz/2g62dYdIP0xUUlH//?= =?us-ascii?Q?cHsiTrelCx2f0R0SSjGjU26qpPMlYDnPRUhUny7ln4EE4ENHvbQ/jDMkJT1O?= =?us-ascii?Q?jmqsrp3jzdk0PXACUhc+UpKgDgSHaz6vg9VWPfjfeLBRBCd/NM46meLNoiqM?= =?us-ascii?Q?uXG4ka4trFXql/SC3IOWhf3oXc9uXQOrbg/F1GW2LuH3ZlzaiJYXiHm2tJ26?= =?us-ascii?Q?IHJFTYTGSW6HGus7j2TO+p7MKxWFq6qMY+O3So+eOC7yGZiWvk/0vm0POzv/?= =?us-ascii?Q?wSfKYfZWV7Uj01DYSO8I5kRwfQ+hU71aeYXmvvZVsskYaml0u+q3/FOYmdcM?= =?us-ascii?Q?Rh+a8DkWyeZRw4zl1kx+Ub2k4s4Ssell+MnW5/JFZXyh2c5ZTkLvbpCmiach?= =?us-ascii?Q?z6ezgQd8UCrlvyX9nbulCI7V/G5SLIueclsQFrJkFTPVTEaNS6oaUX/yuWTz?= =?us-ascii?Q?HqpGFiI0bfpeFI4ClYOLgrNao1ftBZ1QOALB7S7ErbdAx/dDXwdL19O//K+J?= =?us-ascii?Q?po7RhD1HMAAXKHUqW6TulgmPXh7oc5lPcnBG0ioliEAWdtw6NFPOWoCk5+93?= =?us-ascii?Q?g2R9x9OgPMaEIjMys9kjSFYU5vqMqEHTvrTTzesQO3VK7rRv9KRAS0YyZn/R?= =?us-ascii?Q?Vwsxz908KGqOHXfDz0EANKv/BTVDiJpUYlcK/xJsS0UMt+K97PJ22yv1DcGG?= =?us-ascii?Q?yq7m4lntIo75L0wyEu9qmlWu6AuL+2pXQRD1T9xs8SqYVOZ3k93JC3rVGSml?= =?us-ascii?Q?gPCvI7ohS2HNS2L/1H7qtpMMNF15kgVtbMhzmC+2mTE0ceJQCSb24aCoHbiM?= =?us-ascii?Q?0L2De3wvkebcYYOBz7DIXI5novAuWCzQlwNTtZ5xewvfo2zcQ+eT/clseHYY?= =?us-ascii?Q?QaGdnQ=3D=3D?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 09efe873-ddb8-4799-a090-08d99963ced6 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB2888.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2021 16:07:00.3968 (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: 2/Ngm2Q3PL0jCsykyx4qUN/PASgT7HycFynOlWADGdjS3xDtbpz1sAPG7lOuWhjxuf+q/KNBx4L9Hovf8vqaLvTClyLlv6gWrfuwXDGeaEc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3623 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10150 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 mlxscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2110270094 X-Proofpoint-GUID: PuizD-OAiSUBM-tuQysm9GzqfJ637-Ct X-Proofpoint-ORIG-GUID: PuizD-OAiSUBM-tuQysm9GzqfJ637-Ct X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2021 16:07:13 -0000 Hi Dodji. >> - The libabigail tools assume that ELF means to always use DWARF to >> generate the ABI IR. We added a new command-line option --ctf to >> the tools in order to make them to use the CTF debug info instead. >> We are definitely not sure whether this is the best user interface. >> In fact I would be suprised if it was ;) > > It's OK for me, so far. We can come up with a better way. In theory, > we should be able to automatically detect the debuginfo format > attached to a given binary, now that we about to support more than one > ;-) We should just make sure we can do that even when said debuginfo > is split out into a separate file. Right. If both formats (DWARF and CTF) are present in a given binary DWARF must have precedence, since it is capable of encoding more information than CTF. > >> - We added support for --ctf to both abilint and abidiff. > > Thanks for doing that! > > Oh, one thing that is missing is to add documentation to the > doc/manuals/abi{diff,lint}.rst files for the new --ctf to these tools. > Could you please add that in a subsequent iteration of this patch? Will do for V2. >> We are not sure whether it would make sense to add support for CTF >> to the other tools. Feedback welcome. > > I think it would be important to add something similar to abidw, as > that tool is important to emit an abixml representation of a given > binary. A lot of users use the abixml representation to serialize a > representation of the I will add CTF support for abidw in V2. >> - We are pondering about what to do in terms of testing. We have >> cursory tested this implementation using abilint and abidiff. We >> know we are generating IR corpus that seem to be ok. It would be >> good however to be able to run the libabigail testsuites using CTF. >> However the testsuites may need some non-trivial changes in order to >> make this possible. Let's talk about that :) > > I think it wouldn't be that hard. We can discuss that separately if > you like. But it just boils down to adding a new test similar to > tests/test-read-dwarf.cc, that would be called tests/test-read-ctf.cc. > That test would just read a binary built with ctf support, save its > abixml representation to disk and compare it with an expected output. > That would be a great start. I can help with that, no problem. But > let's maybe discuss this in a separate thread, even after the initial > patch is applied. I asked Guillermo Rodriguez to look at that. He is subscribed to this list. >> diff --git a/ChangeLog b/ChangeLog >> index 30918b49..385fe067 100644 >> --- a/ChangeLog >> +++ b/ChangeLog >> @@ -1,3 +1,21 @@ >> +2021-10-11 Jose E. Marchesi >> + >> + * configure.ac: Check for libctf. >> + * src/abg-ctf-reader.cc: New file. >> + * include/abg-ctf-reader.h: Likewise. >> + * src/Makefile.am (libabigail_la_SOURCES): Add abg-ctf-reader.cc >> + conditionally. >> + * include/Makefile.am (pkginclude_HEADERS): Add abg-ctf-reader.h >> + conditionally. >> + * tools/abilint.cc (struct options): New option `use_ctf'. >> + (display_usage): Documentation for --ctf. >> + (parse_command_line): Handle --ctf. >> + (main): Honour --ctf. >> + * tools/abidiff.cc (struct options): New option `use_ctf'. >> + (display_usage): Documentation for --ctf. >> + (parse_command_line): Handle --ctf. >> + (main): Honour --ctf. >> + > > As explained in the COMMIT-LOG-GUIDELINES file from the source code at > https://sourceware.org/git/?p=libabigail.git;a=blob_plain;f=COMMIT-LOG-GUIDELINES;hb=HEAD, > the ChangeLog is automatically updated by a script before a Libabigail > release. Ok... I will DTRT. Will also add a Sign-off-by in V2. > >> diff --git a/configure.ac b/configure.ac > > [...] > >> + AC_DEFINE([CTF], 1, >> + [Defined if user enables and system has the libctf library]) > > To comply with the implicit convention throughout the code, I renamed > the pre-processor macro used to enable the "CTF Support Feature" into > "WITH_CTF", because all the other "feature enabling" macros are named > WITH_XXX. This produces the hunk below, that as been committed into > the ctf-branch: > > @@ -266,7 +266,7 @@ if test x$ENABLE_CTF = xyes; then > AC_CHECK_LIB(ctf, ctf_open, [LIBCTF=yes], [LIBCTF=no]) > if test x$LIBCTF = xyes; then > AC_MSG_NOTICE([activating CTF code]) > - AC_DEFINE([WITH_CTF], 1, > + AC_DEFINE([CTF], 1, > [Defined if user enables and system has the libctf library]) > CTF_LIBS=-lctf > else > > Of course, all uses the "CTF" macro throughout have been updated accordingly. Sorry, somehow I overlooked that. Thanks for fixing it. >> diff --git a/src/abg-ctf-reader.cc b/src/abg-ctf-reader.cc > > [...] > >> + /// Associate a given CTF type ID with a given libabigail IR type. >> + void add_type (ctf_id_t ctf_type, type_base_sptr type) > > Throughout the existing source code, there is no space between the > name of a function and the opening parenthesis. This is based on the > standard GNU C++ coding conventions followed, for instance, in > libstdc++. It would be appreciated if this patch could comply with > the coding conventions of the rest of the source code. > > Those conventions are loosely defined in the CONTRIBUTING file under > the chapter named "Coding language and style". There is a > .clang-format specification file that you can use to format the source > code (semi?-)automatically using the clang formatter. I don't use it > myself as I just do the formatting manually as I write the code in > Emacs but you can ask questions about that tool on the mailing list, > should you need any help about it. Ok I will remove spaces between function names and opening parenthesis. > [...] > >> +static typedef_decl_sptr >> +process_ctf_typedef (read_context *ctxt, >> + corpus_sptr corp, >> + translation_unit_sptr tunit, >> + ctf_dict_t *ctf_dictionary, >> + ctf_id_t ctf_type) >> +{ >> + typedef_decl_sptr result; >> + >> + ctf_id_t ctf_utype = ctf_type_reference (ctf_dictionary, ctf_type); > > How about error handling here? I mean, what if ctf_type is not a > typedef or a type that has a reference to another type? Hmmm, yes this code relies on CTF_TYPE to be a typedef type with a reference to other type. The first condition is guaranteed by the caller at the moment, which is bad coupling. (bad bad jemarch.) Will fix for V2. >> + result.reset (new typedef_decl (typedef_name, utype, location (), >> + typedef_name /* mangled_name */)); > > I noticed that you are not setting the "location" information. That > information is quite useful for accurate diagnostics emitted by, e.g, > abidiff. For instance: > > $ build/tools/abidiff --harmless tests/data/test-diff-dwarf/test2-v0.o tests/data/test-diff-dwarf/test2-v1.o > Functions changes summary: 0 Removed, 1 Changed, 0 Added function > Variables changes summary: 0 Removed, 0 Changed, 0 Added variable > > 1 function with some indirect sub-type change: > > [C] 'function void foo(int, char)' at test2-v1.cc:5:1 has some indirect sub-type changes: > parameter 1 of type 'int' changed: > entity changed from 'int' to compatible type 'typedef Int' at test2-v1.cc:1:1 > parameter 2 of type 'char' changed: > entity changed from 'char' to compatible type 'typedef Char' at test2-v1.cc:2:1 > > $ > > The location information that you see in the form of "at > test2-v1.cc:1:1" can be useful, I believe. > > So why are you not retrieving location information from CTF? (honest > question). To be fair, I haven't found (from the documentation) how > to get source location information from CTF. But I am pretty sure I > must be missing the information. In any case, I think it might be > interesting to add a comment in the code about the reason. > > In any case, if the information is not yet available, it's not a > problem. The patch will go in, regardless. When source location is > later available from CTF then this code will be amended accordingly. CTF doesn't support location information. > Also, there is something else that might be important that you are not > doing here: supporting Naming Typedefs. > > Consider this construct: > > typedef enum {one, two} Number; > > Here, there is an anonymous enum that is created. There is also a > typedef that is created to "name" that anonymous enum. In concrete > terms, the enum will be referred-to as having the name "Number". > Libabigail IR allows to set the typedef as being the "naming typedef" > of the underlying type of the using the > decl_base::set_naming_typedef() member function, on the underlying > type (the enum). > > So the code would somewhat look like this: > > if (is_anonymous_type(utype) > && (is_enum_type(utype) || is_class_or_union_type(utype)) > // So utype is an anonymous enum, union or struct. > // So let's consider that the typedef 'result' is > // a naming typedef for utype. > utype->set_naming_typedef(result); > > Does that make sense? Oook, from the snippet above I infer this applies only to anonymous enum, class/struct and union underlying types? Sure, easy to do. Will be in V2. >> + type_base_sptr utype = ctxt->lookup_type (ctf_utype); >> + >> + if (!utype) >> + { >> + utype = process_ctf_type (ctxt, corp, tunit, ctf_dictionary, ctf_utype); >> + if (!utype) >> + return result; >> + } > > I noticed this pattern is used a lot throughout the code. > Maybe it could be factorized into a function and used throughout the > code base as, e.g: > > type_base_sptr utype = process_or_lookup_type(ctxt, corp, tunit, > ctf_dictionary, > ctf_utype) > What do you think? Yes, totally. Will do. > >> +static void >> +process_ctf_sou_members (read_context *ctxt, >> + corpus_sptr corp, >> + translation_unit_sptr tunit, >> + ctf_dict_t *ctf_dictionary, >> + ctf_id_t ctf_type, >> + class_or_union_sptr sou) >> +{ > > This function definition lacks doxygen comment, even if it's "just" a > sub-routine of process_ctf_struct_type and process_ctf_union_type. Ok. > +static void > +process_ctf_archive (read_context *ctxt, corpus_sptr corp) > +{ > + /* We only have a translation unit. */ > + translation_unit_sptr ir_translation_unit = > + std::make_shared (ctxt->ir_env, "", 64); > > Interesting. So, CTF doesn't keep the information about the > translation unit a decl was defined in? I guess that must be related > to the fact that I haven't seen source location information so far. Correct, no translation unit info in CTF. What CTF has is deduplication builtin in the linker (ld) so when several objects get combined the corresponding .ctf sections get also merged and deduplicated. > [...] > > + > + /* Iterate over the CTF functions stored in this archive. */ > + ctf_next_t *func_next = NULL; > + const char *func_name = NULL; > + ctf_id_t ctf_sym; > + > + while ((ctf_sym = ctf_symbol_next (ctf_dict, &func_next, &func_name, > + 1 /* functions symbols only */) != CTF_ERR)) > + { > > How about function symbol visibility? Won't ctf_symbol_next return > the symbol of a function that is not necessarily "exported"? In that > case, because the symbol is not exported, it's related to a "private" > function and so, it doesn't have ABI visibility. So it should be > discarded. Just curious. Hmmm, I think these symbols correspond to public symbols, but will double-check and sure of that. > diff --git a/tools/abidiff.cc b/tools/abidiff.cc > > [...] > > @@ -104,6 +105,7 @@ struct options > #ifdef WITH_DEBUG_SELF_COMPARISON > bool do_debug; > #endif > + bool use_ctf; > > I have protected this CTF support hunk with a #ifdef WITH_CTF guard, > so that configuring with --disable-ctf leads to compiling the file > just fine I've done so with all the CTF-specific hunks in abidiff.cc > and abilint.cc. Thanks for that. I forgot :) > > All in all, I really like the patch. Thanks a lot for working on > this. Well thanks for the review. I will send a V2 soon.