From patchwork Sat May 7 02:03:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guillermo E. Martinez" X-Patchwork-Id: 53570 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9A8DA385742F for ; Sat, 7 May 2022 02:03:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A8DA385742F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1651889030; bh=IjQsQiGjOe8nSAyP2a5flAgmr1xGEDqB94+QGqZtuws=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=Dm2RxueJ6zin1rk6Ee9YT7jOYJ72RtcigsbGNbPHWn9Wx+DxuADPF/SboSWl1mU5Q VzzmycD3Jlid2fO6BAasFYUKhZieAP79xMlwZUcojoPq40ogBA6ymUIhcbUWAL5rHo t4dsbHFmmSlzfLWjM+cTQBxAWDvCBRHJrfbxwlo8= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 8E9F9385800E for ; Sat, 7 May 2022 02:03:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8E9F9385800E Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 246LJ7OH004092 for ; Sat, 7 May 2022 02:03:43 GMT Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3frw0ay0xf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 07 May 2022 02:03:43 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 2471upXS032171 for ; Sat, 7 May 2022 02:03:41 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2104.outbound.protection.outlook.com [104.47.55.104]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3fwf76gccy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 07 May 2022 02:03:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lSP9JNbjerMGbpc6G2PiDNVL1uD2XilibHtF5OvJbRFmhmgzxdpQPB6dEDISrNsuPlEGwGNiEW1oV64kUZGC43bA3bt20FFMvfoPQDfWiTQMHX94e21TV4laU0B95E/t0zw38XZzMh4EigR8xZSpvLS/P30CeWZU+5/ErAHZ+s5d2Z0oYitiNa1+AVSdPPTuQyc24j98lNZh9tUK/EWc8iJra627ZIxvwryPOQTi5jB4CWUOXTa1FjsioxVn7Bni4x8zUfivektXuaNKPQstn5TRHgUC13ySiHQaWf1HaGSzU+K3v9OI6A5QUB8zLcsL+ynS0fZsoffGECkc+I2bHA== 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=IjQsQiGjOe8nSAyP2a5flAgmr1xGEDqB94+QGqZtuws=; b=ki+k4Z31wZ6xcOjMqkbrPZ159VQqQtjBFiKYhq5BfPQWJSQjkXhz8NnIjvTLKcZHzjzYG07GyQ74F3FMGEuniI+Hnr1z+4AO43BwBlWwGvhvqrcuULZXVsYNOqcOeApmxhuYO3WnL0Dah8UblWIJ6Ye8x872nVBS+FvmaH84wvrI4NVLzCIzCHfvmXYgD2SZO/RcCDi954OoNsrHpzjmFWmwnwGsEDHTdvhW+gSRNq9rSlL3xVHUr5aOS878RYz6X5/9L+o7P1VcLx2xh9Xy/mlJUMAI3+2z5wYUa0JcddTYnj4+UefxJSHxLGxhNwMBWmXyvONiW3+Pe8mp7SKnsw== 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 MWHPR10MB1407.namprd10.prod.outlook.com (2603:10b6:300:23::20) by BL3PR10MB6041.namprd10.prod.outlook.com (2603:10b6:208:3b1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.24; Sat, 7 May 2022 02:03:39 +0000 Received: from MWHPR10MB1407.namprd10.prod.outlook.com ([fe80::c88b:fab4:f199:fc1b]) by MWHPR10MB1407.namprd10.prod.outlook.com ([fe80::c88b:fab4:f199:fc1b%4]) with mapi id 15.20.5227.021; Sat, 7 May 2022 02:03:39 +0000 To: libabigail@sourceware.org Subject: [PATCH] abipkgdiff: Add support to compare packages with CTF debug format Date: Fri, 6 May 2022 21:03:26 -0500 Message-Id: <20220507020326.1417379-1-guillermo.e.martinez@oracle.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: SA0PR11CA0030.namprd11.prod.outlook.com (2603:10b6:806:d3::35) To MWHPR10MB1407.namprd10.prod.outlook.com (2603:10b6:300:23::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d7a463ff-2ad6-4a46-5729-08da2fcdcd79 X-MS-TrafficTypeDiagnostic: BL3PR10MB6041:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pEXg2ggUJB39b5Fic2Aiq/Q+M19mWMCnkl8EvKhMrRjZK3jeXVlacAPcJ3DHaWB4q8kEXDdeHPkGLGvkqxUNq9JZq6NLWWUssGqnahjnwjDrMeqj8alttR1+9HtVzGvZWUFAYWCfKesnwHe+2sEflftDbb4b7Y1hitKwMt0VdwP5AuYA5qg+WecHgwV732wecpRQsSrESnsZ9260SfRrIMpVRJWZLBC3wg8jrLOkoBXJHuyjoFZmSUd+4cYHZDeV/RDxKKho4xqwcJJuFjUoNymcMFtX7urLH0+EhrCUTjPcO6v5+VJwK5yFm5e9zEw9vPeZTVxpDPv4OZnsCw2z3TXfZHiNo9jY7bMXhyAj/NcUNd9T/vlrHiEybeA7J7TRSLKcr4qB/rniNy672eQfpdgoH0FReja1ayE3eIHt+9QrHZB1sKAZrLZnbHkVSc47d8MD9SYkpc/dmoywkDB7nYJgcaGz0Nn9jv8WvWvRFHq928FUh1XAv9rjZ5+RZYsgKmeIoi2jz0G1MwVIGgkpEPGMB9haTMjdF/C1s3BCdtvSoIRmAvLNyq6LiFlsLgpOQ8q2uqxrKbPqWXdHXlu5+7eNUTha68uFrt5ZleaKFghd5ZVyac0+LoFmFp4FzOIvIoHojgykMRr3RUe279TyaxsBVN/41xdacLEU4vpAgQSAnUTWvS+kbskkkNVuQ2NcrmO2u6ZvLeMuYwe1rGeiGDkhJaujsHv1dTcZ8T0PbkNne1WHbFStBuPOcrXHOv01jzp9lH2qCHIec2oxAN0Lfg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR10MB1407.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(316002)(86362001)(83380400001)(36756003)(107886003)(1076003)(103116003)(186003)(66946007)(4326008)(66476007)(8676002)(66556008)(2616005)(6512007)(8936002)(966005)(2906002)(6486002)(38100700002)(5660300002)(6916009)(6506007)(52116002)(508600001)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: Cnl1PCdXIuTb0dIuRwYDCojvalNdEYsPZftdrZY0Ip24cccmNj0Ui91MIq6Z9Belocw7orc+6DxgcnFvKLflEXhgcllRvIIiufcoqaUXScoZ7gG6HsvEsQB5Cf37NpJWAVQn0q5TxsBcjHKhXsDduWdFGKuA6SDQ7DwZ1X0EuIA2tslOZi9E+4oPotHzSlLtCcd49kkfIDCeKA+q/UJJECp6+1jyNESIw2zFVCOWI2YsvwOlwmRw1t/tILiXvCUAuGcHaFEd/4Wf6nPHgWfyF52OFWqS1YwAdRzPpxgUK1BH2ymvW4j0iYUIJg0S7br3AZRvMs5yNYBjUSCIu11tJ4ZdqSLJ208yWfXVBhpLInjN0F3ldjk48Z+i+nO++/3cgxQvwEMDPo/G7MEEhgx16yBQ3oJEny7CJUJ15bv7d5r6S+TMeu485ZznTW10NHNt9gtKb2/e7VLcsYiZhGri2WEjPlDpX2K4rno52eaaSQTTyaVBROoCCKW4fIkTYuo9EkZw4EGof8PHNTf4YUouIob6OClpdIl+5wlVLwWlvXg4X3mb2zoKFaoUPbXLWBd936PHhiw+ol+T9HoeAr5oGurBTr4NQ2mPQZ/i2j7/4wVmQkjjb/LqhcvFdGk09xPzfczqQVFLuWr43Dtfr3Rxsaq+fn97XdIGh2AADU4fCtk2plymwN5JfyiQvaeKnbHpXwGssBs2PRnkMddsLF929V7Mn3yV+lxXjVFSUmuKgLFrdrgP5x0YwPA2/4JSt4eZNzTdnbfboqriUdo8IW5pjsJJafv+Bob3Bj+Yso1CMfU995JzF7T9n6726OE0kIdf/r2AJXRKWr/aCr83MmG7qKLvR2VxRvI5areb4fjuBcvgYQoQvK4xbB1Rnsj30aIPONgaOlR20LyCzCcP4cnCR9+1W4CTt1e9PRbTYFPlD6ZhgluZyfgr3F7arufdqeAux4vpC2oG0XSqDY7hw5C7IaxSSMuj+vAn8yBs57/Pj9QAQamcCjLP2gWxjccEM7UsfcoZZ1xzdkvtpAijjmKCX6gKyQ7/v2xs1cr25RMaXWTWjDSzZeltk99wSkOHQB1na9UJ4vAScCgj/zC9p4SL40n1KeUt1Cu5tDeCKrIYzFTP7rIT6OkfsHGi30PLQAdocKIyom+qtO+SDu9U1G+eJ2YxhOrICWoXbtt0JPgmVCIVyYB9Ox7Mq8f5tOjOyv1xO5E75kZ1nEe8tzsTPmpn/95fdPlHpmP2PmD3XrejPdDQw9Cn/E48MimcQYPpGxykCXljqk5GgCZ9/HqAjkJyjvUqYDc8RACWe+UV+wba6K0YSXb5KYHE29PvqDwtjY/y4f0Xp74XlWAYrMSFrj8f2XQSAC021N0l5UC6vVBG0rpbWJCTBty750jPXhcPV1qJgXoTdksGxwaDVdCzykfsM4eWKLIp1t62gXWri2IBNmQfvTkcz6WcVqcq8/Xhvf0EMiFpSeL9lkPkiu/0UEeW66BlWv44xOhpx/P5pZXnIuRrZ3Fks4Q46/cSIziELRbnYYcuIv83G10/CVjkX3wUECGvD9n3/KoHiw5WYFPyfrPM3BExRUIvamkEY7lE6vpJALnc5QxJQO2zL/zDPKwgwPx3d3Mo8r2OWjlrHuFBt9MjNQg8TlmXayZRyGL8lh7h3xQZU/X6Dnd6pcFmUOp6lA32paj+GLTVvYVttpOzhy8IPkTYgF5+RtlYlo7GggxH6IKph6Is3NScXtZoq5AniXn3K8vg8O7I73xbFNnr+SxJeX8Pq/Ev6Ujy+fXuT95L7MuSLsYF X-MS-Exchange-AntiSpam-MessageData-1: PwQ4iJ6MfHslfg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7a463ff-2ad6-4a46-5729-08da2fcdcd79 X-MS-Exchange-CrossTenant-AuthSource: MWHPR10MB1407.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2022 02:03:39.0460 (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: jJOJ0yMbptSsUflxVblQYAUZ4otvYqmOEDwHKPVhImhVhmuenPLWTkNV7w86GIRkW1HzVF6SOAIxuYEqeUDhaDUrAXGnhIA9KzmgslLbSWs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6041 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486, 18.0.858 definitions=2022-05-06_07:2022-05-05, 2022-05-06 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 suspectscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205070010 X-Proofpoint-GUID: 6AYlwhyeAYADPLN_0c2hY6ZHrY4R6axD X-Proofpoint-ORIG-GUID: 6AYlwhyeAYADPLN_0c2hY6ZHrY4R6axD X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_LOTSOFHASH, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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-Patchwork-Original-From: "Guillermo E. Martinez via Libabigail" From: "Guillermo E. Martinez" Reply-To: "Guillermo E. Martinez" Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" This patch add support in `abipkgdiff' to compare binaries with CTF debug data. It depends of: * https://sourceware.org/pipermail/libabigail/2022q2/004340.html * https://sourceware.org/pipermail/libabigail/2022q2/004343.html * https://sourceware.org/pipermail/libabigail/2022q2/004344.html * [PATCH] ctf-reader: add support to looking debug information in external path Please let me know your comments, I'll really appreciate them. Kind regards, Guillermo This patch add support in `abipkgdiff' to compare binaries with CTF debug information inside of packages, when `--ctf' option is provided. * tools/abipkgdiff.cc: Include `abg-ctf-reader.h'. (options::use_ctf): Add new data member. (display_usage): Add `--ctf' usage. (compare): Add condition to use ctf-reader to extract (parse_command_line): Set `options::use_ctf' when --ctf option is provided. and build CTF corpora when `options::use_ctf' is set. (compare_to_self): Likewise. Signed-off-by: Guillermo E. Martinez Signed-off-by: Guillermo E. Martinez Signed-off-by: Dodji Seketeli --- doc/manuals/abipkgdiff.rst | 4 ++ tools/abipkgdiff.cc | 116 ++++++++++++++++++++++++++++++------- 2 files changed, 100 insertions(+), 20 deletions(-) base-commit: c96463e1ad974b7c4561886d7a3aa8a3c9a35607 prerequisite-patch-id: 781b026536589341e1e4378d9529fe258633bb53 prerequisite-patch-id: e6191c510bc90e225bd0858d333e2e01b6e52a62 prerequisite-patch-id: b87e0b761bf3f909eb84147b3b13e2a338de9509 prerequisite-patch-id: 6ddc271ce828e41f3d7c1f472ad01be8fb10b5d3 diff --git a/doc/manuals/abipkgdiff.rst b/doc/manuals/abipkgdiff.rst index c15dc51f..f297c9a8 100644 --- a/doc/manuals/abipkgdiff.rst +++ b/doc/manuals/abipkgdiff.rst @@ -468,6 +468,10 @@ Options ==== SELF CHECK SUCCEEDED for 'libGLU.so.1.3.1' ==== $ + * ``--ctf`` + + This is used to compare packages with CTF debug information, if present. + .. _abipkgdiff_return_value_label: Return value diff --git a/tools/abipkgdiff.cc b/tools/abipkgdiff.cc index ef9fabf2..91b3711f 100644 --- a/tools/abipkgdiff.cc +++ b/tools/abipkgdiff.cc @@ -90,6 +90,9 @@ #include "abg-dwarf-reader.h" #include "abg-reader.h" #include "abg-writer.h" +#ifdef WITH_CTF +#include "abg-ctf-reader.h" +#endif using std::cout; using std::cerr; @@ -202,6 +205,10 @@ public: bool fail_if_no_debug_info; bool show_identical_binaries; bool self_check; +#ifdef WITH_CTF + bool use_ctf; +#endif + vector kabi_whitelist_packages; vector suppression_paths; vector kabi_whitelist_paths; @@ -240,6 +247,10 @@ public: fail_if_no_debug_info(), show_identical_binaries(), self_check() +#ifdef WITH_CTF + , + use_ctf() +#endif { // set num_workers to the default number of threads of the // underlying maching. This is the default value for the number @@ -879,6 +890,9 @@ display_usage(const string& prog_name, ostream& out) << " --verbose emit verbose progress messages\n" << " --self-check perform a sanity check by comparing " "binaries inside the input package against their ABIXML representation\n" +#ifdef WITH_CTF + << " --ctf use CTF instead of DWARF in ELF files\n" +#endif << " --help|-h display this help message\n" << " --version|-v display program version information" " and exit\n"; @@ -1302,15 +1316,32 @@ compare(const elf_file& elf1, << " ...\n"; corpus_sptr corpus1; +#ifdef WITH_CTF + abigail::ctf_reader::read_context_sptr ctxt_ctf; +#endif + read_context_sptr ctxt_dwarf; { - read_context_sptr c = - create_read_context(elf1.path, di_dirs1, env.get(), - /*load_all_types=*/opts.show_all_types); - add_read_context_suppressions(*c, priv_types_supprs1); - if (!opts.kabi_suppressions.empty()) - add_read_context_suppressions(*c, opts.kabi_suppressions); +#ifdef WITH_CTF + if (opts.use_ctf) + { + ctxt_ctf = abigail::ctf_reader::create_read_context(elf1.path, + di_dirs1, + env.get()); + ABG_ASSERT(ctxt_ctf); + corpus1 = abigail::ctf_reader::read_corpus(ctxt_ctf.get(), + c1_status); + } + else +#endif + { + ctxt_dwarf = create_read_context(elf1.path, di_dirs1, env.get(), + /*load_all_types=*/opts.show_all_types); + add_read_context_suppressions(*ctxt_dwarf, priv_types_supprs1); + if (!opts.kabi_suppressions.empty()) + add_read_context_suppressions(*ctxt_dwarf, opts.kabi_suppressions); - corpus1 = read_corpus_from_elf(*c, c1_status); + corpus1 = read_corpus_from_elf(*ctxt_dwarf, c1_status); + } bool bail_out = false; if (!(c1_status & abigail::elf_reader::STATUS_OK)) @@ -1356,7 +1387,13 @@ compare(const elf_file& elf1, emit_prefix("abipkgdiff", cerr) << "Could not find alternate debug info file"; string alt_di_path; - abigail::dwarf_reader::refers_to_alt_debug_info(*c, alt_di_path); +#ifdef WITH_CTF + if (opts.use_ctf) + ; + else +#endif + abigail::dwarf_reader::refers_to_alt_debug_info(*ctxt_dwarf, + alt_di_path); if (!alt_di_path.empty()) cerr << ": " << alt_di_path << "\n"; else @@ -1389,15 +1426,26 @@ compare(const elf_file& elf1, corpus_sptr corpus2; { - read_context_sptr c = - create_read_context(elf2.path, di_dirs2, env.get(), - /*load_all_types=*/opts.show_all_types); - add_read_context_suppressions(*c, priv_types_supprs2); +#ifdef WITH_CTF + if (opts.use_ctf) + { + ctxt_ctf = abigail::ctf_reader::create_read_context + (elf2.path, di_dirs2, env.get()); + corpus2 = abigail::ctf_reader::read_corpus(ctxt_ctf.get(), + c2_status); + } + else +#endif + { + ctxt_dwarf = create_read_context(elf2.path, di_dirs2, env.get(), + /*load_all_types=*/opts.show_all_types); + add_read_context_suppressions(*ctxt_dwarf, priv_types_supprs2); - if (!opts.kabi_suppressions.empty()) - add_read_context_suppressions(*c, opts.kabi_suppressions); + if (!opts.kabi_suppressions.empty()) + add_read_context_suppressions(*ctxt_dwarf, opts.kabi_suppressions); - corpus2 = read_corpus_from_elf(*c, c2_status); + corpus2 = read_corpus_from_elf(*ctxt_dwarf, c2_status); + } bool bail_out = false; if (!(c2_status & abigail::elf_reader::STATUS_OK)) @@ -1443,7 +1491,13 @@ compare(const elf_file& elf1, emit_prefix("abipkgdiff", cerr) << "Could not find alternate debug info file"; string alt_di_path; - abigail::dwarf_reader::refers_to_alt_debug_info(*c, alt_di_path); +#ifdef WITH_CTF + if (opts.use_ctf) + ; + else +#endif + abigail::dwarf_reader::refers_to_alt_debug_info(*ctxt_dwarf, + alt_di_path); if (!alt_di_path.empty()) cerr << ": " << alt_di_path << "\n"; else @@ -1540,12 +1594,30 @@ compare_to_self(const elf_file& elf, << " ...\n"; corpus_sptr corp; +#ifdef WITH_CTF + abigail::ctf_reader::read_context_sptr ctxt_ctf; +#endif + read_context_sptr ctxt_dwarf; { - read_context_sptr c = - create_read_context(elf.path, di_dirs, env.get(), - /*read_all_types=*/opts.show_all_types); +#ifdef WITH_CTF + if (opts.use_ctf) + { + ctxt_ctf = abigail::ctf_reader::create_read_context(elf.path, + di_dirs, + env.get()); + ABG_ASSERT(ctxt_ctf); + corp = abigail::ctf_reader::read_corpus(ctxt_ctf.get(), + c_status); + } + else +#endif + { + ctxt_dwarf = + create_read_context(elf.path, di_dirs, env.get(), + /*read_all_types=*/opts.show_all_types); - corp = read_corpus_from_elf(*c, c_status); + corp = read_corpus_from_elf(*ctxt_dwarf, c_status); + } if (!(c_status & abigail::elf_reader::STATUS_OK)) { @@ -3332,6 +3404,10 @@ parse_command_line(int argc, char* argv[], options& opts) (make_path_absolute(argv[j]).get()); ++i; } +#ifdef WITH_CTF + else if (!strcmp(argv[i], "--ctf")) + opts.use_ctf = true; +#endif else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {