From patchwork Wed Sep 27 18:20:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 76795 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 5B32D384DD18 for ; Wed, 27 Sep 2023 18:21:22 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by sourceware.org (Postfix) with ESMTPS id 7A85A3857726 for ; Wed, 27 Sep 2023 18:21:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7A85A3857726 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=osandov.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=osandov.com Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1bdf4752c3cso85192875ad.2 for ; Wed, 27 Sep 2023 11:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1695838874; x=1696443674; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=vhB9ZUvQFCvcTSsMeBy4iB0R3YFKNELk63FVnxcQRaE=; b=LGsnc+AV0GxixYOwMs8P+qVkkE8zyTaebCHT1PlJTgCjhMhtpvospby2WOcNIJoDYp z2X8GJXbeu9YlP744rno1/NPX89juXxXX+cT5B4+iCwagWeWObbNY6Sbv21B+U+Ni/rX Ek3hwGha8zAKwBH/t6kW0ordNWbPNh7f/ikspnV/70AWdMD7iXhqsAG7AgKfDp+CgWKN WQ4uFZDqo3ApUwrvQBy9uc9sNCuiPmhO+a3bd8KekcUFL1Vg8N7iM+Byy1zZsHd7e2Qe Y+BVbZ/9oq3q35CpvqAFRWfxyK4EQ9grRfRc8dVa22jbAOuZrkkyiBr1RrRyxif0n7tJ 2j+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695838874; x=1696443674; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vhB9ZUvQFCvcTSsMeBy4iB0R3YFKNELk63FVnxcQRaE=; b=WBZ+naJihcXkht+P7ceaZMmxeR7chOGgejit5BPi+DbgkczLy/kaLpfJnTuhJ43/yn IYBWJSpoZd6qJSSPlgCEoGX0H5Dhvnilr2XovsXWAgG9zS7QRYsxT928OIxxEHaOV5c7 YGjbAtL2jwlQcnhcvg43p5fXQHTMqpz9hcnTzGo/aAiEsa429+GMlNn+5w51fWewVKd8 VdZFZUEOZWUgf6DodNh8tO51O9caryO9szbSp5c+vnD67OB2di+GNJxSod54nWYBpx/F xgoRls4yyxr/og6YV0oV+rN/VLrDbyTtkPt2qyasgDODA4mue2ipDmddo5M9/qwbr15c tNsg== X-Gm-Message-State: AOJu0YzDNsxUc2HsUJqOZvnVqYfSA6ZM1IKqGWQPm0T3PYuGOvHC+ee0 dpBwzZSCduJGPSbu+uIqNhj1G9IhxUCT3aKCeusZVA== X-Google-Smtp-Source: AGHT+IFpdWs14c11ltDoStY6Dw7l9OL3Eil53vJbWzYvU0fTLK8MXNkephokemHID4n44+Yw9hJ+Kw== X-Received: by 2002:a17:902:ecd2:b0:1c4:29dd:2519 with SMTP id a18-20020a170902ecd200b001c429dd2519mr2609570plh.67.1695838874041; Wed, 27 Sep 2023 11:21:14 -0700 (PDT) Received: from telecaster.thefacebook.com ([2620:10d:c090:500::6:efab]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e81000b001bf6ea340a9sm13397842plg.159.2023.09.27.11.21.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:21:13 -0700 (PDT) From: Omar Sandoval To: elfutils-devel@sourceware.org Subject: [PATCH 01/14] libdw: Make try_split_file static Date: Wed, 27 Sep 2023 11:20:50 -0700 Message-ID: <4b9aa967292ca6145423bf39796bd12fdd392096.1695837512.git.osandov@fb.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" From: Omar Sandoval It's only used in libdw_find_split_unit.c. Signed-off-by: Omar Sandoval --- libdw/ChangeLog | 4 ++++ libdw/libdw_find_split_unit.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 406310ef..0014aeb1 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,7 @@ +2023-09-27 Omar Sandoval + + * libdw_find_split_unit.c (try_split_file): Make static. + 2023-02-22 Mark Wielaard * dwarf_getscopes.c (origin_match): Don't free a->scopes. diff --git a/libdw/libdw_find_split_unit.c b/libdw/libdw_find_split_unit.c index a22e7bc9..533f8072 100644 --- a/libdw/libdw_find_split_unit.c +++ b/libdw/libdw_find_split_unit.c @@ -41,7 +41,7 @@ #include #include -void +static void try_split_file (Dwarf_CU *cu, const char *dwo_path) { int split_fd = open (dwo_path, O_RDONLY); From patchwork Wed Sep 27 18:20:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 76796 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 71390385701E for ; Wed, 27 Sep 2023 18:21:26 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 7AB523857728 for ; Wed, 27 Sep 2023 18:21:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7AB523857728 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=osandov.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=osandov.com Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-691c05bc5aaso10298864b3a.2 for ; Wed, 27 Sep 2023 11:21:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1695838875; x=1696443675; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=gk2+SzAh5DXGyW8ItkrkclVq6EMg+lzFEIjK5IaOkto=; b=198f6pPwyykoYYWAueC7JLT+5gW4Wz76sR7wD2P0WygOciIW8Yz0iCqdVS5ymvVI9U o3iN9VaaoJSfzjSXPqb3mSTbRZceblKTS8/rjgbTCTyKbBsZ0jkpyWRn9wJsOppT10PW +K7I4ARfGT7ba4xfdgMahG/dajOmPD2qRr8YTrNNrMjw2rk2Vog81e+/nsIljDgk9xxZ tqqRSNsn6j0aRYfE5RviKVupsBT9aMWASMx+7j1EVpVz0FrCW/ODrYU/BU59j8RZCgaF SHV2FS4lzslHahoT89WZz9NavJOVY6tVP2971xFT0PUnM8ltDliFvcip9YC9XwDer0dX V4Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695838875; x=1696443675; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gk2+SzAh5DXGyW8ItkrkclVq6EMg+lzFEIjK5IaOkto=; b=DVKs6NRz9v+s1k3oKpPOjKxY8hDmMW3DRNcb58KLi63te6aSPZ8FUY21UaO+mlaFfR 0P+79lN/EhOOItjky7e0/pO8seYolCvX11ykUHOddvakTyHf8dOCt1ql1DSLMGnbueko R//tY/RYUZZyIO7XsHPgrvCSw1vPbYHdmkIdJZIDVKjte9Z28Ciwqb7cUf8VoGoTXCed bUq3VxVEi3uOb/BDaFj6jYMVzHUGhaghO7eGIMZRDJIWFsbFWJIOh0oCd2TmdFLGGdMz h/7zWrq5t7BEtLX0L2IuFNLQlODpEJPp5/nv3n+JczY1KJt9l8SrpcV7QxohxNlObBWH tHaQ== X-Gm-Message-State: AOJu0Yx3fIiqHWBWLBR2K5mJ3n7efcSDjbYFJZU9SNwL1ND66CRc/FCN XtiW2YwcCxJB7WiuQSXEdl+UdBY0mjCn6aaGgKGzzw== X-Google-Smtp-Source: AGHT+IE0s+Hyp0zq2MzHe2wiltH68CkiaSu0OYCRaXFSVHIPP73iunas68636wCe73bNFeZP7ZdSFA== X-Received: by 2002:a05:6a20:3955:b0:14c:def1:e728 with SMTP id r21-20020a056a20395500b0014cdef1e728mr2985721pzg.60.1695838875156; Wed, 27 Sep 2023 11:21:15 -0700 (PDT) Received: from telecaster.thefacebook.com ([2620:10d:c090:500::6:efab]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e81000b001bf6ea340a9sm13397842plg.159.2023.09.27.11.21.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:21:14 -0700 (PDT) From: Omar Sandoval To: elfutils-devel@sourceware.org Subject: [PATCH 02/14] libdw: Handle split DWARF in dwarf_entrypc Date: Wed, 27 Sep 2023 11:20:51 -0700 Message-ID: <4d980efe1a90d50a4aae2758bbed21c05b664ee4.1695837512.git.osandov@fb.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" From: Omar Sandoval If a DIE has no DW_AT_entry_pc attribute, dwarf_entrypc looks for DW_AT_low_pc in that DIE. But for a split compilation unit DIE, DW_AT_low_pc is in the corresponding skeleton DIE, so this fails. dwarf_lowpc already handles this fallback, so use it instead. Signed-off-by: Omar Sandoval --- libdw/ChangeLog | 1 + libdw/dwarf_entrypc.c | 12 +++++------- tests/ChangeLog | 4 ++++ tests/run-varlocs.sh | 14 +++++++------- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 0014aeb1..af74ce0d 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,6 +1,7 @@ 2023-09-27 Omar Sandoval * libdw_find_split_unit.c (try_split_file): Make static. + * dwarf_entrypc.c (dwarf_entrypc): Call dwarf_lowpc. 2023-02-22 Mark Wielaard diff --git a/libdw/dwarf_entrypc.c b/libdw/dwarf_entrypc.c index 0ef3b0ea..543567d4 100644 --- a/libdw/dwarf_entrypc.c +++ b/libdw/dwarf_entrypc.c @@ -37,12 +37,10 @@ int dwarf_entrypc (Dwarf_Die *die, Dwarf_Addr *return_addr) { - Dwarf_Attribute attr_mem; - - return INTUSE(dwarf_formaddr) (INTUSE(dwarf_attr) (die, DW_AT_entry_pc, - &attr_mem) - ?: INTUSE(dwarf_attr) (die, DW_AT_low_pc, - &attr_mem), - return_addr); + Dwarf_Attribute attr_mem, *attr; + if ((attr = INTUSE(dwarf_attr) (die, DW_AT_entry_pc, &attr_mem)) != NULL) + return INTUSE(dwarf_formaddr) (attr, return_addr); + else + return INTUSE(dwarf_lowpc) (die, return_addr); } INTDEF(dwarf_entrypc) diff --git a/tests/ChangeLog b/tests/ChangeLog index d816873c..f934c114 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +2023-09-27 Omar Sandoval + + * run-varlocs.sh: Add entry PC to split units. + 2023-04-21 Frank Ch. Eigler * run-debuginfod-IXr.sh: New test. diff --git a/tests/run-varlocs.sh b/tests/run-varlocs.sh index b2621776..cbbcf6c7 100755 --- a/tests/run-varlocs.sh +++ b/tests/run-varlocs.sh @@ -206,7 +206,7 @@ testfiles testfilesplitranges5.debug testfiles testfile-ranges-hello5.dwo testfile-ranges-world5.dwo testrun_compare ${abs_top_builddir}/tests/varlocs --debug -e testfilesplitranges5.debug <<\EOF module 'testfilesplitranges5.debug' -[14] CU 'hello.c' +[14] CU 'hello.c'@0 [1d] function 'no_say'@401160 frame_base: {call_frame_cfa {...}} [33] parameter 'prefix' @@ -236,7 +236,7 @@ module 'testfilesplitranges5.debug' [111] parameter 'count' [401150,401160) {reg4} module 'testfilesplitranges5.debug' -[14] CU 'world.c' +[14] CU 'world.c'@401180 [1d] function 'no_main'@4011d0 frame_base: {call_frame_cfa {...}} [35] parameter 'argc' @@ -282,7 +282,7 @@ testfiles testfilesplitranges4.debug testfiles testfile-ranges-hello.dwo testfile-ranges-world.dwo testrun_compare ${abs_top_builddir}/tests/varlocs --debug -e testfilesplitranges4.debug <<\EOF module 'testfilesplitranges4.debug' -[b] CU 'hello.c' +[b] CU 'hello.c'@0 [18] function 'no_say'@4004f0 frame_base: {call_frame_cfa {...}} [2f] parameter 'prefix' @@ -310,7 +310,7 @@ module 'testfilesplitranges4.debug' [102] parameter 'count' [4004e0,4004f0) {reg4} module 'testfilesplitranges4.debug' -[b] CU 'world.c' +[b] CU 'world.c'@400500 [18] function 'no_main'@400550 frame_base: {call_frame_cfa {...}} [2f] parameter 'argc' @@ -373,7 +373,7 @@ EOF testfiles testfile-addrx_constx-5 addrx_constx-5.dwo testrun_compare ${abs_top_builddir}/tests/varlocs --exprlocs -e testfile-addrx_constx-5 <<\EOF module 'testfile-addrx_constx-5' -[14] CU 'addrx_constx.c' +[14] CU 'addrx_constx.c'@0 producer (strx) language (data1) name (strx) @@ -467,7 +467,7 @@ EOF testfiles testfile-addrx_constx-4 addrx_constx-4.dwo testrun_compare ${abs_top_builddir}/tests/varlocs --exprlocs -e testfile-addrx_constx-4 <<\EOF module 'testfile-addrx_constx-4' -[b] CU 'addrx_constx.c' +[b] CU 'addrx_constx.c'@0 producer (GNU_str_index) language (data1) name (GNU_str_index) @@ -565,7 +565,7 @@ testfiles splitdwarf4-not-split4.dwo testrun_compare ${abs_top_builddir}/tests/varlocs --debug -e testfile-splitdwarf4-not-split4.debug <<\EOF module 'testfile-splitdwarf4-not-split4.debug' -[b] CU 'splitdwarf4-not-split4.c' +[b] CU 'splitdwarf4-not-split4.c'@0 [18] function 'main'@401050 frame_base: {call_frame_cfa {...}} [30] parameter 'argc' From patchwork Wed Sep 27 18:20:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 76798 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 C02203865C2A for ; Wed, 27 Sep 2023 18:21:32 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 7CAF6385CCA4 for ; Wed, 27 Sep 2023 18:21:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7CAF6385CCA4 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=osandov.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=osandov.com Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-692eed30152so5622539b3a.1 for ; Wed, 27 Sep 2023 11:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1695838876; x=1696443676; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=G9+KaunBz7bDpEDqxBB0qdk1XgLi7+NF4Cqs+XUf4ZI=; b=zmkskKkPDwsFQKJtiY4WOBT8wcD+LKeO9pXSYaz6XYIpBa9CyP7QS52LwF3xq4tgxm El6e+GORQQSjHHFkCZb1JjxzxpaRe3UtbR1RE4EuU9jt12Qahf1QEmwYioJXs4mvn4bm 2In70Igigxy7XDVCxVp0B0G5V5VSB8J/DBzKl70obqPwxllehPc1qkG4poA3+gpiBo6X FD+GyTYBYBOSBfIlVggXfoQwv3xgnB8D3fLehR3F883kAqk/iL/9v7o0xPYsO2F4i96t GLr1rVoEb5aZSi34s7vpcRSzR5464Zxh4syWl3viFkVpIZhXfRBE7BP1lDSMU3LL4HFx cZ3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695838876; x=1696443676; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G9+KaunBz7bDpEDqxBB0qdk1XgLi7+NF4Cqs+XUf4ZI=; b=VE1HSITOHywRy+Dl34roPjq7DyXBB7VhDnpEZ+KKbRDye0RASwJ5zTu3e7CVO6EuIo CwTpdDiwkIjVAC8nYcg9cZ0dvzh7lhPK0U8XlqOg5WWHdEFs+hBC28QgfXxQ7HTGpkYd aTOSRD2scP8+gZe7cyi+DuX8Z+JWAT8vT2g8l/PvzGZj8ObvUNfMRXX9Zw0v3H7tRqz3 RTpHYHqF7qsR0c6ChN/oFIwaM2oTheWDOe7a9vq33S+EwMVfAajox6ptbxi9Rjq/qlKX 5+6+JcPQtqPMaotlkEk8T+VMD17QtVfWCY7EN853+SIVLAekydhq6IdLy7YeW4RlPfOM mPiA== X-Gm-Message-State: AOJu0YxHSNfpl6rriZZGyQOFAd2aznkn/a83eyp9UrCocu+1FeMQ7fPE 3X0k5WPcVfmI6irAssHvo3jWqFO1uXm+NX2n8uUH9Q== X-Google-Smtp-Source: AGHT+IEiUplHYaF3JWJOvHJOkMpUBdh3nWvGnv2f2mL8noGa+GSKeZWPEfGx9sijPCIxbzkGJWPS9g== X-Received: by 2002:a05:6a20:8f1a:b0:13d:5b8e:db83 with SMTP id b26-20020a056a208f1a00b0013d5b8edb83mr3172969pzk.9.1695838876099; Wed, 27 Sep 2023 11:21:16 -0700 (PDT) Received: from telecaster.thefacebook.com ([2620:10d:c090:500::6:efab]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e81000b001bf6ea340a9sm13397842plg.159.2023.09.27.11.21.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:21:15 -0700 (PDT) From: Omar Sandoval To: elfutils-devel@sourceware.org Subject: [PATCH 03/14] libdw: Handle DW_AT_ranges in split DWARF 5 skeleton in dwarf_ranges Date: Wed, 27 Sep 2023 11:20:52 -0700 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" From: Omar Sandoval When commit 879f3a4f99df ("libdw: Handle .debug_rnglists in dwarf_ranges.") added support for split DWARF 5 in 2018, GCC put all range lists for split DWARF in the .debug_rnglists section of the skeleton file (similarly to GNU DebugFission, which puts all range lists in .debug_ranges in the skeleton file). In 2021, after a discussion on the dwarf-discuss mailing list [1], GCC changed this to match Clang's behavior. Now, ranges are in .debug_rnglists.dwo in the split file, _except_ for one: the skeleton unit DIE has a DW_AT_ranges attribute, and its ranges are in .debug_rnglists in the skeleton file. See GCC commit 4b33c5aaab9e ("dwarf2out: Fix up ranges for -gdwarf-5 -gsplit-dwarf [PR99490]") and the Issue 210310.1 clarifying the DWARF standard [2]. Unfortunately, this confuses dwarf_ranges, which always uses .debug_rnglists.dwo if it exists. Fix it by special casing the unit DIE: its range lists should be in .debug_rnglists if that exists, and .debug_rnglists.dwo otherwise. 1: https://lists.dwarfstd.org/pipermail/dwarf-discuss/2021-March/002009.html 2: https://dwarfstd.org/issues/210310.1.html Signed-off-by: Omar Sandoval --- libdw/ChangeLog | 2 ++ libdw/dwarf_ranges.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index af74ce0d..e84432f6 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -2,6 +2,8 @@ * libdw_find_split_unit.c (try_split_file): Make static. * dwarf_entrypc.c (dwarf_entrypc): Call dwarf_lowpc. + * dwarf_ranges.c (dwarf_ranges): Use skeleton ranges section for + skeleton units. 2023-02-22 Mark Wielaard diff --git a/libdw/dwarf_ranges.c b/libdw/dwarf_ranges.c index 520f9ffe..b853e4b9 100644 --- a/libdw/dwarf_ranges.c +++ b/libdw/dwarf_ranges.c @@ -489,10 +489,10 @@ dwarf_ranges (Dwarf_Die *die, ptrdiff_t offset, Dwarf_Addr *basep, size_t secidx = (cu->version < 5 ? IDX_debug_ranges : IDX_debug_rnglists); const Elf_Data *d = cu->dbg->sectiondata[secidx]; - if (d == NULL && cu->unit_type == DW_UT_split_compile) + if (cu->unit_type == DW_UT_split_compile && (d == NULL || is_cudie (die))) { Dwarf_CU *skel = __libdw_find_split_unit (cu); - if (skel != NULL) + if (skel != NULL && skel->dbg->sectiondata[secidx] != NULL) { cu = skel; d = cu->dbg->sectiondata[secidx]; From patchwork Wed Sep 27 18:20:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 76801 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 D2295385CCA4 for ; Wed, 27 Sep 2023 18:21:38 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by sourceware.org (Postfix) with ESMTPS id 52D1938618D0 for ; Wed, 27 Sep 2023 18:21:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 52D1938618D0 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=osandov.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=osandov.com Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1c6219307b2so51703065ad.1 for ; Wed, 27 Sep 2023 11:21:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1695838877; x=1696443677; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=othP57DvOpUr7Bwf+2rME80KoHePIuI3pI1V8YYcqO8=; b=do0XPWKffmTBMyxuHhnDB14uCboHDggxEgd8NF3dVPRvOQWJJSjpNi9NXknFvkwYuH NCN4QpdqlcE3QA3zFm+useOrSr1aow6vaF7p28ScE9HPfI9oAMGa1lWoqPx61XArdqsM otMLdi1KH8MEM6lNJf45XcnfPX969AIz5LBehPlwbava0Jjyg/A3CSLrXCEJTFC6OQBk pZuJdJGt3vP7C+mRRFez2yMEJKE+Sj5pRV8G3lLA5dnGrrTZTCvGZrsPmAa6EWz+ckiT S8CUqk+ZB2M1E4wYxzKlsN2DX7eaGx1zA9a4DbeoQY73GdVsbFeUUJc+9E/hFPLvmmgs sjEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695838877; x=1696443677; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=othP57DvOpUr7Bwf+2rME80KoHePIuI3pI1V8YYcqO8=; b=Edg2Pt9OR50pTb/WZi8tEIiXqi/zIB3ortq1fyXTA8JjsD7cOdCjyTjx/75YLFr6pm A5C7g35ENQ3NDmDyc3wmJ28/S0ahpPh+e8rrjSizFPeppukrb7UUPzir1HIthXijyBba 0NlURWAx54FOjc6u3BCRq7vBC6bfg6TA1lIE2lxMs1IZS3o46Re/mG0gV/Q4levdyV4O cEBip2mEy6EXSum30VQsbe/lRJYASUJmAT4xryFGO5C2kGrKwo1LX13PV91hd9z8/wbN u2zn9XA2SO2eBSAAM9/vgrDFdrgVdNyZDemsfgAkuFSqEMaVVyHld9oPiqKL/ho5FjfK EqOA== X-Gm-Message-State: AOJu0Yy04MTCS6h9chVaR1TyM4OkiH0X4OiKqQ4CrBbJIO13lcWAqk5q YUb0Ys0kcd1xsLpmS4kG+LSgxWycHnZikTyqL+fGrw== X-Google-Smtp-Source: AGHT+IEfGGfamhrCovCzVjLd4jzh+xz4gNqwhsQFPq72K3LnZrvjpX7saHw6cj/vjv5mQuI96y/pRg== X-Received: by 2002:a17:902:8211:b0:1c0:d7a8:a43e with SMTP id x17-20020a170902821100b001c0d7a8a43emr2415364pln.53.1695838877164; Wed, 27 Sep 2023 11:21:17 -0700 (PDT) Received: from telecaster.thefacebook.com ([2620:10d:c090:500::6:efab]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e81000b001bf6ea340a9sm13397842plg.159.2023.09.27.11.21.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:21:16 -0700 (PDT) From: Omar Sandoval To: elfutils-devel@sourceware.org Subject: [PATCH 04/14] libdw: Handle other string forms in dwarf_macro_param2 Date: Wed, 27 Sep 2023 11:20:53 -0700 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" From: Omar Sandoval dwarf_getmacros handles the additional macro string forms added by DWARF 5, but dwarf_macro_param2 doesn't. Update it with the list of all string forms allowed in .debug_macro. In particular, GCC and Clang generate DW_MACRO_define_strx and DW_MACRO_undef_strx, which dwarf_macro_param2 couldn't handle. Fixes: cdf865b890c2 ("readelf, libdw: Handle DWARF5 .debug_macro.") Signed-off-by: Omar Sandoval --- libdw/ChangeLog | 3 +++ libdw/dwarf_macro_param2.c | 21 +++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index e84432f6..7528c093 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -4,6 +4,9 @@ * dwarf_entrypc.c (dwarf_entrypc): Call dwarf_lowpc. * dwarf_ranges.c (dwarf_ranges): Use skeleton ranges section for skeleton units. + * dwarf_macro_param2.c (dwarf_macro_param2): Change form condition to + switch statement and add DW_FORM_line_strp, DW_FORM_strp_sup, + DW_FORM_strx, and DW_FORM_strx[1-4]. 2023-02-22 Mark Wielaard diff --git a/libdw/dwarf_macro_param2.c b/libdw/dwarf_macro_param2.c index cc902c99..f12e6f9a 100644 --- a/libdw/dwarf_macro_param2.c +++ b/libdw/dwarf_macro_param2.c @@ -44,12 +44,21 @@ dwarf_macro_param2 (Dwarf_Macro *macro, Dwarf_Word *paramp, const char **strp) if (dwarf_macro_param (macro, 1, ¶m) != 0) return -1; - if (param.form == DW_FORM_string - || param.form == DW_FORM_strp) + switch (param.form) { - *strp = dwarf_formstring (¶m); - return 0; + /* String forms allowed by libdw_valid_user_form. */ + case DW_FORM_line_strp: + case DW_FORM_string: + case DW_FORM_strp: + case DW_FORM_strp_sup: + case DW_FORM_strx: + case DW_FORM_strx1: + case DW_FORM_strx2: + case DW_FORM_strx3: + case DW_FORM_strx4: + *strp = dwarf_formstring (¶m); + return 0; + default: + return dwarf_formudata (¶m, paramp); } - else - return dwarf_formudata (¶m, paramp); } From patchwork Wed Sep 27 18:20:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 76797 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 C1EC8387542C for ; Wed, 27 Sep 2023 18:21:31 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by sourceware.org (Postfix) with ESMTPS id 570DC3861877 for ; Wed, 27 Sep 2023 18:21:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 570DC3861877 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=osandov.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=osandov.com Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1c3bd829b86so94276005ad.0 for ; Wed, 27 Sep 2023 11:21:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1695838878; x=1696443678; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Xn0pfAlU+hWxPIfinZ1//zNzCqx95KOWLj9zm1tqzKM=; b=CpYg1IC1KAOrPoEZ2RUhQ61P9aQPWUVdxeDlxunxzTB62Xip1JExIFmT6Gk3hTLht3 qZMPWaRE/mKdXKRoLtXfgdnKp6dU/KWTzhx7JaNRAT0CizWXkOL0/G8kGjyw85hgcifK PZcdD7+chyOYDNqrgvrc6sRgcIqvlyWIqviOx5SnOIKThDP8kOT0OmJruPg5xmqPci+A sBnOA8tpu4GA6jwaXHQl94NAXgG+x0TBHpOoR6soFbtD+fiUKAhwfOWzQb0K5Ptoemxo y338iSDeqgNW1W43ZIMcVwgvOrCtr1c2ZwSwqQ5Ska1tXKa0LT51T5kAv0pBBy5puKNm +6Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695838878; x=1696443678; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Xn0pfAlU+hWxPIfinZ1//zNzCqx95KOWLj9zm1tqzKM=; b=ItLVtY1woXVMflIEsew7JXPAzkrZrd+fthjerhn961OTpmwosnh/3N+NaHV+76ye5R cm6ErpLDpiO4IkjpnyMEy4SRxZ19MxZPYR2Nj3AcueP7aVj3289VO6MvcoVFKIFQbJKm wjaHUHXZyZgIfHQyhv749Vr2qejAwrwkXmyt5BI1LeZWdqnC8bTNCc9R7Ca0D+RkPWbG ibBEwWrLAySpXUsEa3fEENLOB9KyNmPCuKMJauru/SI9DXPmmGxKllJntOcHlWQ9OvCh 1f8rxBpURhld/+45SJk2/z5iJX5DlmX24ADCk2+gUVwZrcPYdLSDXa3Fp+NXxBLREsZo gqNw== X-Gm-Message-State: AOJu0YyoomnBfso+EaYeSz9rt2MuppqLlgt4D706dcsqIoY5dubwq8tw OkiB6tczhsDJwpQT88Nvk3J1nF7KOeHz4fYN4Evb+A== X-Google-Smtp-Source: AGHT+IEUyALadBT6VvTK3HiBy3/e4Nl732iCENVc2L0ACFrmDdyReYT9LoQxBJ/dEOWMY3CP8t7/5w== X-Received: by 2002:a17:902:efcf:b0:1c3:749f:6a5c with SMTP id ja15-20020a170902efcf00b001c3749f6a5cmr2495493plb.12.1695838878086; Wed, 27 Sep 2023 11:21:18 -0700 (PDT) Received: from telecaster.thefacebook.com ([2620:10d:c090:500::6:efab]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e81000b001bf6ea340a9sm13397842plg.159.2023.09.27.11.21.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:21:17 -0700 (PDT) From: Omar Sandoval To: elfutils-devel@sourceware.org Subject: [PATCH 05/14] libdw: Fix dwarf_macro_getsrcfiles for DWARF 5 Date: Wed, 27 Sep 2023 11:20:54 -0700 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" From: Omar Sandoval Dwarf_Macro_Op_Table::is_64bit conflates the address size and the offset size: for .debug_macinfo, it is initialized based on the compilation unit's address size, but for .debug_macro, it is initialized based on the macro unit's offset size. is_64bit is used to determine the address size to pass to __libdw_getsrclines. For a 64-bit architecture using DWARF 5 with 32-bit offsets (the common case), this fails because read_srclines checks that the given address size matches the address size from the line number program header. Fix it by splitting is_64bit into separate address_size and offset_size members. Fixes: fb90bf3f84b5 ("Support .debug_macro") Signed-off-by: Omar Sandoval --- libdw/ChangeLog | 11 +++++++++++ libdw/dwarf_getmacros.c | 17 ++++++++++++++--- libdw/dwarf_macro_getsrcfiles.c | 3 +-- libdw/libdwP.h | 3 ++- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 7528c093..d3f36cc8 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -7,6 +7,17 @@ * dwarf_macro_param2.c (dwarf_macro_param2): Change form condition to switch statement and add DW_FORM_line_strp, DW_FORM_strp_sup, DW_FORM_strx, and DW_FORM_strx[1-4]. + * dwarf_getmacros.c (get_macinfo_table): Replace assignment of + table->is_64bit with assignments of table->address_size and + table->offset_size. + (get_table_for_offset): Ditto. + (read_macros): Get fake CU offset_size from table->offset_size instead + of table->is_64bit. + * dwarf_macro_getsrcfiles.c (dwarf_macro_getsrcfiles): Get + address_size for __libdw_getsrclines from table->address_size instead + of table->is_64bit. + * libdwP.h (Dwarf_Macro_Op_Table): Replace is_64bit with address_size + and offset_size. 2023-02-22 Mark Wielaard diff --git a/libdw/dwarf_getmacros.c b/libdw/dwarf_getmacros.c index fd929669..b7d98af4 100644 --- a/libdw/dwarf_getmacros.c +++ b/libdw/dwarf_getmacros.c @@ -134,7 +134,8 @@ get_macinfo_table (Dwarf *dbg, Dwarf_Word macoff, Dwarf_Die *cudie) table->offset = macoff; table->sec_index = IDX_debug_macinfo; table->line_offset = line_offset; - table->is_64bit = cudie->cu->address_size == 8; + table->address_size = cudie->cu->address_size; + table->offset_size = cudie->cu->offset_size; table->comp_dir = __libdw_getcompdir (cudie); return table; @@ -182,6 +183,15 @@ get_table_for_offset (Dwarf *dbg, Dwarf_Word macoff, return NULL; } + uint8_t address_size; + if (cudie != NULL) + address_size = cudie->cu->address_size; + else + { + char *ident = elf_getident (dbg->elf, NULL); + address_size = ident[EI_CLASS] == ELFCLASS32 ? 4 : 8; + } + /* """The macinfo entry types defined in this standard may, but might not, be described in the table""". @@ -258,7 +268,8 @@ get_table_for_offset (Dwarf *dbg, Dwarf_Word macoff, .line_offset = line_offset, .header_len = readp - startp, .version = version, - .is_64bit = is_64bit, + .address_size = address_size, + .offset_size = is_64bit ? 8 : 4, /* NULL if CUDIE is NULL or DW_AT_comp_dir is absent. */ .comp_dir = __libdw_getcompdir (cudie), @@ -368,7 +379,7 @@ read_macros (Dwarf *dbg, int sec_index, .dbg = dbg, .sec_idx = sec_index, .version = table->version, - .offset_size = table->is_64bit ? 8 : 4, + .offset_size = table->offset_size, .str_off_base = str_offsets_base_off (dbg, (cudie != NULL ? cudie->cu: NULL)), .startp = (void *) startp + offset, diff --git a/libdw/dwarf_macro_getsrcfiles.c b/libdw/dwarf_macro_getsrcfiles.c index 3b1794b1..4e8deeeb 100644 --- a/libdw/dwarf_macro_getsrcfiles.c +++ b/libdw/dwarf_macro_getsrcfiles.c @@ -72,8 +72,7 @@ dwarf_macro_getsrcfiles (Dwarf *dbg, Dwarf_Macro *macro, will be broken. */ if (__libdw_getsrclines (dbg, line_offset, table->comp_dir, - table->is_64bit ? 8 : 4, - NULL, &table->files) < 0) + table->address_size, NULL, &table->files) < 0) table->files = (void *) -1; } diff --git a/libdw/libdwP.h b/libdw/libdwP.h index 5cbdc279..c3fe9f93 100644 --- a/libdw/libdwP.h +++ b/libdw/libdwP.h @@ -526,7 +526,8 @@ typedef struct Dwarf_Half header_len; uint16_t version; - bool is_64bit; + uint8_t address_size; + uint8_t offset_size; uint8_t sec_index; /* IDX_debug_macro or IDX_debug_macinfo. */ /* Shows where in TABLE each opcode is defined. Since opcode 0 is From patchwork Wed Sep 27 18:20:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 76799 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 4485F3861962 for ; Wed, 27 Sep 2023 18:21:33 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by sourceware.org (Postfix) with ESMTPS id 2FC54386192D for ; Wed, 27 Sep 2023 18:21:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2FC54386192D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=osandov.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=osandov.com Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1c1ff5b741cso106072165ad.2 for ; Wed, 27 Sep 2023 11:21:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1695838879; x=1696443679; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=+CulrTyA7WNmu+8CDtxtGWhEllaLVylKPrXOTjjbe2U=; b=UH4eCJcJX+hVoHnYK2LTvTYBmloJNKJ6/RKoiMHSUXRY+CSUPbSsKhy1e+hPDu0Y3D j9MxOCYIxBS6rf3DOQt5c1l27Z9N8Rh2R0kKPVAZnpCG/ln41T9v4DE+S8tMETItVxbi M9iWxjOGOGyFixUeFaDAmjQIhmihDK8BeZ1rYwdTJwshRI46r9Rolr2cIEF4Q0sNu1GS fQ/UTUzttehG4EbUAZTyBNYtNskIBJ3SNOksJPCvSG3aHh3Rf+WFeY26vc2kdAVa7WyD smyEQy2F19hPtFqF41sAk7mhT1IcPJM6swASCa5sHZn8Z7L+umoSWTOzUueAaxjMJFel qrwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695838879; x=1696443679; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+CulrTyA7WNmu+8CDtxtGWhEllaLVylKPrXOTjjbe2U=; b=LvtQn+XceJsmxhnrT4CvD6pNpB8JVDKTgCkLe8EZVdY5SSD+GoCwnEnIXGYOehfgUy 4l9dZd7HnWhCaymlcQ39ZieZYpcdq61UvYptU86/7CK0icMVbdnpzPSnENrL8yAudK7w Va9eVj9sg4/MgYjBAekRkrpqTalsNrSQi2+EIfou+pybm6Owywf7mUiXBRXjP/NscBrl qbqlNV3CBbIUgrL8WOER6x/6pQNrRnHC3av7FNQ0BUbY1glaAIuXAYurlogu28HRQ5h2 y4xPY3pvMbfDFe5dSG1hKQ242f5Dt+ZqL/O2TP5TYFnjAjw7pSYWsRf1RZ2LYb870A4b dy3Q== X-Gm-Message-State: AOJu0YwRNZPtBfpsS0EXIsMruOOsUtbni/Dp1z/XmjtGQCVfEQO9D6sj HywS24YKOmBFFWASTC3W+UjYKq/qP+co1MvQCYQ3Kg== X-Google-Smtp-Source: AGHT+IFAnFl2fvbt3ORw0uJ/dO2Br0FmZZsKTJuqQhN6UK78AzzZSsq5s1Bb2aWmODvrk39kp4NCWA== X-Received: by 2002:a17:902:d48f:b0:1bb:9b48:ea94 with SMTP id c15-20020a170902d48f00b001bb9b48ea94mr3076626plg.32.1695838878912; Wed, 27 Sep 2023 11:21:18 -0700 (PDT) Received: from telecaster.thefacebook.com ([2620:10d:c090:500::6:efab]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e81000b001bf6ea340a9sm13397842plg.159.2023.09.27.11.21.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:21:18 -0700 (PDT) From: Omar Sandoval To: elfutils-devel@sourceware.org Subject: [PATCH 06/14] libdw: Handle split DWARF in dwarf_macro_getsrcfiles Date: Wed, 27 Sep 2023 11:20:55 -0700 Message-ID: <4d46a2bb0eba8e3aff5a33c045cd5a75342d596b.1695837512.git.osandov@fb.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" From: Omar Sandoval Macro information references file names from the line number information table, which is tricky in split DWARF for a couple of reasons. First, the line number information for a macro unit comes from the .debug_line.dwo section in the split file, not the .debug_line section in the skeleton file. This was not specified in the GNU DebugFission design document [1] or the DWARF 5 standard, but it is how GCC and Clang behave in practice and was clarified in DWARF standard issue 200602.1 [2] for the upcoming DWARF 6 standard. dwarf_macro_getsrcfiles uses the line number information from whichever Dwarf handle it was passed. This is error-prone, since the most natural thing to do is to pass the skeleton Dwarf handle. Fix this by storing the appropriate Dwarf handle in Dwarf_Macro_Op_Table and using that one. Second, for .debug_macinfo.dwo in GNU DebugFission (generated by gcc -gdwarf-4 -gstrict-dwarf -gsplit-dwarf), the offset into .debug_line.dwo is implicitly 0. Again, this isn't in any specification, but it's how GCC behaves in practice (Clang never generates macro information for DWARF 4 split DWARF). Make get_macinfo_table default to 0 for split DWARF when it can't find DW_AT_stmt_list. 1: https://gcc.gnu.org/wiki/DebugFission 2: https://dwarfstd.org/issues/200602.1.html Signed-off-by: Omar Sandoval --- libdw/ChangeLog | 8 +++++--- libdw/dwarf_getmacros.c | 11 +++++++++-- libdw/dwarf_macro_getsrcfiles.c | 5 ++++- libdw/libdwP.h | 2 ++ 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index d3f36cc8..be1e40bc 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -9,15 +9,17 @@ DW_FORM_strx, and DW_FORM_strx[1-4]. * dwarf_getmacros.c (get_macinfo_table): Replace assignment of table->is_64bit with assignments of table->address_size and - table->offset_size. + table->offset_size. Assume default DW_AT_stmt_list of 0 for split + DWARF. Set table->dbg. (get_table_for_offset): Ditto. (read_macros): Get fake CU offset_size from table->offset_size instead of table->is_64bit. * dwarf_macro_getsrcfiles.c (dwarf_macro_getsrcfiles): Get address_size for __libdw_getsrclines from table->address_size instead - of table->is_64bit. + of table->is_64bit. Get dbg for __libdw_getsrclines from table->dbg + instead of dbg parameter, which is now unused. * libdwP.h (Dwarf_Macro_Op_Table): Replace is_64bit with address_size - and offset_size. + and offset_size. Add dbg. 2023-02-22 Mark Wielaard diff --git a/libdw/dwarf_getmacros.c b/libdw/dwarf_getmacros.c index b7d98af4..a3a78884 100644 --- a/libdw/dwarf_getmacros.c +++ b/libdw/dwarf_getmacros.c @@ -124,13 +124,19 @@ get_macinfo_table (Dwarf *dbg, Dwarf_Word macoff, Dwarf_Die *cudie) = INTUSE(dwarf_attr) (cudie, DW_AT_stmt_list, &attr_mem); Dwarf_Off line_offset = (Dwarf_Off) -1; if (attr != NULL) - if (unlikely (INTUSE(dwarf_formudata) (attr, &line_offset) != 0)) - return NULL; + { + if (unlikely (INTUSE(dwarf_formudata) (attr, &line_offset) != 0)) + return NULL; + } + else if (cudie->cu->unit_type == DW_UT_split_compile + && dbg->sectiondata[IDX_debug_line] != NULL) + line_offset = 0; Dwarf_Macro_Op_Table *table = libdw_alloc (dbg, Dwarf_Macro_Op_Table, macinfo_data_size, 1); memcpy (table, macinfo_data, macinfo_data_size); + table->dbg = dbg; table->offset = macoff; table->sec_index = IDX_debug_macinfo; table->line_offset = line_offset; @@ -263,6 +269,7 @@ get_table_for_offset (Dwarf *dbg, Dwarf_Word macoff, macop_table_size, 1); *table = (Dwarf_Macro_Op_Table) { + .dbg = dbg, .offset = macoff, .sec_index = IDX_debug_macro, .line_offset = line_offset, diff --git a/libdw/dwarf_macro_getsrcfiles.c b/libdw/dwarf_macro_getsrcfiles.c index 4e8deeeb..11c587af 100644 --- a/libdw/dwarf_macro_getsrcfiles.c +++ b/libdw/dwarf_macro_getsrcfiles.c @@ -36,6 +36,9 @@ int dwarf_macro_getsrcfiles (Dwarf *dbg, Dwarf_Macro *macro, Dwarf_Files **files, size_t *nfiles) { + /* This was needed before Dwarf_Macro_Op_Table stored the Dwarf handle. */ + (void)dbg; + /* macro is declared NN */ Dwarf_Macro_Op_Table *const table = macro->table; if (table->files == NULL) @@ -71,7 +74,7 @@ dwarf_macro_getsrcfiles (Dwarf *dbg, Dwarf_Macro *macro, the same unit through dwarf_getsrcfiles, and the file names will be broken. */ - if (__libdw_getsrclines (dbg, line_offset, table->comp_dir, + if (__libdw_getsrclines (table->dbg, line_offset, table->comp_dir, table->address_size, NULL, &table->files) < 0) table->files = (void *) -1; } diff --git a/libdw/libdwP.h b/libdw/libdwP.h index c3fe9f93..77959b3b 100644 --- a/libdw/libdwP.h +++ b/libdw/libdwP.h @@ -508,6 +508,8 @@ typedef struct /* Prototype table. */ typedef struct { + Dwarf *dbg; + /* Offset of .debug_macro section. */ Dwarf_Off offset; From patchwork Wed Sep 27 18:20:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 76800 X-Patchwork-Delegate: mark@klomp.org 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 C4516387545E for ; Wed, 27 Sep 2023 18:21:37 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id 46017386193D for ; Wed, 27 Sep 2023 18:21:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 46017386193D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=osandov.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=osandov.com Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1c451541f23so93956845ad.2 for ; Wed, 27 Sep 2023 11:21:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1695838880; x=1696443680; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=BTki94gTumXFaJIvKf77dGIhjrPfMj7hk5Dflm1SzUU=; b=WlvxEDQpneY2J+wWpQ+795ZDd+dIsdSbhnJPeNZ9Xg/uXas4YMKDJVZc3S8D9Sak2d IniA4NnD2zpS0J++W3OZuEdHoPwtmrVrsPVOngMZZ/xCtQ9UWcliBaJyXfkye3esk62/ Q/iHXpdGolbMCRY/MG2yaLsl0gJgGur0pbcBtbWwVigUYukeIHgyaZOFu1bgtvscKKD2 Hsvk3jBdiz2xx3RFHIJnpl2vQRotrEHRuyq23FcAKKr1UaHeIO5Q5UwZQT6sYQ6Wn5+X 6X9z9UtuOMeeCNKJB5JW5SCMPXoMLWZqIgwzWxbbJC0t2B/kQHzK43MTmxa5u3dLizTV zJLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695838880; x=1696443680; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BTki94gTumXFaJIvKf77dGIhjrPfMj7hk5Dflm1SzUU=; b=YobPRiZEs3Z6xRLDi5JWu4gI1XMtVjjzU1qekZ7qGXlE4DTPj3CsdBRb32+cDAyB+9 J9t6ykhzinYqmUF0cSrjqj/YYTOB6N99ZOH+DvsZ1vocvNAjWlwiYColc+zrw9Yb/NLP wpFsgTu6rN6WG4XJSGvMI7hPwPFgmU+3CYLlWgidWNnaTokWhrCJsUL4LfK4UMPsvb11 r0F8knVgF1oR75yei61gkmN07tTfIda+CkOmxhAbeqif9jUBnmlmnNuMYksSiB2gv2Vu 6PKz/+mkOltSSkNouKloQFINSmAJWMGSxlZAqy2CIQpfn37IdI7+4jMTExKfdQNdD69F WW7A== X-Gm-Message-State: AOJu0Yxi4kCOtNg2cfBBOWNm+BxcLPAxkyrmBZ/gb3h+XwrpbgfRbjrg k8uhhzmNXiGHLTb1KyeLaJfjJQ71L6Tftf8mmtFl4A== X-Google-Smtp-Source: AGHT+IE4nEve4giAwtufWhBQR6vkKkrmTZZf1zFKt+SUmDh8WrxdABXWdByHTAMADeoSRUDZMpCJwQ== X-Received: by 2002:a17:902:efcf:b0:1c3:749f:6a5c with SMTP id ja15-20020a170902efcf00b001c3749f6a5cmr2495580plb.12.1695838879909; Wed, 27 Sep 2023 11:21:19 -0700 (PDT) Received: from telecaster.thefacebook.com ([2620:10d:c090:500::6:efab]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e81000b001bf6ea340a9sm13397842plg.159.2023.09.27.11.21.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:21:19 -0700 (PDT) From: Omar Sandoval To: elfutils-devel@sourceware.org Subject: [PATCH 07/14] libdw: Recognize .debug_[ct]u_index sections in dwarf_elf_begin Date: Wed, 27 Sep 2023 11:20:56 -0700 Message-ID: <5837a252931d4a85079d29d08f8b6890ae070700.1695837512.git.osandov@fb.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" From: Omar Sandoval DWARF package (.dwp) files have a .debug_cu_index section and, optionally, a .debug_tu_index section. Add them to the list of DWARF sections. Unfortunately, it's not that simple: the other debug sections in a dwp file have names ending with .dwo, which confuses the checks introduced by commit 5b21e70216b8 ("libdw: dwarf_elf_begin should use either plain, dwo or lto DWARF sections."). So, we also have to special case .debug_cu_index and .debug_tu_index in scn_dwarf_type and check_section to treat them as TYPE_DWO sections. Signed-off-by: Omar Sandoval --- libdw/ChangeLog | 8 +++++++ libdw/dwarf_begin_elf.c | 53 +++++++++++++++++++++-------------------- libdw/libdwP.h | 2 ++ 3 files changed, 37 insertions(+), 26 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index be1e40bc..52327688 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -20,6 +20,14 @@ instead of dbg parameter, which is now unused. * libdwP.h (Dwarf_Macro_Op_Table): Replace is_64bit with address_size and offset_size. Add dbg. + Add IDX_debug_cu_index and IDX_debug_tu_index. + * dwarf_begin_elf.c (dwarf_scnnames): Add IDX_debug_cu_index and + IDX_debug_tu_index. + (scn_to_string_section_idx): Ditto. + (scn_dwarf_type): Check for .debug_cu_index, .debug_tu_index, + .zdebug_cu_index, and .zdebug_tu_index. + (check_section): Change .dwo suffix matching to account for + .debug_cu_index and .debug_tu_index. 2023-02-22 Mark Wielaard diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c index 92d76d24..7936d343 100644 --- a/libdw/dwarf_begin_elf.c +++ b/libdw/dwarf_begin_elf.c @@ -67,6 +67,8 @@ static const char dwarf_scnnames[IDX_last][19] = [IDX_debug_macro] = ".debug_macro", [IDX_debug_ranges] = ".debug_ranges", [IDX_debug_rnglists] = ".debug_rnglists", + [IDX_debug_cu_index] = ".debug_cu_index", + [IDX_debug_tu_index] = ".debug_tu_index", [IDX_gnu_debugaltlink] = ".gnu_debugaltlink" }; #define ndwarf_scnnames (sizeof (dwarf_scnnames) / sizeof (dwarf_scnnames[0])) @@ -92,6 +94,8 @@ static const enum string_section_index scn_to_string_section_idx[IDX_last] = [IDX_debug_macro] = STR_SCN_IDX_last, [IDX_debug_ranges] = STR_SCN_IDX_last, [IDX_debug_rnglists] = STR_SCN_IDX_last, + [IDX_debug_cu_index] = STR_SCN_IDX_last, + [IDX_debug_tu_index] = STR_SCN_IDX_last, [IDX_gnu_debugaltlink] = STR_SCN_IDX_last }; @@ -109,6 +113,11 @@ scn_dwarf_type (Dwarf *result, size_t shstrndx, Elf_Scn *scn) { if (startswith (scnname, ".gnu.debuglto_.debug")) return TYPE_GNU_LTO; + else if (strcmp (scnname, ".debug_cu_index") == 0 + || strcmp (scnname, ".debug_tu_index") == 0 + || strcmp (scnname, ".zdebug_cu_index") == 0 + || strcmp (scnname, ".zdebug_tu_index") == 0) + return TYPE_DWO; else if (startswith (scnname, ".debug_") || startswith (scnname, ".zdebug_")) { size_t len = strlen (scnname); @@ -173,42 +182,34 @@ check_section (Dwarf *result, size_t shstrndx, Elf_Scn *scn, bool inscngrp) bool gnu_compressed = false; for (cnt = 0; cnt < ndwarf_scnnames; ++cnt) { + /* .debug_cu_index and .debug_tu_index don't have a .dwo suffix, + but they are for DWO. */ + if (result->type != TYPE_DWO + && (cnt == IDX_debug_cu_index || cnt == IDX_debug_tu_index)) + continue; + bool need_dot_dwo = + (result->type == TYPE_DWO + && cnt != IDX_debug_cu_index + && cnt != IDX_debug_tu_index); size_t dbglen = strlen (dwarf_scnnames[cnt]); size_t scnlen = strlen (scnname); if (strncmp (scnname, dwarf_scnnames[cnt], dbglen) == 0 - && (dbglen == scnlen - || (scnlen == dbglen + 4 + && ((!need_dot_dwo && dbglen == scnlen) + || (need_dot_dwo + && scnlen == dbglen + 4 && strstr (scnname, ".dwo") == scnname + dbglen))) - { - if (dbglen == scnlen) - { - if (result->type == TYPE_PLAIN) - break; - } - else if (result->type == TYPE_DWO) - break; - } + break; else if (scnname[0] == '.' && scnname[1] == 'z' && (strncmp (&scnname[2], &dwarf_scnnames[cnt][1], dbglen - 1) == 0 - && (scnlen == dbglen + 1 - || (scnlen == dbglen + 5 + && ((!need_dot_dwo && scnlen == dbglen + 1) + || (need_dot_dwo + && scnlen == dbglen + 5 && strstr (scnname, ".dwo") == scnname + dbglen + 1)))) { - if (scnlen == dbglen + 1) - { - if (result->type == TYPE_PLAIN) - { - gnu_compressed = true; - break; - } - } - else if (result->type <= TYPE_DWO) - { - gnu_compressed = true; - break; - } + gnu_compressed = true; + break; } else if (scnlen > 14 /* .gnu.debuglto_ prefix. */ && startswith (scnname, ".gnu.debuglto_") diff --git a/libdw/libdwP.h b/libdw/libdwP.h index 77959b3b..0c44d40c 100644 --- a/libdw/libdwP.h +++ b/libdw/libdwP.h @@ -82,6 +82,8 @@ enum IDX_debug_macro, IDX_debug_ranges, IDX_debug_rnglists, + IDX_debug_cu_index, + IDX_debug_tu_index, IDX_gnu_debugaltlink, IDX_last }; From patchwork Wed Sep 27 18:20:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 76807 X-Patchwork-Delegate: mark@klomp.org 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 3C75A3861855 for ; Wed, 27 Sep 2023 18:22:07 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id 3B41A38618E9 for ; Wed, 27 Sep 2023 18:21:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3B41A38618E9 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=osandov.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=osandov.com Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1c61bde0b4bso62710205ad.3 for ; Wed, 27 Sep 2023 11:21:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1695838883; x=1696443683; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=3kXCXWTAUAlW1NDn6a5jnPetEHdZIGDN/C1drj+hqTE=; b=d5SLZbtkeNfvCq1wu0G79Q5xBvTESv2PTVdiyQE1PB21Mumz7r6GMwR9HXXYxO1fuz JcsmF9Q0fFHURsl4o3wMx7P9cIPkJyqkfeqNYBTUiq6sDDdqwve4OekX3eh6UEUEpEqC Ng3zzxiEULvpkE1SQvZdnUDNBCMfqF5S2rtKfdXPkTrfr99G1NQF2rNX6gnhDYgdI3ba SD+0QyR9FWOuzgVZo+SdCR+MggkeIHrbPMbpU3YYXR/prSfXdRsFnC9CVpxOoW6dPDHM QNpscu3ZW9MiXJjVnpYKEbepLsrGSM3+RItpIBaJRPYDPb126IDKN67qBxypFkVdmcQm 1N5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695838883; x=1696443683; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3kXCXWTAUAlW1NDn6a5jnPetEHdZIGDN/C1drj+hqTE=; b=HUM2lkRcsn6etzMLtewFMj4LPmVhz6JTlH2rVH1GeQIlAP2oIsQCemr/2WN2M0T/Z7 iwD8crRs2yjqL0rQR/Q5SetVUAUJm93tEB4JHE3pBxmWFh9IJxC0enzcWi4uKL+ixKDr iVzS/eRNmIarR6HOHa9+awqdrluBFr9hQwwCvkfUge+nwUGkOJhh1mJcvnQYS6DX8q0E UyAIYAC1i+urJ/lWfz2g14RH2gUdRfdP7oKaiLvOtG8VecipLvD+vEVA7N8jDzAjnlP7 U+gd0IXCcPE2qvU26IUwcGHNt4m9In2uW+MmsLs7XBXgbA54sBh89FbY9A7C+faDejtJ 8GcA== X-Gm-Message-State: AOJu0YwnYNV0b9ssYq04fxDTiZevE/jlSYXvnxKfI9Vl4jbnwICr/7wp Ns060NmxH780GyrLF728grt/2QYe+OenlGMZDs4OJw== X-Google-Smtp-Source: AGHT+IHLdwem4cZLACHKnYebBnhFN3OFC6SSU/yXZAY255Wo36Ur2vlXigCmVCRj3AePRbxJiq74jg== X-Received: by 2002:a17:902:ec92:b0:1c5:dfe9:b209 with SMTP id x18-20020a170902ec9200b001c5dfe9b209mr2462520plg.62.1695838881221; Wed, 27 Sep 2023 11:21:21 -0700 (PDT) Received: from telecaster.thefacebook.com ([2620:10d:c090:500::6:efab]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e81000b001bf6ea340a9sm13397842plg.159.2023.09.27.11.21.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:21:20 -0700 (PDT) From: Omar Sandoval To: elfutils-devel@sourceware.org Subject: [PATCH 08/14] libdw: Parse DWARF package file index sections Date: Wed, 27 Sep 2023 11:20:57 -0700 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_LOTSOFHASH, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" From: Omar Sandoval The .debug_cu_index and .debug_tu_index sections in DWARF package files are basically hash tables mapping a unit's 8 byte signature to an offset and size in each section used by that unit [1]. Add support for parsing and doing lookups in the index sections. We look up a unit in the index when we intern it and cache its hash table row in Dwarf_CU. Then, a new function, dwarf_cu_dwp_section_info, can be used to look up the section offsets and sizes for a unit. This will mostly be used internally in libdw, but it will also be needed in static inline functions shared with eu-readelf. Additionally, making it public it makes dwp support much easier for external tools that do their own low-level parsing of DWARF information, like drgn [2]. 1: https://gcc.gnu.org/wiki/DebugFissionDWP#Format_of_the_CU_and_TU_Index_Sections 2: https://github.com/osandov/drgn Signed-off-by: Omar Sandoval --- libdw/ChangeLog | 18 +- libdw/Makefile.am | 2 +- libdw/dwarf_cu_dwp_section_info.c | 371 ++++++++++++++++++++++++++++ libdw/dwarf_end.c | 3 + libdw/dwarf_error.c | 1 + libdw/libdw.h | 23 ++ libdw/libdw.map | 5 + libdw/libdwP.h | 36 +++ libdw/libdw_findcu.c | 8 + tests/.gitignore | 1 + tests/ChangeLog | 13 + tests/Makefile.am | 11 +- tests/cu-dwp-section-info.c | 74 ++++++ tests/run-cu-dwp-section-info.sh | 168 +++++++++++++ tests/testfile-dwp-4-strict.bz2 | Bin 0 -> 4169 bytes tests/testfile-dwp-4-strict.dwp.bz2 | Bin 0 -> 6871 bytes tests/testfile-dwp-4.bz2 | Bin 0 -> 4194 bytes tests/testfile-dwp-4.dwp.bz2 | Bin 0 -> 10098 bytes tests/testfile-dwp-5.bz2 | Bin 0 -> 4223 bytes tests/testfile-dwp-5.dwp.bz2 | Bin 0 -> 10313 bytes tests/testfile-dwp.source | 102 ++++++++ 21 files changed, 831 insertions(+), 5 deletions(-) create mode 100644 libdw/dwarf_cu_dwp_section_info.c create mode 100644 tests/cu-dwp-section-info.c create mode 100755 tests/run-cu-dwp-section-info.sh create mode 100755 tests/testfile-dwp-4-strict.bz2 create mode 100644 tests/testfile-dwp-4-strict.dwp.bz2 create mode 100755 tests/testfile-dwp-4.bz2 create mode 100644 tests/testfile-dwp-4.dwp.bz2 create mode 100755 tests/testfile-dwp-5.bz2 create mode 100644 tests/testfile-dwp-5.dwp.bz2 create mode 100644 tests/testfile-dwp.source new file mode 100644 index 0000000000000000000000000000000000000000..8cc1bbe2a8042bd06c9119c276326371261afbe0 GIT binary patch literal 6871 zcmY*-dpHwp`2W^=H)&=<&CFp4A#EC)V{CHhb?UIS(qWE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Z#nkPWsKx2$$V4VPJO;+q^peNIFI=u zI+BQhIfnkK+0+bN|5-Yd^!lM)tycftBrCUmCDUbR+}VFS`5_w2I^dPcU(3unhA-6W zy*Lqy%2Zld8v^($j5Qtz42j*Jos4F`W^xvmYJGHll0h%nSK`M53}Cv?DE?I!8+#XO zzL?{X!MqVSFg7j%p@n>1-`vtLPWL@4B<@nDTR8Flb%j#^vnw~`tbj6!`{M6KYtyvNORh?>8?2c@7r*?3F+T1!s1ml2$I0h!es7&H|<; z>6qB1{%v!*lr`Ev8$`00TlME0xmp)KsoAB@G?z$*JZ0K}IX;_%Ku@zkconZ(&(#?&I z_cR7}URrktJqf=07p!m5|&74OER=v(DZgWMX{sg6YC{;JTP0K`n=y zV&|1?`cj@bVr2x@WVT>ynDZ1HBVL@1RLbG(wz)RV#$mq&vMwihowo)$Jz zpMW1w$NRiGYwTOxEFN^McPidvvOffe@!Rh42TXf4b{T}={S<^_Pk)Gng^m%AFM_8| zelO{Xa8`Np$kCX8oifbFtzv80*9o~+*?>Sl5?*Sg88*`r>DE0pVd&j+#r!es(}zo% zw9#gx`@G!-bH481m$nFhREB((zVh{L-ID2*K(X7dY~8!_du}f1OT3W|WqHKWkw%lYjXL6RrKM>VTFb9piVZ2d9mHf1 zlb9nu(_5O&fyfli>jDdJ)3~SI>syj%_GHR@_%J9PVIA{)wMbg&S&`0baY*A)u+wJ= u-EDD=rUKAknm=t6Mb4u-*IS@BqPEeT77ryQqhr5xClY*l=qKMdJ^u&wK)Buj literal 0 HcmV?d00001 new file mode 100644 index 0000000000000000000000000000000000000000..1a63b42d987cf1f64f8c994f8f16b7a5d0af029b GIT binary patch literal 10098 zcmV-&Cym%bT4*^jL0KkKSR)ZEp8x;_z5p@kJAeQezz;wGJ!bJl019pIyY20+yUkukUm870iXbA(V?IK4Lv{rG{`{+BT18LO;dYGl0p86qaf31G8`_G-y3Rqtp!=Jw|{44^Z@hq2z#QXnKGE z05s6h10ZRk>S*-<3`eK{(9i%jsR){B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)nxY7l>korClZV7S)IfW zvg10EByhc#3Z)qo*n7^=FbYp{wFq}gWSpQx34hAG@ItTl&@)m>McJh{f;C?X`{Gw* z@8Dw{mG`daaVBqx;hcKT`}C6~TMPHE%F88NBZFE6#8V28#(z2c`+t!}!e|a{zi!-S z{`S0=mz#5n;po;pa~uZJYLmEHFYvm!x4JmMdMcEaS%AoGdQ*C(N~xPChOB>rQ^vl^ z-B1ofn3`p~PS0b1ZPQ1Qx?lw;0MANOA2g?7H?RWW29^BpZEQNG`x9GW#EYzI(wQg) z60*=`+)Kq}1+K^y7^wmJX%B99?y+TS$g7v6Bf;G5R`2PSJoD2*A literal 0 HcmV?d00001 diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 52327688..1d229094 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -20,7 +20,14 @@ instead of dbg parameter, which is now unused. * libdwP.h (Dwarf_Macro_Op_Table): Replace is_64bit with address_size and offset_size. Add dbg. - Add IDX_debug_cu_index and IDX_debug_tu_index. + (Dwarf): Add cu_index and tu_index. + (Dwarf_CU): Add dwp_row. + (Dwarf_Package_Index): New type. + (DW_SECT_TYPES): New macro. + (__libdw_dwp_find_unit): New declaration. + (dwarf_cu_dwp_section_info): New INTDECL. + Add IDX_debug_cu_index and IDX_debug_tu_index. Add + DWARF_E_UNKNOWN_SECTION. * dwarf_begin_elf.c (dwarf_scnnames): Add IDX_debug_cu_index and IDX_debug_tu_index. (scn_to_string_section_idx): Ditto. @@ -28,6 +35,15 @@ .zdebug_cu_index, and .zdebug_tu_index. (check_section): Change .dwo suffix matching to account for .debug_cu_index and .debug_tu_index. + * Makefile.am (libdw_a_SOURCES): Add dwarf_cu_dwp_section_info.c. + * dwarf_end.c (dwarf_end): Free dwarf->cu_index and dwarf->tu_index. + * dwarf_error.c (errmsgs): Add DWARF_E_UNKNOWN_SECTION. + * libdw.h (dwarf_cu_dwp_section_info): New declaration. + * libdw.map (ELFUTILS_0.190): Add dwarf_cu_dwp_section_info. + * libdw_findcu.c (__libdw_intern_next_unit): Call + __libdw_dwp_find_unit, and use it to adjust abbrev_offset and assign + newp->dwp_row. + * dwarf_cu_dwp_section_info.c: New file. 2023-02-22 Mark Wielaard diff --git a/libdw/Makefile.am b/libdw/Makefile.am index e548f38c..5363c02a 100644 --- a/libdw/Makefile.am +++ b/libdw/Makefile.am @@ -93,7 +93,7 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \ dwarf_cu_die.c dwarf_peel_type.c dwarf_default_lower_bound.c \ dwarf_die_addr_die.c dwarf_get_units.c \ libdw_find_split_unit.c dwarf_cu_info.c \ - dwarf_next_lines.c + dwarf_next_lines.c dwarf_cu_dwp_section_info.c if MAINTAINER_MODE BUILT_SOURCES = $(srcdir)/known-dwarf.h diff --git a/libdw/dwarf_cu_dwp_section_info.c b/libdw/dwarf_cu_dwp_section_info.c new file mode 100644 index 00000000..6766fb9a --- /dev/null +++ b/libdw/dwarf_cu_dwp_section_info.c @@ -0,0 +1,371 @@ +/* Read DWARF package file index sections. + Copyright (c) Meta Platforms, Inc. and affiliates. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see . */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "libdwP.h" + +static Dwarf_Package_Index * +__libdw_read_package_index (Dwarf *dbg, bool tu) +{ + Elf_Data *data; + if (tu) + data = dbg->sectiondata[IDX_debug_tu_index]; + else + data = dbg->sectiondata[IDX_debug_cu_index]; + + /* We need at least 16 bytes for the header. */ + if (data == NULL || data->d_size < 16) + { + invalid: + __libdw_seterrno (DWARF_E_INVALID_DWARF); + return NULL; + } + + const unsigned char *datap = data->d_buf; + const unsigned char *endp = datap + data->d_size; + uint16_t version; + /* In GNU DebugFission for DWARF 4, the version is 2 as a uword. In the + standardized DWARF 5 format, it is a uhalf followed by a padding uhalf. + Check for both. */ + if (read_4ubyte_unaligned (dbg, datap) == 2) + version = 2; + else + { + version = read_2ubyte_unaligned (dbg, datap); + if (version != 5) + { + __libdw_seterrno (DWARF_E_VERSION); + return NULL; + } + } + datap += 4; + uint32_t section_count = read_4ubyte_unaligned_inc (dbg, datap); + uint32_t unit_count = read_4ubyte_unaligned_inc (dbg, datap); + uint32_t slot_count = read_4ubyte_unaligned_inc (dbg, datap); + + /* The specification has a stricter requirement that + slot_count > 3 * unit_count / 2, but this is enough for us. */ + if (slot_count < unit_count) + goto invalid; + + /* After the header, the section must contain: + + 8 byte signature per hash table slot + + 4 byte index per hash table slot + + Section offset table with 1 header row, 1 row per unit, 1 column per + section, 4 bytes per field + + Section size table with 1 row per unit, 1 column per section, 4 bytes + per field + + We have to be careful about overflow when checking this. */ + const unsigned char *hash_table = datap; + if ((size_t) (endp - hash_table) < (uint64_t) slot_count * 12) + goto invalid; + const unsigned char *indices = hash_table + (size_t) slot_count * 8; + const unsigned char *sections = indices + (size_t) slot_count * 4; + if ((size_t) (endp - sections) < (uint64_t) section_count * 4) + goto invalid; + const unsigned char *section_offsets = sections + (size_t) section_count * 4; + if ((uint64_t) unit_count * section_count > UINT64_MAX / 8 + || ((size_t) (endp - section_offsets) + < (uint64_t) unit_count * section_count * 8)) + goto invalid; + const unsigned char *section_sizes + = section_offsets + (uint64_t) unit_count * section_count * 4; + + Dwarf_Package_Index *index = malloc (sizeof (*index)); + if (index == NULL) + { + __libdw_seterrno (DWARF_E_NOMEM); + return NULL; + } + + index->dbg = dbg; + /* Set absent sections to UINT32_MAX. */ + memset (index->sections, 0xff, sizeof (index->sections)); + for (size_t i = 0; i < section_count; i++) + { + uint32_t section = read_4ubyte_unaligned (dbg, sections + i * 4); + /* 2 is DW_SECT_TYPES in version 2 and reserved in version 5. We ignore + it for version 5. + 5 is DW_SECT_LOC in version 2 and DW_SECT_LOCLISTS in version 5. We + use the same index for both. + 7 is DW_SECT_MACINFO in version 2 and DW_SECT_MACRO in version 5. We + use the same index for both. + 8 is DW_SECT_MACRO in version 2 and DW_SECT_RNGLISTS in version 5. We + use the same index for version 2's DW_SECT_MACRO as version 2's + DW_SECT_MACINFO/version 5's DW_SECT_MACRO. + We ignore unknown sections. */ + if (section == 0) + continue; + if (version == 2) + { + if (section > 8) + continue; + else if (section == 8) + section = DW_SECT_MACRO; + } + else if (section == 2 + || (section + > sizeof (index->sections) / sizeof (index->sections[0]))) + continue; + index->sections[section - 1] = i; + } + + /* DW_SECT_INFO (or DW_SECT_TYPES for DWARF 4 type units) and DW_SECT_ABBREV + are required. */ + if (((!tu || dbg->sectiondata[IDX_debug_types] == NULL) + && index->sections[DW_SECT_INFO - 1] == UINT32_MAX) + || (tu && dbg->sectiondata[IDX_debug_types] != NULL + && index->sections[DW_SECT_TYPES - 1] == UINT32_MAX) + || index->sections[DW_SECT_ABBREV - 1] == UINT32_MAX) + { + free (index); + __libdw_seterrno (DWARF_E_INVALID_DWARF); + return NULL; + } + + index->section_count = section_count; + index->unit_count = unit_count; + index->slot_count = slot_count; + index->last_unit_found = 0; + index->hash_table = hash_table; + index->indices = indices; + index->section_offsets = section_offsets; + index->section_sizes = section_sizes; + + return index; +} + +static Dwarf_Package_Index * +__libdw_package_index (Dwarf *dbg, bool tu) +{ + if (tu && dbg->tu_index != NULL) + return dbg->tu_index; + else if (!tu && dbg->cu_index != NULL) + return dbg->cu_index; + + Dwarf_Package_Index *index = __libdw_read_package_index (dbg, tu); + if (index == NULL) + return NULL; + + if (tu) + dbg->tu_index = index; + else + dbg->cu_index = index; + return index; +} + +static int +__libdw_dwp_unit_row (Dwarf_Package_Index *index, uint64_t unit_id, + uint32_t *unit_rowp) +{ + if (index == NULL) + return -1; + + uint32_t hash = unit_id; + uint32_t hash2 = (unit_id >> 32) | 1; + /* Only check each slot once. */ + for (uint32_t n = index->slot_count; n-- > 0; ) + { + size_t slot = hash & (index->slot_count - 1); + uint64_t sig = read_8ubyte_unaligned (index->dbg, + index->hash_table + slot * 8); + if (sig == unit_id) + { + uint32_t row = read_4ubyte_unaligned (index->dbg, + index->indices + slot * 4); + if (row > index->unit_count) + { + __libdw_seterrno (DWARF_E_INVALID_DWARF); + return -1; + } + *unit_rowp = row; + return 0; + } + else if (sig == 0 + && read_4ubyte_unaligned (index->dbg, + index->indices + slot * 4) == 0) + break; + hash += hash2; + } + *unit_rowp = 0; + return 0; +} + +static int +__libdw_dwp_section_info (Dwarf_Package_Index *index, uint32_t unit_row, + unsigned int section, Dwarf_Off *offsetp, + Dwarf_Off *sizep) +{ + if (index == NULL) + return -1; + if (unit_row == 0) + { + __libdw_seterrno (DWARF_E_INVALID_DWARF); + return -1; + } + if (index->sections[section - 1] == UINT32_MAX) + { + if (offsetp != NULL) + *offsetp = 0; + if (sizep != NULL) + *sizep = 0; + return 0; + } + size_t i = (size_t)(unit_row - 1) * index->section_count + + index->sections[section - 1]; + if (offsetp != NULL) + *offsetp = read_4ubyte_unaligned (index->dbg, + index->section_offsets + i * 4); + if (sizep != NULL) + *sizep = read_4ubyte_unaligned (index->dbg, + index->section_sizes + i * 4); + return 0; +} + +int +internal_function +__libdw_dwp_find_unit (Dwarf *dbg, bool debug_types, Dwarf_Off off, + uint16_t version, uint8_t unit_type, uint64_t unit_id8, + uint32_t *unit_rowp, Dwarf_Off *abbrev_offsetp) +{ + if (version >= 5 + && unit_type != DW_UT_split_compile && unit_type != DW_UT_split_type) + { + not_dwp: + *unit_rowp = 0; + *abbrev_offsetp = 0; + return 0; + } + bool tu = unit_type == DW_UT_split_type || debug_types; + if (dbg->sectiondata[tu ? IDX_debug_tu_index : IDX_debug_cu_index] == NULL) + goto not_dwp; + Dwarf_Package_Index *index = __libdw_package_index (dbg, tu); + if (index == NULL) + return -1; + + /* This is always called for ascending offsets. The most obvious way for a + producer to generate the section offset table is sorted by offset; both + GNU dwp and llvm-dwp do this. In this common case, we can avoid the full + lookup. */ + if (index->last_unit_found < index->unit_count) + { + Dwarf_Off offset, size; + if (__libdw_dwp_section_info (index, index->last_unit_found + 1, + debug_types ? DW_SECT_TYPES : DW_SECT_INFO, + &offset, &size) != 0) + return -1; + if (offset <= off && off - offset < size) + { + *unit_rowp = ++index->last_unit_found; + goto done; + } + else + /* The units are not sorted. Don't try again. */ + index->last_unit_found = index->unit_count; + } + + if (version >= 5 || debug_types) + { + /* In DWARF 5 and in type units, the unit signature is available in the + unit header. */ + if (__libdw_dwp_unit_row (index, unit_id8, unit_rowp) != 0) + return -1; + } + else + { + /* In DWARF 4 compilation units, the unit signature is an attribute. We + can't parse attributes in the split unit until we get the abbreviation + table offset from the package index, which is a chicken-and-egg + problem. We could get the signature from the skeleton unit, but that + may not be available. + + Instead, we resort to a linear scan through the section offset table. + Finding all units is therefore quadratic in the number of units. + However, this will likely never be needed in practice because of the + sorted fast path above. If this ceases to be the case, we can try to + plumb through the skeleton unit's signature when it is available, or + build a sorted lookup table for binary search. */ + if (index->sections[DW_SECT_INFO - 1] == UINT32_MAX) + { + __libdw_seterrno (DWARF_E_INVALID_DWARF); + return -1; + } + for (uint32_t i = 0; i < index->unit_count; i++) + { + Dwarf_Off offset, size; + __libdw_dwp_section_info (index, i + 1, DW_SECT_INFO, &offset, + &size); + if (offset <= off && off - offset < size) + { + *unit_rowp = i + 1; + goto done; + } + } + __libdw_seterrno (DWARF_E_INVALID_DWARF); + return -1; + } + + done: + return __libdw_dwp_section_info (index, *unit_rowp, DW_SECT_ABBREV, + abbrev_offsetp, NULL); +} + +int +dwarf_cu_dwp_section_info (Dwarf_CU *cu, unsigned int section, + Dwarf_Off *offsetp, Dwarf_Off *sizep) +{ + if (cu == NULL) + return -1; + if (section < DW_SECT_INFO || section > DW_SECT_RNGLISTS) + { + __libdw_seterrno (DWARF_E_UNKNOWN_SECTION); + return -1; + } + if (cu->dwp_row == 0) + { + if (offsetp != NULL) + *offsetp = 0; + if (sizep != NULL) + *sizep = 0; + return 0; + } + else + { + Dwarf_Package_Index *index + = cu->unit_type == DW_UT_split_compile + ? cu->dbg->cu_index : cu->dbg->tu_index; + return __libdw_dwp_section_info (index, cu->dwp_row, section, offsetp, + sizep); + } +} +INTDEF(dwarf_cu_dwp_section_info) diff --git a/libdw/dwarf_end.c b/libdw/dwarf_end.c index 8dd075cf..18a419ce 100644 --- a/libdw/dwarf_end.c +++ b/libdw/dwarf_end.c @@ -77,6 +77,9 @@ dwarf_end (Dwarf *dwarf) { if (dwarf != NULL) { + free (dwarf->tu_index); + free (dwarf->cu_index); + if (dwarf->cfi != NULL) /* Clean up the CFI cache. */ __libdw_destroy_frame_cache (dwarf->cfi); diff --git a/libdw/dwarf_error.c b/libdw/dwarf_error.c index 46ea16b3..0123cfa2 100644 --- a/libdw/dwarf_error.c +++ b/libdw/dwarf_error.c @@ -102,6 +102,7 @@ static const char *errmsgs[] = [DWARF_E_NOT_CUDIE] = N_("not a CU (unit) DIE"), [DWARF_E_UNKNOWN_LANGUAGE] = N_("unknown language code"), [DWARF_E_NO_DEBUG_ADDR] = N_(".debug_addr section missing"), + [DWARF_E_UNKNOWN_SECTION] = N_("unknown section"), }; #define nerrmsgs (sizeof (errmsgs) / sizeof (errmsgs[0])) diff --git a/libdw/libdw.h b/libdw/libdw.h index 64d1689a..545ad043 100644 --- a/libdw/libdw.h +++ b/libdw/libdw.h @@ -1081,6 +1081,29 @@ extern int dwarf_frame_register (Dwarf_Frame *frame, int regno, __nonnull_attribute__ (3, 4, 5); +/* Return offset and/or size of CU's contribution to SECTION in a DWARF package + file. + + If CU is not from a DWARF package file, the file does not have SECTION, or CU + does not contribute to SECTION, then *SIZEP is set to 0. + + SECTION is a DW_SECT section identifier. Note that the original GNU DWARF + package file extension for DWARF 4 used slightly different section + identifiers. This function uses the standardized section identifiers and + maps the GNU DWARF 4 identifiers to their standard DWARF 5 analogues: + DW_SECT_LOCLISTS (5) refers to .debug_locs.dwo for DWARF 4. + DW_SECT_MACRO (7) refers to .debug_macinfo.dwo for DWARF 4 or + .debug_macro.dwo for the GNU .debug_macro extension for DWARF 4 (section + identifier 8 is DW_SECT_RNGLISTS in DWARF 5, NOT DW_SECT_MACRO like in the + GNU extension.) + .debug_types.dwo does not have a DWARF 5 equivalent, so this function accepts + the original DW_SECT_TYPES (2). + + Returns 0 for success or -1 for errors. OFFSETP and SIZEP may be NULL. */ +extern int dwarf_cu_dwp_section_info (Dwarf_CU *cu, unsigned int section, + Dwarf_Off *offsetp, Dwarf_Off *sizep); + + /* Return error code of last failing function call. This value is kept separately for each thread. */ extern int dwarf_errno (void); diff --git a/libdw/libdw.map b/libdw/libdw.map index 5331ad45..2104b007 100644 --- a/libdw/libdw.map +++ b/libdw/libdw.map @@ -373,3 +373,8 @@ ELFUTILS_0.188 { dwfl_frame_reg; dwfl_report_offline_memory; } ELFUTILS_0.186; + +ELFUTILS_0.190 { + global: + dwarf_cu_dwp_section_info; +} ELFUTILS_0.188; diff --git a/libdw/libdwP.h b/libdw/libdwP.h index 0c44d40c..13ca58ce 100644 --- a/libdw/libdwP.h +++ b/libdw/libdwP.h @@ -147,6 +147,7 @@ enum DWARF_E_NOT_CUDIE, DWARF_E_UNKNOWN_LANGUAGE, DWARF_E_NO_DEBUG_ADDR, + DWARF_E_UNKNOWN_SECTION, }; @@ -227,6 +228,11 @@ struct Dwarf /* Cached info from the CFI section. */ struct Dwarf_CFI_s *cfi; + /* DWARF package file CU index section. */ + struct Dwarf_Package_Index_s *cu_index; + /* DWARF package file TU index section. */ + struct Dwarf_Package_Index_s *tu_index; + /* Fake loc CU. Used when synthesizing attributes for Dwarf_Ops that came from a location list entry in dwarf_getlocation_attr. Depending on version this is the .debug_loc or .debug_loclists @@ -339,6 +345,26 @@ struct Dwarf_Aranges_s } info[0]; }; +/* DWARF package file unit index. */ +typedef struct Dwarf_Package_Index_s +{ + Dwarf *dbg; + uint32_t section_count; + uint32_t unit_count; + uint32_t slot_count; + /* Mapping from DW_SECT_* - 1 to column number in the section tables, or + UINT32_MAX if not present. */ + uint32_t sections[DW_SECT_RNGLISTS]; + /* Row number of last unit found in the index. */ + uint32_t last_unit_found; + const unsigned char *hash_table; + const unsigned char *indices; + const unsigned char *section_offsets; + const unsigned char *section_sizes; +} Dwarf_Package_Index; + +/* Used in GNU DebugFission for DWARF 4. Reserved in DWARF 5. */ +#define DW_SECT_TYPES 2 /* CU representation. */ struct Dwarf_CU @@ -346,6 +372,8 @@ struct Dwarf_CU Dwarf *dbg; Dwarf_Off start; Dwarf_Off end; + /* Row number of this unit in DWARF package file index. */ + uint32_t dwp_row; uint8_t address_size; uint8_t offset_size; uint16_t version; @@ -680,6 +708,13 @@ extern struct Dwarf *__libdw_find_split_dbg_addr (Dwarf *dbg, void *addr) extern struct Dwarf_CU *__libdw_find_split_unit (Dwarf_CU *cu) internal_function; +/* Find a unit in a DWARF package file for __libdw_intern_next_unit. */ +extern int __libdw_dwp_find_unit (Dwarf *dbg, bool debug_types, Dwarf_Off off, + uint16_t version, uint8_t unit_type, + uint64_t unit_id8, uint32_t *unit_rowp, + Dwarf_Off *abbrev_offsetp) + __nonnull_attribute__ (1, 7, 8) internal_function; + /* Get abbreviation with given code. */ extern Dwarf_Abbrev *__libdw_findabbrev (struct Dwarf_CU *cu, unsigned int code) @@ -1380,6 +1415,7 @@ INTDECL (dwarf_attr_integrate) INTDECL (dwarf_begin) INTDECL (dwarf_begin_elf) INTDECL (dwarf_child) +INTDECL (dwarf_cu_dwp_section_info) INTDECL (dwarf_default_lower_bound) INTDECL (dwarf_dieoffset) INTDECL (dwarf_diename) diff --git a/libdw/libdw_findcu.c b/libdw/libdw_findcu.c index ed744231..6c7dcfb5 100644 --- a/libdw/libdw_findcu.c +++ b/libdw/libdw_findcu.c @@ -143,6 +143,13 @@ __libdw_intern_next_unit (Dwarf *dbg, bool debug_types) if (unlikely (*offsetp > data->d_size)) *offsetp = data->d_size; + uint32_t dwp_row; + Dwarf_Off dwp_abbrev_offset; + if (__libdw_dwp_find_unit (dbg, debug_types, oldoff, version, unit_type, + unit_id8, &dwp_row, &dwp_abbrev_offset) != 0) + return NULL; + abbrev_offset += dwp_abbrev_offset; + /* Create an entry for this CU. */ struct Dwarf_CU *newp = libdw_typed_alloc (dbg, struct Dwarf_CU); @@ -150,6 +157,7 @@ __libdw_intern_next_unit (Dwarf *dbg, bool debug_types) newp->sec_idx = sec_idx; newp->start = oldoff; newp->end = *offsetp; + newp->dwp_row = dwp_row; newp->address_size = address_size; newp->offset_size = offset_size; newp->version = version; diff --git a/tests/.gitignore b/tests/.gitignore index b9aa22ba..e9a61a2d 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -28,6 +28,7 @@ /backtrace-dwarf /buildid /core-dump-backtrace.lock +/cu-dwp-section-info /debugaltlink /debuginfod_build_id_find /debuglink diff --git a/tests/ChangeLog b/tests/ChangeLog index f934c114..687a9f32 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,6 +1,19 @@ 2023-09-27 Omar Sandoval * run-varlocs.sh: Add entry PC to split units. + * Makefile.am (check_PROGRAMS): Add cu-dwp-section-info. + (TESTS): Add run-cu-dwp-section-info.sh + (EXTRA_DIST): Add run-cu-dwp-section-info.sh and new test files. + (cu_dwp_section_info_LDADD): New variable. + * cu-dwp-section-info.c: New test. + * run-cu-dwp-section-info.sh: New test. + * testfile-dwp-4-strict.bz2: New test file. + * testfile-dwp-4-strict.dwp.bz2: New test file. + * testfile-dwp-4.bz2: New test file. + * testfile-dwp-4.dwp.bz2: New test file. + * testfile-dwp-5.bz2: New test file. + * testfile-dwp-5.dwp.bz2: New test file. + * testfile-dwp.source: New file. 2023-04-21 Frank Ch. Eigler diff --git a/tests/Makefile.am b/tests/Makefile.am index 32b18e6e..0938882b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -62,7 +62,7 @@ check_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \ dwelf_elf_e_machine_string \ getphdrnum leb128 read_unaligned \ msg_tst system-elf-libelf-test system-elf-gelf-test \ - nvidia_extended_linemap_libdw \ + nvidia_extended_linemap_libdw cu-dwp-section-info \ $(asm_TESTS) asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \ @@ -211,7 +211,7 @@ TESTS = run-arextract.sh run-arsymtest.sh run-ar.sh newfile test-nlist \ $(asm_TESTS) run-disasm-bpf.sh run-low_high_pc-dw-form-indirect.sh \ run-nvidia-extended-linemap-libdw.sh run-nvidia-extended-linemap-readelf.sh \ run-readelf-dw-form-indirect.sh run-strip-largealign.sh \ - run-readelf-Dd.sh + run-readelf-Dd.sh run-cu-dwp-section-info.sh if !BIARCH export ELFUTILS_DISABLE_BIARCH = 1 @@ -629,7 +629,11 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \ run-nvidia-extended-linemap-libdw.sh run-nvidia-extended-linemap-readelf.sh \ testfile_nvidia_linemap.bz2 \ testfile-largealign.o.bz2 run-strip-largealign.sh \ - run-funcretval++11.sh + run-funcretval++11.sh \ + testfile-dwp-4.bz2 testfile-dwp-4.dwp.bz2 \ + testfile-dwp-4-strict.bz2 testfile-dwp-4-strict.dwp.bz2 \ + testfile-dwp-5.bz2 testfile-dwp-5.dwp.bz2 testfile-dwp.source \ + run-cu-dwp-section-info.sh if USE_VALGRIND @@ -804,6 +808,7 @@ getphdrnum_LDADD = $(libelf) $(libdw) leb128_LDADD = $(libelf) $(libdw) read_unaligned_LDADD = $(libelf) $(libdw) nvidia_extended_linemap_libdw_LDADD = $(libelf) $(libdw) +cu_dwp_section_info_LDADD = $(libdw) # We want to test the libelf headers against the system elf.h header. # Don't include any -I CPPFLAGS. Except when we install our own elf.h. diff --git a/tests/cu-dwp-section-info.c b/tests/cu-dwp-section-info.c new file mode 100644 index 00000000..e92f35b6 --- /dev/null +++ b/tests/cu-dwp-section-info.c @@ -0,0 +1,74 @@ +/* Test program for dwarf_cu_dwp_section_info + Copyright (c) Meta Platforms, Inc. and affiliates. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifdef HAVE_CONFIG_H +# include +#endif +#include +#include +#include +#include +#include +#include + +#include +#include ELFUTILS_HEADER(dw) + +int +main (int argc, char *argv[]) +{ + for (int i = 1; i < argc; i++) + { + printf ("file: %s\n", argv[i]); + int fd = open (argv[i], O_RDONLY); + Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ); + if (dbg == NULL) + { + printf ("%s not usable: %s\n", argv[i], dwarf_errmsg (-1)); + return -1; + } + + Dwarf_CU *cu = NULL; + while (dwarf_get_units (dbg, cu, &cu, NULL, NULL, NULL, NULL) == 0) + { +#define SECTION_INFO(section) do { \ + printf (#section ": "); \ + Dwarf_Off offset, size; \ + if (dwarf_cu_dwp_section_info (cu, DW_SECT_##section, \ + &offset, &size) == 0) \ + printf ("0x%" PRIx64 " 0x%" PRIx64 "\n", offset, size); \ + else \ + printf ("%s\n", dwarf_errmsg (-1)); \ + } while (0) + SECTION_INFO (INFO); +#define DW_SECT_TYPES 2 + SECTION_INFO (TYPES); + SECTION_INFO (ABBREV); + SECTION_INFO (LINE); + SECTION_INFO (LOCLISTS); + SECTION_INFO (STR_OFFSETS); + SECTION_INFO (MACRO); + SECTION_INFO (RNGLISTS); + printf ("\n"); + } + + dwarf_end (dbg); + close (fd); + } + + return 0; +} diff --git a/tests/run-cu-dwp-section-info.sh b/tests/run-cu-dwp-section-info.sh new file mode 100755 index 00000000..f8596f2c --- /dev/null +++ b/tests/run-cu-dwp-section-info.sh @@ -0,0 +1,168 @@ +#! /bin/sh +# Copyright (c) Meta Platforms, Inc. and affiliates. +# This file is part of elfutils. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# elfutils is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. $srcdir/test-subr.sh + +# See testfile-dwp.source. +testfiles testfile-dwp-5.dwp testfile-dwp-4.dwp testfile-dwp-4-strict.dwp + +testrun_compare ${abs_builddir}/cu-dwp-section-info testfile-dwp-5.dwp << EOF +file: testfile-dwp-5.dwp +INFO: 0x0 0x70 +TYPES: 0x0 0x0 +ABBREV: 0x0 0x160 +LINE: 0x0 0x7f +LOCLISTS: 0x0 0xdb +STR_OFFSETS: 0x0 0x75c +MACRO: 0x0 0x6c6 +RNGLISTS: 0x0 0x22 + +INFO: 0x70 0x108 +TYPES: 0x0 0x0 +ABBREV: 0x0 0x160 +LINE: 0x0 0x7f +LOCLISTS: 0x0 0xdb +STR_OFFSETS: 0x0 0x75c +MACRO: 0x0 0x6c6 +RNGLISTS: 0x0 0x22 + +INFO: 0x178 0x6e +TYPES: 0x0 0x0 +ABBREV: 0x160 0xca +LINE: 0x7f 0x7f +LOCLISTS: 0x0 0x0 +STR_OFFSETS: 0x75c 0x758 +MACRO: 0x6c6 0x6c5 +RNGLISTS: 0x0 0x0 + +INFO: 0x1e6 0x78 +TYPES: 0x0 0x0 +ABBREV: 0x160 0xca +LINE: 0x7f 0x7f +LOCLISTS: 0x0 0x0 +STR_OFFSETS: 0x75c 0x758 +MACRO: 0x6c6 0x6c5 +RNGLISTS: 0x0 0x0 + +INFO: 0x25e 0x193 +TYPES: 0x0 0x0 +ABBREV: 0x22a 0x18a +LINE: 0xfe 0x81 +LOCLISTS: 0xdb 0xc9 +STR_OFFSETS: 0xeb4 0x77c +MACRO: 0xd8b 0x6c6 +RNGLISTS: 0x22 0x43 + +EOF + +testrun_compare ${abs_builddir}/cu-dwp-section-info testfile-dwp-4.dwp << EOF +file: testfile-dwp-4.dwp +INFO: 0x0 0x11e +TYPES: 0x0 0x0 +ABBREV: 0x0 0x172 +LINE: 0x0 0x52 +LOCLISTS: 0x0 0x11b +STR_OFFSETS: 0x0 0x754 +MACRO: 0x0 0x6c7 +RNGLISTS: 0x0 0x0 + +INFO: 0x11e 0x76 +TYPES: 0x0 0x0 +ABBREV: 0x172 0xd7 +LINE: 0x52 0x52 +LOCLISTS: 0x0 0x0 +STR_OFFSETS: 0x754 0x750 +MACRO: 0x6c7 0x6c6 +RNGLISTS: 0x0 0x0 + +INFO: 0x194 0x1c5 +TYPES: 0x0 0x0 +ABBREV: 0x249 0x19e +LINE: 0xa4 0x53 +LOCLISTS: 0x11b 0xf1 +STR_OFFSETS: 0xea4 0x774 +MACRO: 0xd8d 0x6c7 +RNGLISTS: 0x0 0x0 + +INFO: 0x0 0x0 +TYPES: 0x0 0x6f +ABBREV: 0x0 0x172 +LINE: 0x0 0x52 +LOCLISTS: 0x0 0x11b +STR_OFFSETS: 0x0 0x754 +MACRO: 0x0 0x6c7 +RNGLISTS: 0x0 0x0 + +INFO: 0x0 0x0 +TYPES: 0x6f 0x6d +ABBREV: 0x172 0xd7 +LINE: 0x52 0x52 +LOCLISTS: 0x0 0x0 +STR_OFFSETS: 0x754 0x750 +MACRO: 0x6c7 0x6c6 +RNGLISTS: 0x0 0x0 + +EOF + +testrun_compare ${abs_builddir}/cu-dwp-section-info testfile-dwp-4-strict.dwp << EOF +file: testfile-dwp-4-strict.dwp +INFO: 0x0 0x105 +TYPES: 0x0 0x0 +ABBREV: 0x0 0x15f +LINE: 0x0 0x52 +LOCLISTS: 0x0 0xe2 +STR_OFFSETS: 0x0 0x24 +MACRO: 0x0 0x38e4 +RNGLISTS: 0x0 0x0 + +INFO: 0x105 0x72 +TYPES: 0x0 0x0 +ABBREV: 0x15f 0xd3 +LINE: 0x52 0x52 +LOCLISTS: 0x0 0x0 +STR_OFFSETS: 0x24 0x20 +MACRO: 0x38e4 0x38db +RNGLISTS: 0x0 0x0 + +INFO: 0x177 0x17b +TYPES: 0x0 0x0 +ABBREV: 0x232 0x157 +LINE: 0xa4 0x53 +LOCLISTS: 0xe2 0xb1 +STR_OFFSETS: 0x44 0x44 +MACRO: 0x71bf 0x38f5 +RNGLISTS: 0x0 0x0 + +INFO: 0x0 0x0 +TYPES: 0x0 0x6e +ABBREV: 0x0 0x15f +LINE: 0x0 0x52 +LOCLISTS: 0x0 0xe2 +STR_OFFSETS: 0x0 0x24 +MACRO: 0x0 0x38e4 +RNGLISTS: 0x0 0x0 + +INFO: 0x0 0x0 +TYPES: 0x6e 0x6b +ABBREV: 0x15f 0xd3 +LINE: 0x52 0x52 +LOCLISTS: 0x0 0x0 +STR_OFFSETS: 0x24 0x20 +MACRO: 0x38e4 0x38db +RNGLISTS: 0x0 0x0 + +EOF diff --git a/tests/testfile-dwp-4-strict.bz2 b/tests/testfile-dwp-4-strict.bz2 new file mode 100755 index 0000000000000000000000000000000000000000..4f419c07d45aea608e02da002e8c09bc35b3553b GIT binary patch literal 4169 zcmV-P5Vr3^T4*^jL0KkKS?l7w2>=>zfB*mg|NsC0|NsC0|NsB*|Nrhk>Fs?-|9$`e zZp?pw@BQEpe)+iVPBzSvd3tYQL>mutsobk0dyaaM)74v6W)(>1wvOSE5Salc%6T+R zP3fki(wcftM$(>|A?VtX>Ux?P4K!({o~NYrPgBxuOw`e)jG8oJXafQPlQfMqG|&J6 zpbZ%f9*L)@0g?zb35ha#Xei04q3SgC223N=G-LxnXwU!yAkYA4000^Q0B8UJ0000D z02*i-WJ#u`kdxH(o~A=h4H`6I0NR=W&j%(Dc**85uMHJwO9M000000000OKuD1^K$wL* z(V}4{jF^+uY^L;6)bdYJnun+cjW$rx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0Sutwj|?DoMyhPPmRA4Q!2&!eX^hD;BDGo!e(itb!I@Oo zM(t+%cNMtw^nig)&j19J00|t)<5@3fjWL+bq6hODX}vkyMmPKt_Eg7a02G` zbE}0^PBz=A$#odV0^yAu26plhNISX@tS9-BUbZY~?M}d#5heOa+;J;>*#-hEieV9D zWkv%4mc1Igg3Kz^CI-o7e45FbY=qd?J9#>KV{d`I$*hAg8ssY|F)VY1s^tY{Ji>hX zyubl-h%1mti&H5Z>eExB4P!)Z+${`F$3H? zzzju#Ol*O`Lban^MH+`9t-PYUtCJPJ0i9k((cwvKc^Oen<%Ain$Q77pZ40?n5mm~l ztYjJ56HAUZ0-9IxStja}h^Zvg8nuZvbhsK$?I`UZZZs`1RHngNGP?UHkOyD5v3*yGZ{ zd6%OHAT^(U31^syy+TPT07`(8Oeq(qJKz>FE3QBg&m_Y&SQjZ0r6frtjN8H-?I?>_ z+bv2qVNDCijGsAD(L{&Z1Y>4U^oaAkoXtkx95sW5LC8tZWLeaKzoj?+>F%Ux8u&js_ zwNg_e*9>jtnZJv_SM-cU%jSjf3|cfKn#yV!$2PCTR=eW^2-Tr2cCnFrR^=#SrCa{@ zJ(CQJF}60_dkv*hoDQb@j%k_y`I#>_b+Wi3?WzV)AlK;%9gz{z{z?TbX9X*F!vUhMa^h%ALF2r`sMjSBvpqZ6a1L+x^Yfm7 zrKV2;HSn*cv}B;foF^;GY#Im+7DA0K<8Ev{le#H1H5gQ^NF-R=sIk1TFs^X7PMaN_ z{iiz2jxA2j$+Ky ZERO(); i--) + x *= x; + return x; +} + +int +Foo::foo () +{ + int x = a; + if (a > b) + x -= b; + return FROB (x_x (x)); +} + +# = bar.cc = + +#include "foobar.h" + +#define ONE 1 + +long +Bar::bar () +{ + if (a == b) + return ONE; + else + return a > b ? b : a; +} + +# = main.cc = + +#include "foobar.h" + +#define MAIN_ARGS int argc, char **argv + +int +main(MAIN_ARGS) +{ + struct Foo myfoo { argc, FROB (argc) }; + struct Bar mybar { fibonacci (argc), FRY (argc) }; + return myfoo.foo() + mybar.bar(); +} + +# Built with GCC at commit 80048aa13a6b ("debug/111409 - don't generate COMDAT +# macro sections for split DWARF"). +$ g++ -gdwarf-5 -gsplit-dwarf -fdebug-types-section -g3 -O2 foo.cc bar.cc main.cc -o testfile-dwp-5 +# GNU dwp as of binutils 2.41 only supports DWARF 4. +$ llvm-dwp -e testfile-dwp-5 -o testfile-dwp-5.dwp + +$ g++ -gdwarf-4 -gsplit-dwarf -fdebug-types-section -g3 -O2 foo.cc bar.cc main.cc -o testfile-dwp-4 +$ dwp -e testfile-dwp-4 + +$ g++ -gdwarf-4 -gstrict-dwarf -gsplit-dwarf -fdebug-types-section -g3 -O2 foo.cc bar.cc main.cc -o testfile-dwp-4-strict +$ dwp -e testfile-dwp-4-strict From patchwork Wed Sep 27 18:20:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 76802 X-Patchwork-Delegate: mark@klomp.org 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 3A8B43875DC4 for ; Wed, 27 Sep 2023 18:21:45 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 6F3FF3861898 for ; Wed, 27 Sep 2023 18:21:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6F3FF3861898 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=osandov.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=osandov.com Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-690bd59322dso9075501b3a.3 for ; Wed, 27 Sep 2023 11:21:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1695838882; x=1696443682; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=6t41owE3ehdRfZ1XH03TcDWEzjcoekeBdictG4J4qho=; b=JcfK7SHuxUW719UFnv24niZSX004V4H2JKlLui6K6Ij8MFDF7WLgHPvor3YCVRaRfw n7pKh5t3FRivtfgSvGNeymiG6nmJQZt0wYpvJav+zEFCTo02L5waHf+tZ3Yin6X42Y2L PlBPJO+DURfSUFjTmKu0cS7n8c0vHdGCQpLq0Qq4QRgfkMj2Q7zEkUNqiu2KreKJ4v/K IAtpkzZsDkMvUEk4lEgEiU1OPXws0DBOEQZSXeLD/1V9WcwTf7nHX6reflWoTdW5cHwk LnzAkv5gQYl7rIWapaG8do+sXZdGiJ3Lhb9wwtAEqSSvh3xqX2o2ltWK2F9s4yv+8MeZ khTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695838882; x=1696443682; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6t41owE3ehdRfZ1XH03TcDWEzjcoekeBdictG4J4qho=; b=TTXQxoQQcTz0YN1svmUCkDSp/YUtnYf5R0C+TC4Rtg7xAi9Jps+mG+N+muYFOM/2+G XVASb5r5gKMAiWRgsuJIOJnlUrvLOx1wTRg719HOU3wTddfdUEktJT4jzJAVgohuBP0C 6XNg6WfKQYgzDd4HPwZYOlhyfEt80R/Bntqex+Zoz+DP0lWQiHDICITT0iklqGq23FXx pIcjh164C5oO9XoLwhzekuhx1Q0WILD3iTqTqnVRWC3Rs3Dzlh8al6ITaILAyK7/vPgO NodJHjXPG/gGGlg+OG4X5od6wW/QSg1Sf5rW0iqqUgAOpBNV1ci1FZNODIobmY8nMruj jaBg== X-Gm-Message-State: AOJu0YyDlFm1vWyHYE7M9bXEoFdQGI8+182GHJP++w43CLxWKhp2miFa /jv83MV9scRq7Dj+AOkEyMh0DeKrLjiJxgmKwaj5Dg== X-Google-Smtp-Source: AGHT+IHucWZ+7syVXt7BMz6Ae6fP31jztSEJeUBhm6Fia8DCUBkWsmHXcMdoW2MYrzWAwTflXCqFbw== X-Received: by 2002:a05:6a20:1449:b0:14d:6309:fc96 with SMTP id a9-20020a056a20144900b0014d6309fc96mr3123029pzi.4.1695838882116; Wed, 27 Sep 2023 11:21:22 -0700 (PDT) Received: from telecaster.thefacebook.com ([2620:10d:c090:500::6:efab]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e81000b001bf6ea340a9sm13397842plg.159.2023.09.27.11.21.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:21:21 -0700 (PDT) From: Omar Sandoval To: elfutils-devel@sourceware.org Subject: [PATCH 09/14] libdw, libdwfl: Save original path of ELF file Date: Wed, 27 Sep 2023 11:20:58 -0700 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" From: Omar Sandoval libdw and libdwfl currently save the path of the directory containing the ELF file to use when searching for alt and dwo files. To search for dwp files, we need the file name too. Add an elfpath field to Dwarf, and set the debugdir field from it. Also update libdwfl to set elfpath and debugdir. Signed-off-by: Omar Sandoval --- libdw/ChangeLog | 11 ++++++++++- libdw/dwarf_begin_elf.c | 34 ++++++++++++++++++++-------------- libdw/dwarf_end.c | 3 ++- libdw/libdwP.h | 12 ++++++++++-- libdwfl/ChangeLog | 9 +++++++++ libdwfl/dwfl_module.c | 2 +- libdwfl/dwfl_module_getdwarf.c | 11 +++++++---- libdwfl/libdwflP.h | 2 +- libdwfl/offline.c | 4 ++-- 9 files changed, 62 insertions(+), 26 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 1d229094..f491587f 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -20,7 +20,7 @@ instead of dbg parameter, which is now unused. * libdwP.h (Dwarf_Macro_Op_Table): Replace is_64bit with address_size and offset_size. Add dbg. - (Dwarf): Add cu_index and tu_index. + (Dwarf): Add cu_index and tu_index. Add elfpath. (Dwarf_CU): Add dwp_row. (Dwarf_Package_Index): New type. (DW_SECT_TYPES): New macro. @@ -28,6 +28,9 @@ (dwarf_cu_dwp_section_info): New INTDECL. Add IDX_debug_cu_index and IDX_debug_tu_index. Add DWARF_E_UNKNOWN_SECTION. + (__libdw_debugdir): Replace declaration with... + (__libdw_elfpath): New declaration. + (__libdw_set_debugdir): New declaration. * dwarf_begin_elf.c (dwarf_scnnames): Add IDX_debug_cu_index and IDX_debug_tu_index. (scn_to_string_section_idx): Ditto. @@ -35,8 +38,14 @@ .zdebug_cu_index, and .zdebug_tu_index. (check_section): Change .dwo suffix matching to account for .debug_cu_index and .debug_tu_index. + (__libdw_debugdir): Replace with.. + (__libdw_elfpath): New function. + (__libdw_set_debugdir): New function. + (valid_p): Call __libdw_elfpath and __libdw_set_debugdir instead of + __libdw_debugdir. * Makefile.am (libdw_a_SOURCES): Add dwarf_cu_dwp_section_info.c. * dwarf_end.c (dwarf_end): Free dwarf->cu_index and dwarf->tu_index. + Free dwarf->elfpath. * dwarf_error.c (errmsgs): Add DWARF_E_UNKNOWN_SECTION. * libdw.h (dwarf_cu_dwp_section_info): New declaration. * libdw.map (ELFUTILS_0.190): Add dwarf_cu_dwp_section_info. diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c index 7936d343..323a91d0 100644 --- a/libdw/dwarf_begin_elf.c +++ b/libdw/dwarf_begin_elf.c @@ -272,24 +272,27 @@ check_section (Dwarf *result, size_t shstrndx, Elf_Scn *scn, bool inscngrp) return result; } - -/* Helper function to set debugdir field. We want to cache the dir - where we found this Dwarf ELF file to locate alt and dwo files. */ char * -__libdw_debugdir (int fd) +__libdw_elfpath (int fd) { /* strlen ("/proc/self/fd/") = 14 + strlen () = 10 + 1 = 25. */ char devfdpath[25]; sprintf (devfdpath, "/proc/self/fd/%u", fd); - char *fdpath = realpath (devfdpath, NULL); - char *fddir; - if (fdpath != NULL && fdpath[0] == '/' - && (fddir = strrchr (fdpath, '/')) != NULL) - { - *++fddir = '\0'; - return fdpath; - } - return NULL; + return realpath (devfdpath, NULL); +} + + +void +__libdw_set_debugdir (Dwarf *dbg) +{ + if (dbg->elfpath == NULL || dbg->elfpath[0] != '/') + return; + size_t dirlen = strrchr (dbg->elfpath, '/') - dbg->elfpath + 1; + dbg->debugdir = malloc (dirlen + 1); + if (dbg->debugdir == NULL) + return; + memcpy (dbg->debugdir, dbg->elfpath, dirlen); + dbg->debugdir[dirlen] = '\0'; } @@ -421,7 +424,10 @@ valid_p (Dwarf *result) } if (result != NULL) - result->debugdir = __libdw_debugdir (result->elf->fildes); + { + result->elfpath = __libdw_elfpath (result->elf->fildes); + __libdw_set_debugdir(result); + } return result; } diff --git a/libdw/dwarf_end.c b/libdw/dwarf_end.c index 18a419ce..b7f817d9 100644 --- a/libdw/dwarf_end.c +++ b/libdw/dwarf_end.c @@ -147,7 +147,8 @@ dwarf_end (Dwarf *dwarf) close (dwarf->alt_fd); } - /* The cached dir we found the Dwarf ELF file in. */ + /* The cached path and dir we found the Dwarf ELF file in. */ + free (dwarf->elfpath); free (dwarf->debugdir); /* Free the context descriptor. */ diff --git a/libdw/libdwP.h b/libdw/libdwP.h index 13ca58ce..214d1711 100644 --- a/libdw/libdwP.h +++ b/libdw/libdwP.h @@ -169,6 +169,10 @@ struct Dwarf /* The underlying ELF file. */ Elf *elf; + /* The (absolute) path to the ELF file, if known. To help locating + dwp files. */ + char *elfpath; + /* The (absolute) path to the ELF dir, if known. To help locating alt and dwo files. */ char *debugdir; @@ -1385,9 +1389,13 @@ __libdw_link_skel_split (Dwarf_CU *skel, Dwarf_CU *split) int __libdw_addrx (Dwarf_CU *cu, Dwarf_Word idx, Dwarf_Addr *addr); -/* Helper function to set debugdir field in Dwarf, used from dwarf_begin_elf +/* Helper function to set elfpath field in Dwarf, used from dwarf_begin_elf and libdwfl process_file. */ -char * __libdw_debugdir (int fd); +char * __libdw_elfpath (int fd); + +/* Helper function to set debugdir field in Dwarf after elfpath field has been + set. */ +void __libdw_set_debugdir (Dwarf *dbg); /* Given the directory of a debug file, an absolute or relative dir diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 54d85921..abbf0dfe 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,12 @@ +2023-09-27 Omar Sandoval + * dwfl_module.c (__libdwfl_module_free): Free mod->elfpath instead of + mod->elfdir. + * dwfl_module_getdwarf.c (load_dw): Set mod->dw->elfpath and call + __libdw_set_debugdir instead of setting mod->dw->debugdir. + * libdwflP.h (Dwfl_Module): Replace elfdir with elfpath. + * offline.c (process_elf): Call __libdw_elfpath and set mod->elfpath + instead of mod->elfdir. + 2023-04-24 John Gallagher * gzip.c: Fix memory leak in unzip() diff --git a/libdwfl/dwfl_module.c b/libdwfl/dwfl_module.c index 221d726d..c4d872d4 100644 --- a/libdwfl/dwfl_module.c +++ b/libdwfl/dwfl_module.c @@ -119,7 +119,7 @@ __libdwfl_module_free (Dwfl_Module *mod) free (mod->reloc_info); free (mod->name); - free (mod->elfdir); + free (mod->elfpath); free (mod); } diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c index 9ba499bb..6f98c02b 100644 --- a/libdwfl/dwfl_module_getdwarf.c +++ b/libdwfl/dwfl_module_getdwarf.c @@ -1362,11 +1362,14 @@ load_dw (Dwfl_Module *mod, struct dwfl_file *debugfile) } /* We might have already closed the fd when we asked dwarf_begin_elf to - create an Dwarf. Help out a little in case we need to find an alt or - dwo file later. */ - if (mod->dw->debugdir == NULL && mod->elfdir != NULL + create an Dwarf. Help out a little in case we need to find an alt, + dwo, or dwp file later. */ + if (mod->dw->elfpath == NULL && mod->elfpath != NULL && debugfile == &mod->main) - mod->dw->debugdir = strdup (mod->elfdir); + { + mod->dw->elfpath = strdup (mod->elfpath); + __libdw_set_debugdir (mod->dw); + } /* Until we have iterated through all CU's, we might do lazy lookups. */ mod->lazycu = 1; diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h index cdc528d0..b3dfea1d 100644 --- a/libdwfl/libdwflP.h +++ b/libdwfl/libdwflP.h @@ -186,7 +186,7 @@ struct Dwfl_Module Elf_Data *symxndxdata; /* Data in the extended section index table. */ Elf_Data *aux_symxndxdata; /* Data in the extended auxiliary table. */ - char *elfdir; /* The dir where we found the main Elf. */ + char *elfpath; /* The path where we found the main Elf. */ Dwarf *dw; /* libdw handle for its debugging info. */ Dwarf *alt; /* Dwarf used for dwarf_setalt, or NULL. */ diff --git a/libdwfl/offline.c b/libdwfl/offline.c index e090b42b..50abe8c3 100644 --- a/libdwfl/offline.c +++ b/libdwfl/offline.c @@ -151,9 +151,9 @@ process_elf (Dwfl *dwfl, const char *name, const char *file_name, int fd, /* Don't keep the file descriptor around. */ if (mod->main.fd != -1 && elf_cntl (mod->main.elf, ELF_C_FDREAD) == 0) { - /* Grab the dir path in case we want to report this file as + /* Grab the path in case we want to report this file as Dwarf later. */ - mod->elfdir = __libdw_debugdir (mod->main.fd); + mod->elfpath = __libdw_elfpath (mod->main.fd); close (mod->main.fd); mod->main.fd = -1; } From patchwork Wed Sep 27 18:20:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 76803 X-Patchwork-Delegate: mark@klomp.org 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 7EE7B387091C for ; Wed, 27 Sep 2023 18:21:46 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id 77A973861880 for ; Wed, 27 Sep 2023 18:21:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 77A973861880 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=osandov.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=osandov.com Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-690d2e13074so9368636b3a.1 for ; Wed, 27 Sep 2023 11:21:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1695838883; x=1696443683; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=QDj+7fKgIDoeX7AmIeZUj3SPpSLoBw7ThZP6RLcMhNU=; b=fP5o1veHcBaXg27+aQQZtDlosZxO0rMNRbCq3laurVj1+4h9rDMWAJEW9jqremkR8o uKaMQN6c1MP/lGymbkTz2r5+ErdmwEK/kTO1yERYZGcTEvd+RiInxs9QbOgxZpHWrV1I VI4JFZXSik5pN9fFam8lSkUw8XbJWev9m6u1sPXXeinGEkmKSswbJIUrImcIhaLk0cwY I7gMxyC5zqBxlTX1Ky0aBQZRZt1IuvMPR6x0Tks0fnYLWZrpgGASQD+a01pkSsH5OOzo kSWh4862XlFuI8/qYm2uSCTPIvJg9vt54EFrYYazYrDX3rEjQc6ntGe/LtoSsbYyk8df cDAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695838883; x=1696443683; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QDj+7fKgIDoeX7AmIeZUj3SPpSLoBw7ThZP6RLcMhNU=; b=eXjN9Jjq5dgHX6QFZt436qLnctqJuBMuYxO1j779PDh0yb0qpEk0fYImalwaU4089O ne1t9k4FGLYj7AfT70Xw61sHr0aMnOC5KVU+x9NIvEFe/ZRQfK8DrfxpsBqdyFp00F7r 9Lw9Hv94oniAzaRwo8/GOCCWqMTN4LoNQFoHEyJ87M20+b0vNP/JSv6o+El+pVKgNPro /Z5yA0ebIFKOFYWn6sXFe8Pp6gJO/HcHyJ6X1AnWUdWfAr9EM1GZB7ZdWZPjIUwCwC0j VwtWDzUli3ZKgcsiwtR5sV2bnXWRyuqCy6n/8wMCEZFimSx/Nab23Znsin5O2E37vnq3 ma5w== X-Gm-Message-State: AOJu0Yy/oCBGKWmRHxRkBDGM15A/koVEizZ01Fz5hSmcpru/yGDMaYjv VpDAN/VXOG0a71v69OZf8ton7BsMoVhDeIcxnydcgg== X-Google-Smtp-Source: AGHT+IHcKjDnHEW8YMS8AL+3hG/Xaanwa5zHnpJ0R7CJs+PBaFhLefUoqB2NHg+Q8fqy2YeIMff6Tg== X-Received: by 2002:a05:6a20:8e1c:b0:153:6413:1089 with SMTP id y28-20020a056a208e1c00b0015364131089mr2867832pzj.46.1695838883093; Wed, 27 Sep 2023 11:21:23 -0700 (PDT) Received: from telecaster.thefacebook.com ([2620:10d:c090:500::6:efab]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e81000b001bf6ea340a9sm13397842plg.159.2023.09.27.11.21.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:21:22 -0700 (PDT) From: Omar Sandoval To: elfutils-devel@sourceware.org Subject: [PATCH 10/14] libdw: Try .dwp file in __libdw_find_split_unit() Date: Wed, 27 Sep 2023 11:20:59 -0700 Message-ID: <45e13e025847b8fb84cd8acfe66cae87961993d4.1695837512.git.osandov@fb.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" From: Omar Sandoval Try opening the file in the location suggested by the standard (the skeleton file name + ".dwp") and looking up the unit in the package index. The rest is similar to .dwo files, with slightly different cleanup since a single Dwarf handle is shared. Signed-off-by: Omar Sandoval --- libdw/ChangeLog | 11 ++++- libdw/dwarf_begin_elf.c | 1 + libdw/dwarf_cu_dwp_section_info.c | 19 ++++++++ libdw/dwarf_end.c | 10 ++++- libdw/libdwP.h | 16 ++++++- libdw/libdw_find_split_unit.c | 75 ++++++++++++++++++++++++++++--- 6 files changed, 122 insertions(+), 10 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index f491587f..f37d9411 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,6 +1,8 @@ 2023-09-27 Omar Sandoval * libdw_find_split_unit.c (try_split_file): Make static. + (try_dwp_file): New function. + (__libdw_find_split_unit): Call try_dwp_file. * dwarf_entrypc.c (dwarf_entrypc): Call dwarf_lowpc. * dwarf_ranges.c (dwarf_ranges): Use skeleton ranges section for skeleton units. @@ -20,7 +22,8 @@ instead of dbg parameter, which is now unused. * libdwP.h (Dwarf_Macro_Op_Table): Replace is_64bit with address_size and offset_size. Add dbg. - (Dwarf): Add cu_index and tu_index. Add elfpath. + (Dwarf): Add cu_index and tu_index. Add elfpath. Add dwp_dwarf and + dwp_fd. (Dwarf_CU): Add dwp_row. (Dwarf_Package_Index): New type. (DW_SECT_TYPES): New macro. @@ -31,6 +34,8 @@ (__libdw_debugdir): Replace declaration with... (__libdw_elfpath): New declaration. (__libdw_set_debugdir): New declaration. + (__libdw_dwp_findcu_id): New declaration. + (__libdw_link_skel_split): Handle .debug_addr for dwp. * dwarf_begin_elf.c (dwarf_scnnames): Add IDX_debug_cu_index and IDX_debug_tu_index. (scn_to_string_section_idx): Ditto. @@ -43,9 +48,11 @@ (__libdw_set_debugdir): New function. (valid_p): Call __libdw_elfpath and __libdw_set_debugdir instead of __libdw_debugdir. + (dwarf_begin_elf): Initialize result->dwp_fd. * Makefile.am (libdw_a_SOURCES): Add dwarf_cu_dwp_section_info.c. * dwarf_end.c (dwarf_end): Free dwarf->cu_index and dwarf->tu_index. - Free dwarf->elfpath. + Free dwarf->elfpath. Free dwarf->dwp_dwarf and close dwarf->dwp_fd. + (cu_free): Don't free split dbg if it is dwp_dwarf. * dwarf_error.c (errmsgs): Add DWARF_E_UNKNOWN_SECTION. * libdw.h (dwarf_cu_dwp_section_info): New declaration. * libdw.map (ELFUTILS_0.190): Add dwarf_cu_dwp_section_info. diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c index 323a91d0..ca2b7e2a 100644 --- a/libdw/dwarf_begin_elf.c +++ b/libdw/dwarf_begin_elf.c @@ -567,6 +567,7 @@ dwarf_begin_elf (Elf *elf, Dwarf_Cmd cmd, Elf_Scn *scngrp) result->elf = elf; result->alt_fd = -1; + result->dwp_fd = -1; /* Initialize the memory handling. Initial blocks are allocated on first actual allocation. */ diff --git a/libdw/dwarf_cu_dwp_section_info.c b/libdw/dwarf_cu_dwp_section_info.c index 6766fb9a..7bf08d9d 100644 --- a/libdw/dwarf_cu_dwp_section_info.c +++ b/libdw/dwarf_cu_dwp_section_info.c @@ -340,6 +340,25 @@ __libdw_dwp_find_unit (Dwarf *dbg, bool debug_types, Dwarf_Off off, abbrev_offsetp, NULL); } +Dwarf_CU * +internal_function +__libdw_dwp_findcu_id (Dwarf *dbg, uint64_t unit_id8) +{ + Dwarf_Package_Index *index = __libdw_package_index (dbg, false); + uint32_t unit_row; + Dwarf_Off offset; + Dwarf_CU *cu; + if (__libdw_dwp_unit_row (index, unit_id8, &unit_row) == 0 + && __libdw_dwp_section_info (index, unit_row, DW_SECT_INFO, &offset, + NULL) == 0 + && (cu = __libdw_findcu (dbg, offset, false)) != NULL + && cu->unit_type == DW_UT_split_compile + && cu->unit_id8 == unit_id8) + return cu; + else + return NULL; +} + int dwarf_cu_dwp_section_info (Dwarf_CU *cu, unsigned int section, Dwarf_Off *offsetp, Dwarf_Off *sizep) diff --git a/libdw/dwarf_end.c b/libdw/dwarf_end.c index b7f817d9..78224ddb 100644 --- a/libdw/dwarf_end.c +++ b/libdw/dwarf_end.c @@ -66,7 +66,9 @@ cu_free (void *arg) /* The fake_addr_cu might be shared, only release one. */ if (p->dbg->fake_addr_cu == p->split->dbg->fake_addr_cu) p->split->dbg->fake_addr_cu = NULL; - INTUSE(dwarf_end) (p->split->dbg); + /* There is only one DWP file. We free it later. */ + if (p->split->dbg != p->dbg->dwp_dwarf) + INTUSE(dwarf_end) (p->split->dbg); } } } @@ -147,6 +149,12 @@ dwarf_end (Dwarf *dwarf) close (dwarf->alt_fd); } + if (dwarf->dwp_fd != -1) + { + INTUSE(dwarf_end) (dwarf->dwp_dwarf); + close (dwarf->dwp_fd); + } + /* The cached path and dir we found the Dwarf ELF file in. */ free (dwarf->elfpath); free (dwarf->debugdir); diff --git a/libdw/libdwP.h b/libdw/libdwP.h index 214d1711..16355274 100644 --- a/libdw/libdwP.h +++ b/libdw/libdwP.h @@ -180,6 +180,9 @@ struct Dwarf /* dwz alternate DWARF file. */ Dwarf *alt_dwarf; + /* DWARF package file. */ + Dwarf *dwp_dwarf; + /* The section data. */ Elf_Data *sectiondata[IDX_last]; @@ -197,6 +200,9 @@ struct Dwarf close this file descriptor. */ int alt_fd; + /* File descriptor of DWARF package file. */ + int dwp_fd; + /* Information for traversing the .debug_pubnames section. This is an array and separately allocated with malloc. */ struct pubnames_s @@ -719,6 +725,10 @@ extern int __libdw_dwp_find_unit (Dwarf *dbg, bool debug_types, Dwarf_Off off, Dwarf_Off *abbrev_offsetp) __nonnull_attribute__ (1, 7, 8) internal_function; +/* Find the compilation unit in a DWARF package file with the given id. */ +extern Dwarf_CU *__libdw_dwp_findcu_id (Dwarf *dbg, uint64_t unit_id8) + __nonnull_attribute__ (1) internal_function; + /* Get abbreviation with given code. */ extern Dwarf_Abbrev *__libdw_findabbrev (struct Dwarf_CU *cu, unsigned int code) @@ -1373,8 +1383,10 @@ __libdw_link_skel_split (Dwarf_CU *skel, Dwarf_CU *split) There is only one per split debug. */ Dwarf *dbg = skel->dbg; Dwarf *sdbg = split->dbg; - if (sdbg->sectiondata[IDX_debug_addr] == NULL - && dbg->sectiondata[IDX_debug_addr] != NULL) + if (dbg->sectiondata[IDX_debug_addr] != NULL + && (sdbg->sectiondata[IDX_debug_addr] == NULL + || (sdbg->sectiondata[IDX_debug_addr] + == dbg->sectiondata[IDX_debug_addr]))) { sdbg->sectiondata[IDX_debug_addr] = dbg->sectiondata[IDX_debug_addr]; diff --git a/libdw/libdw_find_split_unit.c b/libdw/libdw_find_split_unit.c index 533f8072..e1e78951 100644 --- a/libdw/libdw_find_split_unit.c +++ b/libdw/libdw_find_split_unit.c @@ -85,6 +85,67 @@ try_split_file (Dwarf_CU *cu, const char *dwo_path) } } +static void +try_dwp_file (Dwarf_CU *cu) +{ + if (cu->dbg->dwp_dwarf == NULL) + { + if (cu->dbg->elfpath != NULL) + { + /* The DWARF 5 standard says "the package file is typically placed in + the same directory as the application, and is given the same name + with a '.dwp' extension". */ + size_t elfpath_len = strlen (cu->dbg->elfpath); + char *dwp_path = malloc (elfpath_len + 5); + if (dwp_path == NULL) + { + __libdw_seterrno (DWARF_E_NOMEM); + return; + } + memcpy (dwp_path, cu->dbg->elfpath, elfpath_len); + strcpy (dwp_path + elfpath_len, ".dwp"); + int dwp_fd = open (dwp_path, O_RDONLY); + free (dwp_path); + if (dwp_fd != -1) + { + Dwarf *dwp_dwarf = dwarf_begin (dwp_fd, DWARF_C_READ); + /* There's no way to know whether we got the correct file until + we look up the unit, but it should at least be a dwp file. */ + if (dwp_dwarf != NULL + && (dwp_dwarf->sectiondata[IDX_debug_cu_index] != NULL + || dwp_dwarf->sectiondata[IDX_debug_tu_index] != NULL)) + { + cu->dbg->dwp_dwarf = dwp_dwarf; + cu->dbg->dwp_fd = dwp_fd; + } + else + close (dwp_fd); + } + } + if (cu->dbg->dwp_dwarf == NULL) + cu->dbg->dwp_dwarf = (Dwarf *) -1; + } + + if (cu->dbg->dwp_dwarf != (Dwarf *) -1) + { + Dwarf_CU *split = __libdw_dwp_findcu_id (cu->dbg->dwp_dwarf, + cu->unit_id8); + if (split != NULL) + { + if (tsearch (split->dbg, &cu->dbg->split_tree, + __libdw_finddbg_cb) == NULL) + { + /* Something went wrong. Don't link. */ + __libdw_seterrno (DWARF_E_NOMEM); + return; + } + + /* Link skeleton and split compile units. */ + __libdw_link_skel_split (cu, split); + } + } +} + Dwarf_CU * internal_function __libdw_find_split_unit (Dwarf_CU *cu) @@ -98,14 +159,18 @@ __libdw_find_split_unit (Dwarf_CU *cu) same id as the skeleton. */ if (cu->unit_type == DW_UT_skeleton) { + /* First, try the dwp file. */ + try_dwp_file (cu); + Dwarf_Die cudie = CUDIE (cu); Dwarf_Attribute dwo_name; - /* It is fine if dwo_dir doesn't exists, but then dwo_name needs - to be an absolute path. */ - if (dwarf_attr (&cudie, DW_AT_dwo_name, &dwo_name) != NULL - || dwarf_attr (&cudie, DW_AT_GNU_dwo_name, &dwo_name) != NULL) + /* Try a dwo file. It is fine if dwo_dir doesn't exist, but then + dwo_name needs to be an absolute path. */ + if (cu->split == (Dwarf_CU *) -1 + && (dwarf_attr (&cudie, DW_AT_dwo_name, &dwo_name) != NULL + || dwarf_attr (&cudie, DW_AT_GNU_dwo_name, &dwo_name) != NULL)) { - /* First try the dwo file name in the same directory + /* Try the dwo file name in the same directory as we found the skeleton file. */ const char *dwo_file = dwarf_formstring (&dwo_name); const char *debugdir = cu->dbg->debugdir; From patchwork Wed Sep 27 18:21:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 76805 X-Patchwork-Delegate: mark@klomp.org 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 8854F38618FA for ; Wed, 27 Sep 2023 18:21:53 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by sourceware.org (Postfix) with ESMTPS id 5BB0E3861924 for ; Wed, 27 Sep 2023 18:21:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5BB0E3861924 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=osandov.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=osandov.com Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-565334377d0so8877446a12.2 for ; Wed, 27 Sep 2023 11:21:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1695838884; x=1696443684; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=svna97BooNM0TrlBgCuvAMZE7fwV3kLSGGsLdbZv43c=; b=iYMW3uar/DezyWSjF3MZYtq3vWIICEoma1fteq+VSqpgWja1WgQE+E4iRT7nqwbq4B PVs8hOXXPBayk6aK0JHh1oPcHgPBi3TkC6fWxeDsvJriYK+LpakqwVSvzZqvKksveVOu Lm2CwMGIkDvE1WMyLQ/UB5BcHq3JtfqFX0gYf/FjG9G+RKzQ80xSnfbdQ1QEnfaJC0XI xcSwaCk8IfZn9XHf0+ml46SrhBucEr2TfN7PpZrzqXGD8s3Ca96MPn/u2CVSGn4eoSCA +3XI5Ht7KeWHhv48NtlA2m52F/XP3ZnMA31JYdC2/6wBFR9QAkDI3hASkWhBLpBEYw+i freg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695838884; x=1696443684; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=svna97BooNM0TrlBgCuvAMZE7fwV3kLSGGsLdbZv43c=; b=a03d9MldG5WutHiWfkwKDw7+/Xcopv8nPSR5k2ebhHd9VvCdZKHiPIuMBGJbimToh+ EaJPt1eJNcfmGnQC+OoBvm09I8UKtvo5f9Nu9JzeHr4L50eZZE9eYxJndz/ORqFfTIuS hy81qjuvuNan/hUXYzAXzPaVV4PkgwmmaE0FnEdMSDzKLU5DZSdZ1A5HjLRlPS6jaqoY 9HbxrLprvDISfJ953glZ6Y+eko/A8rjAr4SNiW8yYGomvuTAKcF9KBc43EjWspNHg02k sfv4bN/zC94ToiJW22sSUSLINlUpMXlrisN7TMH1qmYV1xWP+b/nxqxD5MKhUeXoc1uA SVbA== X-Gm-Message-State: AOJu0Ywu/5sX7kb4zH2zoIB7+s274QCKEvHSq57B5fqDaqOIBULbUmMX ixzMYkyJKHmWlJSHYOBG83a2h3ihHQo986rm/YwCTQ== X-Google-Smtp-Source: AGHT+IGa1TVjFEvdElk9lTek/tG3xHnK1Jr8zDC/oPn37dpqLpzLlKV8UsUdE3G1UwpzyI3n68dQZw== X-Received: by 2002:a05:6a21:6d9b:b0:160:6577:c527 with SMTP id wl27-20020a056a216d9b00b001606577c527mr3092377pzb.52.1695838884163; Wed, 27 Sep 2023 11:21:24 -0700 (PDT) Received: from telecaster.thefacebook.com ([2620:10d:c090:500::6:efab]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e81000b001bf6ea340a9sm13397842plg.159.2023.09.27.11.21.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:21:23 -0700 (PDT) From: Omar Sandoval To: elfutils-devel@sourceware.org Subject: [PATCH 11/14] tests: Handle DW_MACRO_{define, undef}_{strx, sup} in dwarf-getmacros Date: Wed, 27 Sep 2023 11:21:00 -0700 Message-ID: <6f2e2b50754f3fcd13657fdd33e3f2bed2c6cc0c.1695837512.git.osandov@fb.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" From: Omar Sandoval Signed-off-by: Omar Sandoval --- tests/ChangeLog | 3 +++ tests/dwarf-getmacros.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/tests/ChangeLog b/tests/ChangeLog index 687a9f32..4380c57f 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -14,6 +14,9 @@ * testfile-dwp-5.bz2: New test file. * testfile-dwp-5.dwp.bz2: New test file. * testfile-dwp.source: New file. + * dwarf-getmacros.c (mac): Add DW_MACRO_define_sup, + DW_MACRO_define_strx, DW_MACRO_undef_sup, and DW_MACRO_undef_strx + cases to opcode switch statement. 2023-04-21 Frank Ch. Eigler diff --git a/tests/dwarf-getmacros.c b/tests/dwarf-getmacros.c index ac70248d..e291bfd2 100644 --- a/tests/dwarf-getmacros.c +++ b/tests/dwarf-getmacros.c @@ -82,6 +82,8 @@ mac (Dwarf_Macro *macro, void *dbg) case DW_MACINFO_define: case DW_MACRO_define_strp: + case DW_MACRO_define_sup: + case DW_MACRO_define_strx: { const char *value; dwarf_macro_param2 (macro, NULL, &value); @@ -91,6 +93,8 @@ mac (Dwarf_Macro *macro, void *dbg) case DW_MACINFO_undef: case DW_MACRO_undef_strp: + case DW_MACRO_undef_sup: + case DW_MACRO_undef_strx: break; default: From patchwork Wed Sep 27 18:21:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 76806 X-Patchwork-Delegate: mark@klomp.org 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 296173861880 for ; Wed, 27 Sep 2023 18:22:00 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 73DBB38618E6 for ; Wed, 27 Sep 2023 18:21:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 73DBB38618E6 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=osandov.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=osandov.com Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1c724577e1fso20378065ad.0 for ; Wed, 27 Sep 2023 11:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1695838885; x=1696443685; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=tNVaoiTfMTlfvfw0+Bv+mAffDc8ivRA7di/gxNq8Ymo=; b=tn+0lL0wUXQr1rJbB3ej6/X7urwW8u/aWbtbDGUSu5rHMJJptyCHZywbppjbhxgF4D THX4EjBlaoLGpCQhlj9ugd2wEn5lNMbAPEWC2J8z8AZTW9iySnlzC94ym/6SCM0Ye/fA LrJJv1eqRld+Uin2ukZBcRTvPPvyCBaQ44nJ4BxWP/yJy5vDYX8k0sNYpaPH3Vh8NJi6 xsRgPp4OjlgIT+tuy3XxciuVOQ8bunRwhf1fMtfT4kNddV36cb+OCsi1b1ATT6YOu9yC XygwjFYzUIQpH1NuzpXZj21QRSRmfiYxE1p3MDRgj7j5rZg6DYY1S5yHm6bChIbYu5+Y 4rpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695838885; x=1696443685; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tNVaoiTfMTlfvfw0+Bv+mAffDc8ivRA7di/gxNq8Ymo=; b=vabF8IkTfdomiJJbxcrsIGexPpfj4H80whUSAMBI7eRl3jYfOjli6cKjvNwa4Myy8f Iy3X2bW2AXntiz9SzYlZrwSfHVaZE1XhSzAS+0hJAs4fEvCJdFi3V0IVddY4CbuKTDKN Et6g/iiiefClySaeh6/lXNyZLRkebftn33cKmWcJhkWXE8FWMkmKSFOfjIVWZRvRhGg4 z7zSY3L44SJ4icW91Fcso9My6wO5Ucep72k6XeXXa3Yqu8Rfp5EThP03djclAFudcpu5 kraJ+bP9t4MRKutJcmPnFii9te85n/cffeAd2nr9Lbd/Hw8pKTTCJdMDd6IyeMlbkTcg cYZQ== X-Gm-Message-State: AOJu0YzX+1WGeA7d90ZknjuDsC3oPwsXkgytkhXdrt1x+qeuRuI+1qn2 +whLn4jNSh9HVU557tHIG5P+ONG5nfQKjFgdqE8XRg== X-Google-Smtp-Source: AGHT+IE6o8aj97ExgLSmOXoDIktSZ5cEbZ7TD0cQ5kZl6xsVNMrOFfY9cYum5v9cT0z2w9qUSvgnRw== X-Received: by 2002:a17:902:f541:b0:1bc:2abb:4e98 with SMTP id h1-20020a170902f54100b001bc2abb4e98mr2855600plf.21.1695838885095; Wed, 27 Sep 2023 11:21:25 -0700 (PDT) Received: from telecaster.thefacebook.com ([2620:10d:c090:500::6:efab]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e81000b001bf6ea340a9sm13397842plg.159.2023.09.27.11.21.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:21:24 -0700 (PDT) From: Omar Sandoval To: elfutils-devel@sourceware.org Subject: [PATCH 12/14] tests: Optionally dump all units in dwarf-getmacros Date: Wed, 27 Sep 2023 11:21:01 -0700 Message-ID: <4453f4ff42a3234e60438733bcf1147451b7c2a7.1695837512.git.osandov@fb.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" From: Omar Sandoval If instead of a CU offset an empty string is given as the second argument, dump all units. Signed-off-by: Omar Sandoval --- tests/ChangeLog | 3 +++ tests/dwarf-getmacros.c | 51 +++++++++++++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/tests/ChangeLog b/tests/ChangeLog index 4380c57f..97261444 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -17,6 +17,9 @@ * dwarf-getmacros.c (mac): Add DW_MACRO_define_sup, DW_MACRO_define_strx, DW_MACRO_undef_sup, and DW_MACRO_undef_strx cases to opcode switch statement. + (getmacros): New function. + (main): If second argument is empty, call getmacros on every unit. + Otherwise, call getmacros on given unit. 2023-04-21 Frank Ch. Eigler diff --git a/tests/dwarf-getmacros.c b/tests/dwarf-getmacros.c index e291bfd2..8381d42c 100644 --- a/tests/dwarf-getmacros.c +++ b/tests/dwarf-getmacros.c @@ -121,26 +121,57 @@ include (Dwarf *dbg, Dwarf_Off macoff, ptrdiff_t token) } } +static void +getmacros (Dwarf *dbg, Dwarf_Die *die, bool new_style) +{ + for (ptrdiff_t off = new_style ? DWARF_GETMACROS_START : 0; + (off = dwarf_getmacros (die, mac, dbg, off)); ) + if (off == -1) + { + puts (dwarf_errmsg (-1)); + break; + } +} + int main (int argc, char *argv[]) { assert (argc >= 3); const char *name = argv[1]; - ptrdiff_t cuoff = strtol (argv[2], NULL, 0); bool new_style = argc > 3; int fd = open (name, O_RDONLY); Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ); - Dwarf_Die cudie_mem, *cudie = dwarf_offdie (dbg, cuoff, &cudie_mem); - - for (ptrdiff_t off = new_style ? DWARF_GETMACROS_START : 0; - (off = dwarf_getmacros (cudie, mac, dbg, off)); ) - if (off == -1) - { - puts (dwarf_errmsg (dwarf_errno ())); - break; - } + if (argv[2][0] == '\0') + { + Dwarf_CU *cu = NULL; + Dwarf_Die cudie, subdie; + uint8_t unit_type; + while (dwarf_get_units (dbg, cu, &cu, NULL, + &unit_type, &cudie, &subdie) == 0) + { + Dwarf_Die *die = (unit_type == DW_UT_skeleton + ? &subdie : &cudie); + if (! dwarf_hasattr (die, DW_AT_macro_info) + && ! dwarf_hasattr (die, DW_AT_GNU_macros) + && ! dwarf_hasattr (die, DW_AT_macros)) + continue; + printf ("CU %s\n", dwarf_diename (die)); + getmacros (dbg, die, new_style); + } + } + else + { + ptrdiff_t cuoff = strtol (argv[2], NULL, 0); + Dwarf_Die cudie_mem, *cudie = dwarf_offdie (dbg, cuoff, &cudie_mem); + if (cudie == NULL) + { + puts (dwarf_errmsg (-1)); + return 1; + } + getmacros (dbg, cudie, new_style); + } dwarf_end (dbg); From patchwork Wed Sep 27 18:21:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 76808 X-Patchwork-Delegate: mark@klomp.org 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 E33FA388201B for ; Wed, 27 Sep 2023 18:23:05 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by sourceware.org (Postfix) with ESMTPS id 33D243861932 for ; Wed, 27 Sep 2023 18:21:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 33D243861932 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=osandov.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=osandov.com Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1c451541f23so93958545ad.2 for ; Wed, 27 Sep 2023 11:21:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1695838887; x=1696443687; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=MohH85L3jzUF62wAV9Y7wMKz39vqDrd8KNbOkhZiQeA=; b=ZDuBDqMYBPeGdJxYcPv3waRHQEvjBpKxQOBXhoHzyMeH4Eu5+shZw1CwQzMJn3gX2X tbVBJ9OhCHegxIY1rpDON1K7KIYP8bSzOqA22BOkkguT1XXCHiwb5qX1bCb7IAsd+Av6 DlLR4UgeiKbjSpZGs4XYqkuVH6wcsAOqZpZnM695/v021S5yXoIwwJ/gH5CTfwcUElAg 6SKCXGbXgIZC3bYK3OgY8LMde8TVu9vQyg9nCdGDepxMKWg0Wg83UqaQGNsIRPJWaEsH YK65WrAKqZr+QOTtuatdoI3KDNib77Yr0Fx+ZW558NZG2NrItzY0hNDpoOm5aT1GqrMa 4XpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695838887; x=1696443687; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MohH85L3jzUF62wAV9Y7wMKz39vqDrd8KNbOkhZiQeA=; b=DhtT4MJHc65Np09+Hwosnj4S9kkpT/s2nD/33Z0eul9WTWZ7/dp7hRdkc7yQ1bhjj0 J/3y0yThfRodCaPihTEABuwBAn17zSimmQ5+ta1ex0JuBJbCU09SHNyXbvBYLZ+NN5ww qeLzqL+QIL7KpwUkjur9UMIFgcIK2kywt/C2Ba2gU8YTcDHUky2e8TchsJ56MJgPgTX4 +jIIJGa91F5nU++mT7JXAhd7u/2ts1WI+AugzV2mTjlyz1k94UM5DRMYbyzWMRGME09T yL3wneZcmHhesB3GdW/Tc/zDRPYDzdIUBQ8Xn7PqT/n16e9ZpRjG9nRV/tPiPBixY7es Eslg== X-Gm-Message-State: AOJu0Yzm32BGAyDacB7O/iR0rlOUrk1sh7WEmtagi4O4exF9981MAkdt P6xAWQmGTvpO8g2HSQ7dYSEP2TSMJyyZaYuy8jDvdg== X-Google-Smtp-Source: AGHT+IGR0kZ1lwFKwZuYOPb6ggXgfHxXUhFT6BCdyLTU9tqUEvMe17bc8IiyWGm0vucRZFMvdzy3kg== X-Received: by 2002:a17:902:d3cd:b0:1bb:b74c:88f6 with SMTP id w13-20020a170902d3cd00b001bbb74c88f6mr2566226plb.16.1695838886237; Wed, 27 Sep 2023 11:21:26 -0700 (PDT) Received: from telecaster.thefacebook.com ([2620:10d:c090:500::6:efab]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e81000b001bf6ea340a9sm13397842plg.159.2023.09.27.11.21.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:21:25 -0700 (PDT) From: Omar Sandoval To: elfutils-devel@sourceware.org Subject: [PATCH 13/14] libdw: Apply DWARF package file section offsets where appropriate Date: Wed, 27 Sep 2023 11:21:02 -0700 Message-ID: <94e0e37fe161b66bab98aca80d5d8566badb44e7.1695837512.git.osandov@fb.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_LOTSOFHASH, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" From: Omar Sandoval The final piece of DWARF package file support is that offsets have to be interpreted relative to the section offset from the package index. .debug_abbrev.dwo is already covered, so sprinkle around calls to dwarf_cu_dwp_section_info for the remaining sections: .debug_line.dwo, .debug_loclists.dwo/.debug_loc.dwo, .debug_str_offsets.dwo, .debug_macro.dwo/.debug_macinfo.dwo, and .debug_rnglists.dwo. With all of that in place, we can finally test various libdw functions on dwp files. Signed-off-by: Omar Sandoval --- libdw/ChangeLog | 10 +- libdw/dwarf_getlocation.c | 6 + libdw/dwarf_getmacros.c | 26 +- libdw/libdwP.h | 38 +- tests/ChangeLog | 8 +- tests/run-all-dwarf-ranges.sh | 114 +++ tests/run-dwarf-getmacros.sh | 1412 +++++++++++++++++++++++++++++++++ tests/run-get-units-split.sh | 18 + tests/run-varlocs.sh | 112 +++ 9 files changed, 1726 insertions(+), 18 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index f37d9411..08b2c3e6 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -12,10 +12,13 @@ * dwarf_getmacros.c (get_macinfo_table): Replace assignment of table->is_64bit with assignments of table->address_size and table->offset_size. Assume default DW_AT_stmt_list of 0 for split - DWARF. Set table->dbg. + DWARF. Set table->dbg. Call dwarf_cu_dwp_section_info and add offset + to line_offset. (get_table_for_offset): Ditto. (read_macros): Get fake CU offset_size from table->offset_size instead of table->is_64bit. + (get_offset_from): Call dwarf_cu_dwp_section_info and add offset to + *retp. * dwarf_macro_getsrcfiles.c (dwarf_macro_getsrcfiles): Get address_size for __libdw_getsrclines from table->address_size instead of table->is_64bit. Get dbg for __libdw_getsrclines from table->dbg @@ -36,6 +39,9 @@ (__libdw_set_debugdir): New declaration. (__libdw_dwp_findcu_id): New declaration. (__libdw_link_skel_split): Handle .debug_addr for dwp. + (str_offsets_base_off): Call dwarf_cu_dwp_section_info and add offset. + (__libdw_cu_ranges_base): Ditto. + (__libdw_cu_locs_base): Ditto. * dwarf_begin_elf.c (dwarf_scnnames): Add IDX_debug_cu_index and IDX_debug_tu_index. (scn_to_string_section_idx): Ditto. @@ -60,6 +66,8 @@ __libdw_dwp_find_unit, and use it to adjust abbrev_offset and assign newp->dwp_row. * dwarf_cu_dwp_section_info.c: New file. + * dwarf_getlocation.c (initial_offset): Call dwarf_cu_dwp_section_info + and add offset to start_offset. 2023-02-22 Mark Wielaard diff --git a/libdw/dwarf_getlocation.c b/libdw/dwarf_getlocation.c index 553fdc98..37b32fc1 100644 --- a/libdw/dwarf_getlocation.c +++ b/libdw/dwarf_getlocation.c @@ -812,6 +812,12 @@ initial_offset (Dwarf_Attribute *attr, ptrdiff_t *offset) : DWARF_E_NO_DEBUG_LOCLISTS), NULL, &start_offset) == NULL) return -1; + + Dwarf_Off loc_off; + if (INTUSE(dwarf_cu_dwp_section_info) (attr->cu, DW_SECT_LOCLISTS, + &loc_off, NULL) != 0) + return -1; + start_offset += loc_off; } *offset = start_offset; diff --git a/libdw/dwarf_getmacros.c b/libdw/dwarf_getmacros.c index a3a78884..2667eb45 100644 --- a/libdw/dwarf_getmacros.c +++ b/libdw/dwarf_getmacros.c @@ -47,7 +47,15 @@ get_offset_from (Dwarf_Die *die, int name, Dwarf_Word *retp) return -1; /* Offset into the corresponding section. */ - return INTUSE(dwarf_formudata) (&attr, retp); + if (INTUSE(dwarf_formudata) (&attr, retp) != 0) + return -1; + + Dwarf_Off offset; + if (INTUSE(dwarf_cu_dwp_section_info) (die->cu, DW_SECT_MACRO, &offset, NULL) + != 0) + return -1; + *retp += offset; + return 0; } static int @@ -131,6 +139,14 @@ get_macinfo_table (Dwarf *dbg, Dwarf_Word macoff, Dwarf_Die *cudie) else if (cudie->cu->unit_type == DW_UT_split_compile && dbg->sectiondata[IDX_debug_line] != NULL) line_offset = 0; + if (line_offset != (Dwarf_Off) -1) + { + Dwarf_Off dwp_offset; + if (INTUSE(dwarf_cu_dwp_section_info) (cudie->cu, DW_SECT_LINE, + &dwp_offset, NULL) != 0) + return NULL; + line_offset += dwp_offset; + } Dwarf_Macro_Op_Table *table = libdw_alloc (dbg, Dwarf_Macro_Op_Table, macinfo_data_size, 1); @@ -188,6 +204,14 @@ get_table_for_offset (Dwarf *dbg, Dwarf_Word macoff, if (unlikely (INTUSE(dwarf_formudata) (attr, &line_offset) != 0)) return NULL; } + if (line_offset != (Dwarf_Off) -1 && cudie != NULL) + { + Dwarf_Off dwp_offset; + if (INTUSE(dwarf_cu_dwp_section_info) (cudie->cu, DW_SECT_LINE, + &dwp_offset, NULL) != 0) + return NULL; + line_offset += dwp_offset; + } uint8_t address_size; if (cudie != NULL) diff --git a/libdw/libdwP.h b/libdw/libdwP.h index 16355274..bdbf5e5a 100644 --- a/libdw/libdwP.h +++ b/libdw/libdwP.h @@ -1111,25 +1111,27 @@ str_offsets_base_off (Dwarf *dbg, Dwarf_CU *cu) cu = first_cu; } + Dwarf_Off off = 0; if (cu != NULL) { if (cu->str_off_base == (Dwarf_Off) -1) { + dwarf_cu_dwp_section_info (cu, DW_SECT_STR_OFFSETS, &off, NULL); Dwarf_Die cu_die = CUDIE(cu); Dwarf_Attribute attr; if (dwarf_attr (&cu_die, DW_AT_str_offsets_base, &attr) != NULL) { - Dwarf_Word off; - if (dwarf_formudata (&attr, &off) == 0) + Dwarf_Word base; + if (dwarf_formudata (&attr, &base) == 0) { - cu->str_off_base = off; + cu->str_off_base = off + base; return cu->str_off_base; } } /* For older DWARF simply assume zero (no header). */ if (cu->version < 5) { - cu->str_off_base = 0; + cu->str_off_base = off; return cu->str_off_base; } @@ -1142,7 +1144,6 @@ str_offsets_base_off (Dwarf *dbg, Dwarf_CU *cu) /* No str_offsets_base attribute, we have to assume "zero". But there could be a header first. */ - Dwarf_Off off = 0; if (dbg == NULL) goto no_header; @@ -1184,7 +1185,7 @@ str_offsets_base_off (Dwarf *dbg, Dwarf_CU *cu) /* padding */ read_2ubyte_unaligned_inc (dbg, readp); - off = (Dwarf_Off) (readp - start); + off += (Dwarf_Off) (readp - start); no_header: if (cu != NULL) @@ -1222,18 +1223,22 @@ __libdw_cu_ranges_base (Dwarf_CU *cu) } else { + Dwarf_Off dwp_offset = 0; + dwarf_cu_dwp_section_info (cu, DW_SECT_RNGLISTS, &dwp_offset, NULL); + offset = dwp_offset; + if (dwarf_attr (&cu_die, DW_AT_rnglists_base, &attr) != NULL) { Dwarf_Word off; if (dwarf_formudata (&attr, &off) == 0) - offset = off; + offset += off; } /* There wasn't an rnglists_base, if the Dwarf does have a .debug_rnglists section, then it might be we need the base after the first header. */ Elf_Data *data = cu->dbg->sectiondata[IDX_debug_rnglists]; - if (offset == 0 && data != NULL) + if (offset == dwp_offset && data != NULL) { Dwarf *dbg = cu->dbg; const unsigned char *readp = data->d_buf; @@ -1279,8 +1284,8 @@ __libdw_cu_ranges_base (Dwarf_CU *cu) if (unit_length - 8 < needed) goto no_header; - offset = (Dwarf_Off) (offset_array_start - - (unsigned char *) data->d_buf); + offset += (Dwarf_Off) (offset_array_start + - (unsigned char *) data->d_buf); } } no_header: @@ -1297,21 +1302,24 @@ __libdw_cu_locs_base (Dwarf_CU *cu) { if (cu->locs_base == (Dwarf_Off) -1) { - Dwarf_Off offset = 0; + Dwarf_Off dwp_offset = 0; + dwarf_cu_dwp_section_info (cu, DW_SECT_LOCLISTS, &dwp_offset, NULL); + Dwarf_Off offset = dwp_offset; + Dwarf_Die cu_die = CUDIE(cu); Dwarf_Attribute attr; if (dwarf_attr (&cu_die, DW_AT_loclists_base, &attr) != NULL) { Dwarf_Word off; if (dwarf_formudata (&attr, &off) == 0) - offset = off; + offset += off; } /* There wasn't an loclists_base, if the Dwarf does have a .debug_loclists section, then it might be we need the base after the first header. */ Elf_Data *data = cu->dbg->sectiondata[IDX_debug_loclists]; - if (offset == 0 && data != NULL) + if (offset == dwp_offset && data != NULL) { Dwarf *dbg = cu->dbg; const unsigned char *readp = data->d_buf; @@ -1357,8 +1365,8 @@ __libdw_cu_locs_base (Dwarf_CU *cu) if (unit_length - 8 < needed) goto no_header; - offset = (Dwarf_Off) (offset_array_start - - (unsigned char *) data->d_buf); + offset += (Dwarf_Off) (offset_array_start + - (unsigned char *) data->d_buf); } no_header: diff --git a/tests/ChangeLog b/tests/ChangeLog index 97261444..93503f57 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,6 +1,7 @@ 2023-09-27 Omar Sandoval - * run-varlocs.sh: Add entry PC to split units. + * run-varlocs.sh: Add entry PC to split units. Check testfile-dwp-5 + and testfile-dwp-4. * Makefile.am (check_PROGRAMS): Add cu-dwp-section-info. (TESTS): Add run-cu-dwp-section-info.sh (EXTRA_DIST): Add run-cu-dwp-section-info.sh and new test files. @@ -20,6 +21,11 @@ (getmacros): New function. (main): If second argument is empty, call getmacros on every unit. Otherwise, call getmacros on given unit. + * run-all-dwarf-ranges.sh: Check testfile-dwp-5 and testfile-dwp-4. + * run-dwarf-getmacros.sh: Check testfile-dwp-5 and + testfile-dwp-4-strict. + * run-get-units-split.sh: Check testfile-dwp-5, testfile-dwp-4, and + testfile-dwp-4-strict. 2023-04-21 Frank Ch. Eigler diff --git a/tests/run-all-dwarf-ranges.sh b/tests/run-all-dwarf-ranges.sh index cefb4231..61141cfa 100755 --- a/tests/run-all-dwarf-ranges.sh +++ b/tests/run-all-dwarf-ranges.sh @@ -126,4 +126,118 @@ die: no_subject (2e) EOF +# See testfile-dwp.source. +testfiles testfile-dwp-5 testfile-dwp-5.dwp +testfiles testfile-dwp-4 testfile-dwp-4.dwp + +testrun_compare ${abs_builddir}/all-dwarf-ranges testfile-dwp-5 << EOF +die: foo.cc (11) + 401190..401200 + +die: foo (2e) + 4011c0..401200 + +die: x_x (1d) + 4011cb..4011eb + 4011f8..401200 + +die: (b) + 4011cb..4011eb + 4011f8..401200 + +die: x_x (2e) + 401190..4011bd + +die: (b) + 401190..401190 + 401192..4011bb + +die: bar.cc (11) + 401200..40121b + +die: bar (2e) + 401200..40121b + +die: main.cc (11) + 401020..4010a0 + +die: main (2e) + 401020..4010a0 + +die: fibonacci (1d) + 401030..401032 + 401036..401060 + 401099..4010a0 + +die: fibonacci (1d) + 40103a..401060 + 401099..4010a0 + +die: (b) + 40103a..401060 + 401099..4010a0 + +die: (b) + 40103a..401044 + 401050..401060 + +die: (b) + 401050..401053 + 401056..401059 + +EOF + +testrun_compare ${abs_builddir}/all-dwarf-ranges testfile-dwp-4 << EOF +die: foo.cc (11) + 401190..401200 + +die: foo (2e) + 4011c0..401200 + +die: x_x (1d) + 4011cb..4011eb + 4011f8..401200 + +die: (b) + 4011cb..4011eb + 4011f8..401200 + +die: x_x (2e) + 401190..4011bd + +die: bar.cc (11) + 401200..40121b + +die: bar (2e) + 401200..40121b + +die: main.cc (11) + 401020..4010a0 + +die: main (2e) + 401020..4010a0 + +die: fibonacci (1d) + 401030..401032 + 401036..401060 + 401099..4010a0 + +die: fibonacci (1d) + 40103a..401060 + 401099..4010a0 + +die: (b) + 40103a..401060 + 401099..4010a0 + +die: (b) + 40103a..401044 + 401050..401060 + +die: (b) + 401050..401053 + 401056..401059 + +EOF + exit 0 diff --git a/tests/run-dwarf-getmacros.sh b/tests/run-dwarf-getmacros.sh index 0a488fa3..220c2426 100755 --- a/tests/run-dwarf-getmacros.sh +++ b/tests/run-dwarf-getmacros.sh @@ -707,4 +707,1416 @@ file /home/petr/proj/elfutils/master/elfutils/x.c /file EOF +# See testfile-dwp.source. +testfiles testfile-dwp-5 testfile-dwp-5.dwp +testfiles testfile-dwp-4-strict testfile-dwp-4-strict.dwp + +# Not testfile-dwp-4 because it's unclear what to do about +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99319. +for file in testfile-dwp-5 testfile-dwp-4-strict; do + testrun_compare ${abs_builddir}/dwarf-getmacros "$file" '' '' << EOF +CU foo.cc +__STDC__ 1 +__cplusplus 201703L +__STDC_UTF_16__ 1 +__STDC_UTF_32__ 1 +__STDC_HOSTED__ 1 +__GNUC__ 14 +__GNUC_MINOR__ 0 +__GNUC_PATCHLEVEL__ 0 +__VERSION__ "14.0.0 20230920 (experimental)" +__ATOMIC_RELAXED 0 +__ATOMIC_SEQ_CST 5 +__ATOMIC_ACQUIRE 2 +__ATOMIC_RELEASE 3 +__ATOMIC_ACQ_REL 4 +__ATOMIC_CONSUME 1 +__OPTIMIZE__ 1 +__FINITE_MATH_ONLY__ 0 +_LP64 1 +__LP64__ 1 +__SIZEOF_INT__ 4 +__SIZEOF_LONG__ 8 +__SIZEOF_LONG_LONG__ 8 +__SIZEOF_SHORT__ 2 +__SIZEOF_FLOAT__ 4 +__SIZEOF_DOUBLE__ 8 +__SIZEOF_LONG_DOUBLE__ 16 +__SIZEOF_SIZE_T__ 8 +__CHAR_BIT__ 8 +__BIGGEST_ALIGNMENT__ 16 +__ORDER_LITTLE_ENDIAN__ 1234 +__ORDER_BIG_ENDIAN__ 4321 +__ORDER_PDP_ENDIAN__ 3412 +__BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +__FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__ +__SIZEOF_POINTER__ 8 +__GNUC_EXECUTION_CHARSET_NAME "UTF-8" +__GNUC_WIDE_EXECUTION_CHARSET_NAME "UTF-32LE" +__GNUG__ 14 +__SIZE_TYPE__ long unsigned int +__PTRDIFF_TYPE__ long int +__WCHAR_TYPE__ int +__WINT_TYPE__ unsigned int +__INTMAX_TYPE__ long int +__UINTMAX_TYPE__ long unsigned int +__CHAR16_TYPE__ short unsigned int +__CHAR32_TYPE__ unsigned int +__SIG_ATOMIC_TYPE__ int +__INT8_TYPE__ signed char +__INT16_TYPE__ short int +__INT32_TYPE__ int +__INT64_TYPE__ long int +__UINT8_TYPE__ unsigned char +__UINT16_TYPE__ short unsigned int +__UINT32_TYPE__ unsigned int +__UINT64_TYPE__ long unsigned int +__INT_LEAST8_TYPE__ signed char +__INT_LEAST16_TYPE__ short int +__INT_LEAST32_TYPE__ int +__INT_LEAST64_TYPE__ long int +__UINT_LEAST8_TYPE__ unsigned char +__UINT_LEAST16_TYPE__ short unsigned int +__UINT_LEAST32_TYPE__ unsigned int +__UINT_LEAST64_TYPE__ long unsigned int +__INT_FAST8_TYPE__ signed char +__INT_FAST16_TYPE__ long int +__INT_FAST32_TYPE__ long int +__INT_FAST64_TYPE__ long int +__UINT_FAST8_TYPE__ unsigned char +__UINT_FAST16_TYPE__ long unsigned int +__UINT_FAST32_TYPE__ long unsigned int +__UINT_FAST64_TYPE__ long unsigned int +__INTPTR_TYPE__ long int +__UINTPTR_TYPE__ long unsigned int +__GXX_WEAK__ 1 +__DEPRECATED 1 +__GXX_RTTI 1 +__cpp_rtti 199711L +__GXX_EXPERIMENTAL_CXX0X__ 1 +__cpp_binary_literals 201304L +__cpp_hex_float 201603L +__cpp_runtime_arrays 198712L +__cpp_raw_strings 200710L +__cpp_unicode_literals 200710L +__cpp_user_defined_literals 200809L +__cpp_lambdas 200907L +__cpp_decltype 200707L +__cpp_attributes 200809L +__cpp_rvalue_reference 200610L +__cpp_rvalue_references 200610L +__cpp_variadic_templates 200704L +__cpp_initializer_lists 200806L +__cpp_delegating_constructors 200604L +__cpp_nsdmi 200809L +__cpp_inheriting_constructors 201511L +__cpp_ref_qualifiers 200710L +__cpp_alias_templates 200704L +__cpp_return_type_deduction 201304L +__cpp_init_captures 201304L +__cpp_generic_lambdas 201304L +__cpp_decltype_auto 201304L +__cpp_aggregate_nsdmi 201304L +__cpp_variable_templates 201304L +__cpp_digit_separators 201309L +__cpp_unicode_characters 201411L +__cpp_static_assert 201411L +__cpp_namespace_attributes 201411L +__cpp_enumerator_attributes 201411L +__cpp_nested_namespace_definitions 201411L +__cpp_fold_expressions 201603L +__cpp_nontype_template_args 201411L +__cpp_range_based_for 201603L +__cpp_constexpr 201603L +__cpp_if_constexpr 201606L +__cpp_capture_star_this 201603L +__cpp_inline_variables 201606L +__cpp_aggregate_bases 201603L +__cpp_deduction_guides 201703L +__cpp_noexcept_function_type 201510L +__cpp_template_auto 201606L +__cpp_structured_bindings 201606L +__cpp_variadic_using 201611L +__cpp_guaranteed_copy_elision 201606L +__cpp_nontype_template_parameter_auto 201606L +__cpp_sized_deallocation 201309L +__cpp_aligned_new 201606L +__STDCPP_DEFAULT_NEW_ALIGNMENT__ 16 +__cpp_template_template_args 201611L +__cpp_threadsafe_static_init 200806L +__STDCPP_THREADS__ 1 +__EXCEPTIONS 1 +__cpp_exceptions 199711L +__GXX_ABI_VERSION 1019 +__SCHAR_MAX__ 0x7f +__SHRT_MAX__ 0x7fff +__INT_MAX__ 0x7fffffff +__LONG_MAX__ 0x7fffffffffffffffL +__LONG_LONG_MAX__ 0x7fffffffffffffffLL +__WCHAR_MAX__ 0x7fffffff +__WCHAR_MIN__ (-__WCHAR_MAX__ - 1) +__WINT_MAX__ 0xffffffffU +__WINT_MIN__ 0U +__PTRDIFF_MAX__ 0x7fffffffffffffffL +__SIZE_MAX__ 0xffffffffffffffffUL +__SCHAR_WIDTH__ 8 +__SHRT_WIDTH__ 16 +__INT_WIDTH__ 32 +__LONG_WIDTH__ 64 +__LONG_LONG_WIDTH__ 64 +__WCHAR_WIDTH__ 32 +__WINT_WIDTH__ 32 +__PTRDIFF_WIDTH__ 64 +__SIZE_WIDTH__ 64 +__GLIBCXX_TYPE_INT_N_0 __int128 +__GLIBCXX_BITSIZE_INT_N_0 128 +__INTMAX_MAX__ 0x7fffffffffffffffL +__INTMAX_C(c) c ## L +__UINTMAX_MAX__ 0xffffffffffffffffUL +__UINTMAX_C(c) c ## UL +__INTMAX_WIDTH__ 64 +__SIG_ATOMIC_MAX__ 0x7fffffff +__SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1) +__SIG_ATOMIC_WIDTH__ 32 +__INT8_MAX__ 0x7f +__INT16_MAX__ 0x7fff +__INT32_MAX__ 0x7fffffff +__INT64_MAX__ 0x7fffffffffffffffL +__UINT8_MAX__ 0xff +__UINT16_MAX__ 0xffff +__UINT32_MAX__ 0xffffffffU +__UINT64_MAX__ 0xffffffffffffffffUL +__INT_LEAST8_MAX__ 0x7f +__INT8_C(c) c +__INT_LEAST8_WIDTH__ 8 +__INT_LEAST16_MAX__ 0x7fff +__INT16_C(c) c +__INT_LEAST16_WIDTH__ 16 +__INT_LEAST32_MAX__ 0x7fffffff +__INT32_C(c) c +__INT_LEAST32_WIDTH__ 32 +__INT_LEAST64_MAX__ 0x7fffffffffffffffL +__INT64_C(c) c ## L +__INT_LEAST64_WIDTH__ 64 +__UINT_LEAST8_MAX__ 0xff +__UINT8_C(c) c +__UINT_LEAST16_MAX__ 0xffff +__UINT16_C(c) c +__UINT_LEAST32_MAX__ 0xffffffffU +__UINT32_C(c) c ## U +__UINT_LEAST64_MAX__ 0xffffffffffffffffUL +__UINT64_C(c) c ## UL +__INT_FAST8_MAX__ 0x7f +__INT_FAST8_WIDTH__ 8 +__INT_FAST16_MAX__ 0x7fffffffffffffffL +__INT_FAST16_WIDTH__ 64 +__INT_FAST32_MAX__ 0x7fffffffffffffffL +__INT_FAST32_WIDTH__ 64 +__INT_FAST64_MAX__ 0x7fffffffffffffffL +__INT_FAST64_WIDTH__ 64 +__UINT_FAST8_MAX__ 0xff +__UINT_FAST16_MAX__ 0xffffffffffffffffUL +__UINT_FAST32_MAX__ 0xffffffffffffffffUL +__UINT_FAST64_MAX__ 0xffffffffffffffffUL +__INTPTR_MAX__ 0x7fffffffffffffffL +__INTPTR_WIDTH__ 64 +__UINTPTR_MAX__ 0xffffffffffffffffUL +__GCC_IEC_559 2 +__GCC_IEC_559_COMPLEX 2 +__FLT_EVAL_METHOD__ 0 +__FLT_EVAL_METHOD_TS_18661_3__ 0 +__DEC_EVAL_METHOD__ 2 +__FLT_RADIX__ 2 +__FLT_MANT_DIG__ 24 +__FLT_DIG__ 6 +__FLT_MIN_EXP__ (-125) +__FLT_MIN_10_EXP__ (-37) +__FLT_MAX_EXP__ 128 +__FLT_MAX_10_EXP__ 38 +__FLT_DECIMAL_DIG__ 9 +__FLT_MAX__ 3.40282346638528859811704183484516925e+38F +__FLT_NORM_MAX__ 3.40282346638528859811704183484516925e+38F +__FLT_MIN__ 1.17549435082228750796873653722224568e-38F +__FLT_EPSILON__ 1.19209289550781250000000000000000000e-7F +__FLT_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F +__FLT_HAS_DENORM__ 1 +__FLT_HAS_INFINITY__ 1 +__FLT_HAS_QUIET_NAN__ 1 +__FLT_IS_IEC_60559__ 1 +__DBL_MANT_DIG__ 53 +__DBL_DIG__ 15 +__DBL_MIN_EXP__ (-1021) +__DBL_MIN_10_EXP__ (-307) +__DBL_MAX_EXP__ 1024 +__DBL_MAX_10_EXP__ 308 +__DBL_DECIMAL_DIG__ 17 +__DBL_MAX__ double(1.79769313486231570814527423731704357e+308L) +__DBL_NORM_MAX__ double(1.79769313486231570814527423731704357e+308L) +__DBL_MIN__ double(2.22507385850720138309023271733240406e-308L) +__DBL_EPSILON__ double(2.22044604925031308084726333618164062e-16L) +__DBL_DENORM_MIN__ double(4.94065645841246544176568792868221372e-324L) +__DBL_HAS_DENORM__ 1 +__DBL_HAS_INFINITY__ 1 +__DBL_HAS_QUIET_NAN__ 1 +__DBL_IS_IEC_60559__ 1 +__LDBL_MANT_DIG__ 64 +__LDBL_DIG__ 18 +__LDBL_MIN_EXP__ (-16381) +__LDBL_MIN_10_EXP__ (-4931) +__LDBL_MAX_EXP__ 16384 +__LDBL_MAX_10_EXP__ 4932 +__DECIMAL_DIG__ 21 +__LDBL_DECIMAL_DIG__ 21 +__LDBL_MAX__ 1.18973149535723176502126385303097021e+4932L +__LDBL_NORM_MAX__ 1.18973149535723176502126385303097021e+4932L +__LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L +__LDBL_EPSILON__ 1.08420217248550443400745280086994171e-19L +__LDBL_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951L +__LDBL_HAS_DENORM__ 1 +__LDBL_HAS_INFINITY__ 1 +__LDBL_HAS_QUIET_NAN__ 1 +__LDBL_IS_IEC_60559__ 1 +__FLT16_MANT_DIG__ 11 +__FLT16_DIG__ 3 +__FLT16_MIN_EXP__ (-13) +__FLT16_MIN_10_EXP__ (-4) +__FLT16_MAX_EXP__ 16 +__FLT16_MAX_10_EXP__ 4 +__FLT16_DECIMAL_DIG__ 5 +__FLT16_MAX__ 6.55040000000000000000000000000000000e+4F16 +__FLT16_NORM_MAX__ 6.55040000000000000000000000000000000e+4F16 +__FLT16_MIN__ 6.10351562500000000000000000000000000e-5F16 +__FLT16_EPSILON__ 9.76562500000000000000000000000000000e-4F16 +__FLT16_DENORM_MIN__ 5.96046447753906250000000000000000000e-8F16 +__FLT16_HAS_DENORM__ 1 +__FLT16_HAS_INFINITY__ 1 +__FLT16_HAS_QUIET_NAN__ 1 +__FLT16_IS_IEC_60559__ 1 +__FLT32_MANT_DIG__ 24 +__FLT32_DIG__ 6 +__FLT32_MIN_EXP__ (-125) +__FLT32_MIN_10_EXP__ (-37) +__FLT32_MAX_EXP__ 128 +__FLT32_MAX_10_EXP__ 38 +__FLT32_DECIMAL_DIG__ 9 +__FLT32_MAX__ 3.40282346638528859811704183484516925e+38F32 +__FLT32_NORM_MAX__ 3.40282346638528859811704183484516925e+38F32 +__FLT32_MIN__ 1.17549435082228750796873653722224568e-38F32 +__FLT32_EPSILON__ 1.19209289550781250000000000000000000e-7F32 +__FLT32_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F32 +__FLT32_HAS_DENORM__ 1 +__FLT32_HAS_INFINITY__ 1 +__FLT32_HAS_QUIET_NAN__ 1 +__FLT32_IS_IEC_60559__ 1 +__FLT64_MANT_DIG__ 53 +__FLT64_DIG__ 15 +__FLT64_MIN_EXP__ (-1021) +__FLT64_MIN_10_EXP__ (-307) +__FLT64_MAX_EXP__ 1024 +__FLT64_MAX_10_EXP__ 308 +__FLT64_DECIMAL_DIG__ 17 +__FLT64_MAX__ 1.79769313486231570814527423731704357e+308F64 +__FLT64_NORM_MAX__ 1.79769313486231570814527423731704357e+308F64 +__FLT64_MIN__ 2.22507385850720138309023271733240406e-308F64 +__FLT64_EPSILON__ 2.22044604925031308084726333618164062e-16F64 +__FLT64_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F64 +__FLT64_HAS_DENORM__ 1 +__FLT64_HAS_INFINITY__ 1 +__FLT64_HAS_QUIET_NAN__ 1 +__FLT64_IS_IEC_60559__ 1 +__FLT128_MANT_DIG__ 113 +__FLT128_DIG__ 33 +__FLT128_MIN_EXP__ (-16381) +__FLT128_MIN_10_EXP__ (-4931) +__FLT128_MAX_EXP__ 16384 +__FLT128_MAX_10_EXP__ 4932 +__FLT128_DECIMAL_DIG__ 36 +__FLT128_MAX__ 1.18973149535723176508575932662800702e+4932F128 +__FLT128_NORM_MAX__ 1.18973149535723176508575932662800702e+4932F128 +__FLT128_MIN__ 3.36210314311209350626267781732175260e-4932F128 +__FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34F128 +__FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F128 +__FLT128_HAS_DENORM__ 1 +__FLT128_HAS_INFINITY__ 1 +__FLT128_HAS_QUIET_NAN__ 1 +__FLT128_IS_IEC_60559__ 1 +__FLT32X_MANT_DIG__ 53 +__FLT32X_DIG__ 15 +__FLT32X_MIN_EXP__ (-1021) +__FLT32X_MIN_10_EXP__ (-307) +__FLT32X_MAX_EXP__ 1024 +__FLT32X_MAX_10_EXP__ 308 +__FLT32X_DECIMAL_DIG__ 17 +__FLT32X_MAX__ 1.79769313486231570814527423731704357e+308F32x +__FLT32X_NORM_MAX__ 1.79769313486231570814527423731704357e+308F32x +__FLT32X_MIN__ 2.22507385850720138309023271733240406e-308F32x +__FLT32X_EPSILON__ 2.22044604925031308084726333618164062e-16F32x +__FLT32X_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F32x +__FLT32X_HAS_DENORM__ 1 +__FLT32X_HAS_INFINITY__ 1 +__FLT32X_HAS_QUIET_NAN__ 1 +__FLT32X_IS_IEC_60559__ 1 +__FLT64X_MANT_DIG__ 64 +__FLT64X_DIG__ 18 +__FLT64X_MIN_EXP__ (-16381) +__FLT64X_MIN_10_EXP__ (-4931) +__FLT64X_MAX_EXP__ 16384 +__FLT64X_MAX_10_EXP__ 4932 +__FLT64X_DECIMAL_DIG__ 21 +__FLT64X_MAX__ 1.18973149535723176502126385303097021e+4932F64x +__FLT64X_NORM_MAX__ 1.18973149535723176502126385303097021e+4932F64x +__FLT64X_MIN__ 3.36210314311209350626267781732175260e-4932F64x +__FLT64X_EPSILON__ 1.08420217248550443400745280086994171e-19F64x +__FLT64X_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951F64x +__FLT64X_HAS_DENORM__ 1 +__FLT64X_HAS_INFINITY__ 1 +__FLT64X_HAS_QUIET_NAN__ 1 +__FLT64X_IS_IEC_60559__ 1 +__BFLT16_MANT_DIG__ 8 +__BFLT16_DIG__ 2 +__BFLT16_MIN_EXP__ (-125) +__BFLT16_MIN_10_EXP__ (-37) +__BFLT16_MAX_EXP__ 128 +__BFLT16_MAX_10_EXP__ 38 +__BFLT16_DECIMAL_DIG__ 4 +__BFLT16_MAX__ 3.38953138925153547590470800371487867e+38BF16 +__BFLT16_NORM_MAX__ 3.38953138925153547590470800371487867e+38BF16 +__BFLT16_MIN__ 1.17549435082228750796873653722224568e-38BF16 +__BFLT16_EPSILON__ 7.81250000000000000000000000000000000e-3BF16 +__BFLT16_DENORM_MIN__ 9.18354961579912115600575419704879436e-41BF16 +__BFLT16_HAS_DENORM__ 1 +__BFLT16_HAS_INFINITY__ 1 +__BFLT16_HAS_QUIET_NAN__ 1 +__BFLT16_IS_IEC_60559__ 0 +__DEC32_MANT_DIG__ 7 +__DEC32_MIN_EXP__ (-94) +__DEC32_MAX_EXP__ 97 +__DEC32_MIN__ 1E-95DF +__DEC32_MAX__ 9.999999E96DF +__DEC32_EPSILON__ 1E-6DF +__DEC32_SUBNORMAL_MIN__ 0.000001E-95DF +__DEC64_MANT_DIG__ 16 +__DEC64_MIN_EXP__ (-382) +__DEC64_MAX_EXP__ 385 +__DEC64_MIN__ 1E-383DD +__DEC64_MAX__ 9.999999999999999E384DD +__DEC64_EPSILON__ 1E-15DD +__DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD +__DEC128_MANT_DIG__ 34 +__DEC128_MIN_EXP__ (-6142) +__DEC128_MAX_EXP__ 6145 +__DEC128_MIN__ 1E-6143DL +__DEC128_MAX__ 9.999999999999999999999999999999999E6144DL +__DEC128_EPSILON__ 1E-33DL +__DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL +__REGISTER_PREFIX__ +__USER_LABEL_PREFIX__ +__GNUC_STDC_INLINE__ 1 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 +__GCC_ATOMIC_BOOL_LOCK_FREE 2 +__GCC_ATOMIC_CHAR_LOCK_FREE 2 +__GCC_ATOMIC_CHAR16_T_LOCK_FREE 2 +__GCC_ATOMIC_CHAR32_T_LOCK_FREE 2 +__GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 +__GCC_ATOMIC_SHORT_LOCK_FREE 2 +__GCC_ATOMIC_INT_LOCK_FREE 2 +__GCC_ATOMIC_LONG_LOCK_FREE 2 +__GCC_ATOMIC_LLONG_LOCK_FREE 2 +__GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 +__GCC_DESTRUCTIVE_SIZE 64 +__GCC_CONSTRUCTIVE_SIZE 64 +__GCC_ATOMIC_POINTER_LOCK_FREE 2 +__HAVE_SPECULATION_SAFE_VALUE 1 +__GCC_HAVE_DWARF2_CFI_ASM 1 +__PRAGMA_REDEFINE_EXTNAME 1 +__SIZEOF_INT128__ 16 +__SIZEOF_WCHAR_T__ 4 +__SIZEOF_WINT_T__ 4 +__SIZEOF_PTRDIFF_T__ 8 +__amd64 1 +__amd64__ 1 +__x86_64 1 +__x86_64__ 1 +__SIZEOF_FLOAT80__ 16 +__SIZEOF_FLOAT128__ 16 +__ATOMIC_HLE_ACQUIRE 65536 +__ATOMIC_HLE_RELEASE 131072 +__GCC_ASM_FLAG_OUTPUTS__ 1 +__k8 1 +__k8__ 1 +__code_model_small__ 1 +__MMX__ 1 +__SSE__ 1 +__SSE2__ 1 +__FXSR__ 1 +__SSE_MATH__ 1 +__SSE2_MATH__ 1 +__MMX_WITH_SSE__ 1 +__SEG_FS 1 +__SEG_GS 1 +__gnu_linux__ 1 +__linux 1 +__linux__ 1 +linux 1 +__unix 1 +__unix__ 1 +unix 1 +__ELF__ 1 +__DECIMAL_BID_FORMAT__ 1 +_GNU_SOURCE 1 +file /home/osandov/src/elfutils/tests/foo.cc + file /usr/include/stdc-predef.h + _STDC_PREDEF_H 1 + __STDC_IEC_559__ 1 + __STDC_IEC_60559_BFP__ 201404L + __STDC_IEC_559_COMPLEX__ 1 + __STDC_IEC_60559_COMPLEX__ 201404L + __STDC_ISO_10646__ 201706L + /file + file /home/osandov/src/elfutils/tests/foobar.h + FROB(x) ((x) ^ 0x2a2a2a2a) + FRY(x) ((x) * 0x100000001b3) + /file + ZERO() (1 - 1) +/file +CU bar.cc +__STDC__ 1 +__cplusplus 201703L +__STDC_UTF_16__ 1 +__STDC_UTF_32__ 1 +__STDC_HOSTED__ 1 +__GNUC__ 14 +__GNUC_MINOR__ 0 +__GNUC_PATCHLEVEL__ 0 +__VERSION__ "14.0.0 20230920 (experimental)" +__ATOMIC_RELAXED 0 +__ATOMIC_SEQ_CST 5 +__ATOMIC_ACQUIRE 2 +__ATOMIC_RELEASE 3 +__ATOMIC_ACQ_REL 4 +__ATOMIC_CONSUME 1 +__OPTIMIZE__ 1 +__FINITE_MATH_ONLY__ 0 +_LP64 1 +__LP64__ 1 +__SIZEOF_INT__ 4 +__SIZEOF_LONG__ 8 +__SIZEOF_LONG_LONG__ 8 +__SIZEOF_SHORT__ 2 +__SIZEOF_FLOAT__ 4 +__SIZEOF_DOUBLE__ 8 +__SIZEOF_LONG_DOUBLE__ 16 +__SIZEOF_SIZE_T__ 8 +__CHAR_BIT__ 8 +__BIGGEST_ALIGNMENT__ 16 +__ORDER_LITTLE_ENDIAN__ 1234 +__ORDER_BIG_ENDIAN__ 4321 +__ORDER_PDP_ENDIAN__ 3412 +__BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +__FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__ +__SIZEOF_POINTER__ 8 +__GNUC_EXECUTION_CHARSET_NAME "UTF-8" +__GNUC_WIDE_EXECUTION_CHARSET_NAME "UTF-32LE" +__GNUG__ 14 +__SIZE_TYPE__ long unsigned int +__PTRDIFF_TYPE__ long int +__WCHAR_TYPE__ int +__WINT_TYPE__ unsigned int +__INTMAX_TYPE__ long int +__UINTMAX_TYPE__ long unsigned int +__CHAR16_TYPE__ short unsigned int +__CHAR32_TYPE__ unsigned int +__SIG_ATOMIC_TYPE__ int +__INT8_TYPE__ signed char +__INT16_TYPE__ short int +__INT32_TYPE__ int +__INT64_TYPE__ long int +__UINT8_TYPE__ unsigned char +__UINT16_TYPE__ short unsigned int +__UINT32_TYPE__ unsigned int +__UINT64_TYPE__ long unsigned int +__INT_LEAST8_TYPE__ signed char +__INT_LEAST16_TYPE__ short int +__INT_LEAST32_TYPE__ int +__INT_LEAST64_TYPE__ long int +__UINT_LEAST8_TYPE__ unsigned char +__UINT_LEAST16_TYPE__ short unsigned int +__UINT_LEAST32_TYPE__ unsigned int +__UINT_LEAST64_TYPE__ long unsigned int +__INT_FAST8_TYPE__ signed char +__INT_FAST16_TYPE__ long int +__INT_FAST32_TYPE__ long int +__INT_FAST64_TYPE__ long int +__UINT_FAST8_TYPE__ unsigned char +__UINT_FAST16_TYPE__ long unsigned int +__UINT_FAST32_TYPE__ long unsigned int +__UINT_FAST64_TYPE__ long unsigned int +__INTPTR_TYPE__ long int +__UINTPTR_TYPE__ long unsigned int +__GXX_WEAK__ 1 +__DEPRECATED 1 +__GXX_RTTI 1 +__cpp_rtti 199711L +__GXX_EXPERIMENTAL_CXX0X__ 1 +__cpp_binary_literals 201304L +__cpp_hex_float 201603L +__cpp_runtime_arrays 198712L +__cpp_raw_strings 200710L +__cpp_unicode_literals 200710L +__cpp_user_defined_literals 200809L +__cpp_lambdas 200907L +__cpp_decltype 200707L +__cpp_attributes 200809L +__cpp_rvalue_reference 200610L +__cpp_rvalue_references 200610L +__cpp_variadic_templates 200704L +__cpp_initializer_lists 200806L +__cpp_delegating_constructors 200604L +__cpp_nsdmi 200809L +__cpp_inheriting_constructors 201511L +__cpp_ref_qualifiers 200710L +__cpp_alias_templates 200704L +__cpp_return_type_deduction 201304L +__cpp_init_captures 201304L +__cpp_generic_lambdas 201304L +__cpp_decltype_auto 201304L +__cpp_aggregate_nsdmi 201304L +__cpp_variable_templates 201304L +__cpp_digit_separators 201309L +__cpp_unicode_characters 201411L +__cpp_static_assert 201411L +__cpp_namespace_attributes 201411L +__cpp_enumerator_attributes 201411L +__cpp_nested_namespace_definitions 201411L +__cpp_fold_expressions 201603L +__cpp_nontype_template_args 201411L +__cpp_range_based_for 201603L +__cpp_constexpr 201603L +__cpp_if_constexpr 201606L +__cpp_capture_star_this 201603L +__cpp_inline_variables 201606L +__cpp_aggregate_bases 201603L +__cpp_deduction_guides 201703L +__cpp_noexcept_function_type 201510L +__cpp_template_auto 201606L +__cpp_structured_bindings 201606L +__cpp_variadic_using 201611L +__cpp_guaranteed_copy_elision 201606L +__cpp_nontype_template_parameter_auto 201606L +__cpp_sized_deallocation 201309L +__cpp_aligned_new 201606L +__STDCPP_DEFAULT_NEW_ALIGNMENT__ 16 +__cpp_template_template_args 201611L +__cpp_threadsafe_static_init 200806L +__STDCPP_THREADS__ 1 +__EXCEPTIONS 1 +__cpp_exceptions 199711L +__GXX_ABI_VERSION 1019 +__SCHAR_MAX__ 0x7f +__SHRT_MAX__ 0x7fff +__INT_MAX__ 0x7fffffff +__LONG_MAX__ 0x7fffffffffffffffL +__LONG_LONG_MAX__ 0x7fffffffffffffffLL +__WCHAR_MAX__ 0x7fffffff +__WCHAR_MIN__ (-__WCHAR_MAX__ - 1) +__WINT_MAX__ 0xffffffffU +__WINT_MIN__ 0U +__PTRDIFF_MAX__ 0x7fffffffffffffffL +__SIZE_MAX__ 0xffffffffffffffffUL +__SCHAR_WIDTH__ 8 +__SHRT_WIDTH__ 16 +__INT_WIDTH__ 32 +__LONG_WIDTH__ 64 +__LONG_LONG_WIDTH__ 64 +__WCHAR_WIDTH__ 32 +__WINT_WIDTH__ 32 +__PTRDIFF_WIDTH__ 64 +__SIZE_WIDTH__ 64 +__GLIBCXX_TYPE_INT_N_0 __int128 +__GLIBCXX_BITSIZE_INT_N_0 128 +__INTMAX_MAX__ 0x7fffffffffffffffL +__INTMAX_C(c) c ## L +__UINTMAX_MAX__ 0xffffffffffffffffUL +__UINTMAX_C(c) c ## UL +__INTMAX_WIDTH__ 64 +__SIG_ATOMIC_MAX__ 0x7fffffff +__SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1) +__SIG_ATOMIC_WIDTH__ 32 +__INT8_MAX__ 0x7f +__INT16_MAX__ 0x7fff +__INT32_MAX__ 0x7fffffff +__INT64_MAX__ 0x7fffffffffffffffL +__UINT8_MAX__ 0xff +__UINT16_MAX__ 0xffff +__UINT32_MAX__ 0xffffffffU +__UINT64_MAX__ 0xffffffffffffffffUL +__INT_LEAST8_MAX__ 0x7f +__INT8_C(c) c +__INT_LEAST8_WIDTH__ 8 +__INT_LEAST16_MAX__ 0x7fff +__INT16_C(c) c +__INT_LEAST16_WIDTH__ 16 +__INT_LEAST32_MAX__ 0x7fffffff +__INT32_C(c) c +__INT_LEAST32_WIDTH__ 32 +__INT_LEAST64_MAX__ 0x7fffffffffffffffL +__INT64_C(c) c ## L +__INT_LEAST64_WIDTH__ 64 +__UINT_LEAST8_MAX__ 0xff +__UINT8_C(c) c +__UINT_LEAST16_MAX__ 0xffff +__UINT16_C(c) c +__UINT_LEAST32_MAX__ 0xffffffffU +__UINT32_C(c) c ## U +__UINT_LEAST64_MAX__ 0xffffffffffffffffUL +__UINT64_C(c) c ## UL +__INT_FAST8_MAX__ 0x7f +__INT_FAST8_WIDTH__ 8 +__INT_FAST16_MAX__ 0x7fffffffffffffffL +__INT_FAST16_WIDTH__ 64 +__INT_FAST32_MAX__ 0x7fffffffffffffffL +__INT_FAST32_WIDTH__ 64 +__INT_FAST64_MAX__ 0x7fffffffffffffffL +__INT_FAST64_WIDTH__ 64 +__UINT_FAST8_MAX__ 0xff +__UINT_FAST16_MAX__ 0xffffffffffffffffUL +__UINT_FAST32_MAX__ 0xffffffffffffffffUL +__UINT_FAST64_MAX__ 0xffffffffffffffffUL +__INTPTR_MAX__ 0x7fffffffffffffffL +__INTPTR_WIDTH__ 64 +__UINTPTR_MAX__ 0xffffffffffffffffUL +__GCC_IEC_559 2 +__GCC_IEC_559_COMPLEX 2 +__FLT_EVAL_METHOD__ 0 +__FLT_EVAL_METHOD_TS_18661_3__ 0 +__DEC_EVAL_METHOD__ 2 +__FLT_RADIX__ 2 +__FLT_MANT_DIG__ 24 +__FLT_DIG__ 6 +__FLT_MIN_EXP__ (-125) +__FLT_MIN_10_EXP__ (-37) +__FLT_MAX_EXP__ 128 +__FLT_MAX_10_EXP__ 38 +__FLT_DECIMAL_DIG__ 9 +__FLT_MAX__ 3.40282346638528859811704183484516925e+38F +__FLT_NORM_MAX__ 3.40282346638528859811704183484516925e+38F +__FLT_MIN__ 1.17549435082228750796873653722224568e-38F +__FLT_EPSILON__ 1.19209289550781250000000000000000000e-7F +__FLT_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F +__FLT_HAS_DENORM__ 1 +__FLT_HAS_INFINITY__ 1 +__FLT_HAS_QUIET_NAN__ 1 +__FLT_IS_IEC_60559__ 1 +__DBL_MANT_DIG__ 53 +__DBL_DIG__ 15 +__DBL_MIN_EXP__ (-1021) +__DBL_MIN_10_EXP__ (-307) +__DBL_MAX_EXP__ 1024 +__DBL_MAX_10_EXP__ 308 +__DBL_DECIMAL_DIG__ 17 +__DBL_MAX__ double(1.79769313486231570814527423731704357e+308L) +__DBL_NORM_MAX__ double(1.79769313486231570814527423731704357e+308L) +__DBL_MIN__ double(2.22507385850720138309023271733240406e-308L) +__DBL_EPSILON__ double(2.22044604925031308084726333618164062e-16L) +__DBL_DENORM_MIN__ double(4.94065645841246544176568792868221372e-324L) +__DBL_HAS_DENORM__ 1 +__DBL_HAS_INFINITY__ 1 +__DBL_HAS_QUIET_NAN__ 1 +__DBL_IS_IEC_60559__ 1 +__LDBL_MANT_DIG__ 64 +__LDBL_DIG__ 18 +__LDBL_MIN_EXP__ (-16381) +__LDBL_MIN_10_EXP__ (-4931) +__LDBL_MAX_EXP__ 16384 +__LDBL_MAX_10_EXP__ 4932 +__DECIMAL_DIG__ 21 +__LDBL_DECIMAL_DIG__ 21 +__LDBL_MAX__ 1.18973149535723176502126385303097021e+4932L +__LDBL_NORM_MAX__ 1.18973149535723176502126385303097021e+4932L +__LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L +__LDBL_EPSILON__ 1.08420217248550443400745280086994171e-19L +__LDBL_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951L +__LDBL_HAS_DENORM__ 1 +__LDBL_HAS_INFINITY__ 1 +__LDBL_HAS_QUIET_NAN__ 1 +__LDBL_IS_IEC_60559__ 1 +__FLT16_MANT_DIG__ 11 +__FLT16_DIG__ 3 +__FLT16_MIN_EXP__ (-13) +__FLT16_MIN_10_EXP__ (-4) +__FLT16_MAX_EXP__ 16 +__FLT16_MAX_10_EXP__ 4 +__FLT16_DECIMAL_DIG__ 5 +__FLT16_MAX__ 6.55040000000000000000000000000000000e+4F16 +__FLT16_NORM_MAX__ 6.55040000000000000000000000000000000e+4F16 +__FLT16_MIN__ 6.10351562500000000000000000000000000e-5F16 +__FLT16_EPSILON__ 9.76562500000000000000000000000000000e-4F16 +__FLT16_DENORM_MIN__ 5.96046447753906250000000000000000000e-8F16 +__FLT16_HAS_DENORM__ 1 +__FLT16_HAS_INFINITY__ 1 +__FLT16_HAS_QUIET_NAN__ 1 +__FLT16_IS_IEC_60559__ 1 +__FLT32_MANT_DIG__ 24 +__FLT32_DIG__ 6 +__FLT32_MIN_EXP__ (-125) +__FLT32_MIN_10_EXP__ (-37) +__FLT32_MAX_EXP__ 128 +__FLT32_MAX_10_EXP__ 38 +__FLT32_DECIMAL_DIG__ 9 +__FLT32_MAX__ 3.40282346638528859811704183484516925e+38F32 +__FLT32_NORM_MAX__ 3.40282346638528859811704183484516925e+38F32 +__FLT32_MIN__ 1.17549435082228750796873653722224568e-38F32 +__FLT32_EPSILON__ 1.19209289550781250000000000000000000e-7F32 +__FLT32_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F32 +__FLT32_HAS_DENORM__ 1 +__FLT32_HAS_INFINITY__ 1 +__FLT32_HAS_QUIET_NAN__ 1 +__FLT32_IS_IEC_60559__ 1 +__FLT64_MANT_DIG__ 53 +__FLT64_DIG__ 15 +__FLT64_MIN_EXP__ (-1021) +__FLT64_MIN_10_EXP__ (-307) +__FLT64_MAX_EXP__ 1024 +__FLT64_MAX_10_EXP__ 308 +__FLT64_DECIMAL_DIG__ 17 +__FLT64_MAX__ 1.79769313486231570814527423731704357e+308F64 +__FLT64_NORM_MAX__ 1.79769313486231570814527423731704357e+308F64 +__FLT64_MIN__ 2.22507385850720138309023271733240406e-308F64 +__FLT64_EPSILON__ 2.22044604925031308084726333618164062e-16F64 +__FLT64_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F64 +__FLT64_HAS_DENORM__ 1 +__FLT64_HAS_INFINITY__ 1 +__FLT64_HAS_QUIET_NAN__ 1 +__FLT64_IS_IEC_60559__ 1 +__FLT128_MANT_DIG__ 113 +__FLT128_DIG__ 33 +__FLT128_MIN_EXP__ (-16381) +__FLT128_MIN_10_EXP__ (-4931) +__FLT128_MAX_EXP__ 16384 +__FLT128_MAX_10_EXP__ 4932 +__FLT128_DECIMAL_DIG__ 36 +__FLT128_MAX__ 1.18973149535723176508575932662800702e+4932F128 +__FLT128_NORM_MAX__ 1.18973149535723176508575932662800702e+4932F128 +__FLT128_MIN__ 3.36210314311209350626267781732175260e-4932F128 +__FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34F128 +__FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F128 +__FLT128_HAS_DENORM__ 1 +__FLT128_HAS_INFINITY__ 1 +__FLT128_HAS_QUIET_NAN__ 1 +__FLT128_IS_IEC_60559__ 1 +__FLT32X_MANT_DIG__ 53 +__FLT32X_DIG__ 15 +__FLT32X_MIN_EXP__ (-1021) +__FLT32X_MIN_10_EXP__ (-307) +__FLT32X_MAX_EXP__ 1024 +__FLT32X_MAX_10_EXP__ 308 +__FLT32X_DECIMAL_DIG__ 17 +__FLT32X_MAX__ 1.79769313486231570814527423731704357e+308F32x +__FLT32X_NORM_MAX__ 1.79769313486231570814527423731704357e+308F32x +__FLT32X_MIN__ 2.22507385850720138309023271733240406e-308F32x +__FLT32X_EPSILON__ 2.22044604925031308084726333618164062e-16F32x +__FLT32X_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F32x +__FLT32X_HAS_DENORM__ 1 +__FLT32X_HAS_INFINITY__ 1 +__FLT32X_HAS_QUIET_NAN__ 1 +__FLT32X_IS_IEC_60559__ 1 +__FLT64X_MANT_DIG__ 64 +__FLT64X_DIG__ 18 +__FLT64X_MIN_EXP__ (-16381) +__FLT64X_MIN_10_EXP__ (-4931) +__FLT64X_MAX_EXP__ 16384 +__FLT64X_MAX_10_EXP__ 4932 +__FLT64X_DECIMAL_DIG__ 21 +__FLT64X_MAX__ 1.18973149535723176502126385303097021e+4932F64x +__FLT64X_NORM_MAX__ 1.18973149535723176502126385303097021e+4932F64x +__FLT64X_MIN__ 3.36210314311209350626267781732175260e-4932F64x +__FLT64X_EPSILON__ 1.08420217248550443400745280086994171e-19F64x +__FLT64X_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951F64x +__FLT64X_HAS_DENORM__ 1 +__FLT64X_HAS_INFINITY__ 1 +__FLT64X_HAS_QUIET_NAN__ 1 +__FLT64X_IS_IEC_60559__ 1 +__BFLT16_MANT_DIG__ 8 +__BFLT16_DIG__ 2 +__BFLT16_MIN_EXP__ (-125) +__BFLT16_MIN_10_EXP__ (-37) +__BFLT16_MAX_EXP__ 128 +__BFLT16_MAX_10_EXP__ 38 +__BFLT16_DECIMAL_DIG__ 4 +__BFLT16_MAX__ 3.38953138925153547590470800371487867e+38BF16 +__BFLT16_NORM_MAX__ 3.38953138925153547590470800371487867e+38BF16 +__BFLT16_MIN__ 1.17549435082228750796873653722224568e-38BF16 +__BFLT16_EPSILON__ 7.81250000000000000000000000000000000e-3BF16 +__BFLT16_DENORM_MIN__ 9.18354961579912115600575419704879436e-41BF16 +__BFLT16_HAS_DENORM__ 1 +__BFLT16_HAS_INFINITY__ 1 +__BFLT16_HAS_QUIET_NAN__ 1 +__BFLT16_IS_IEC_60559__ 0 +__DEC32_MANT_DIG__ 7 +__DEC32_MIN_EXP__ (-94) +__DEC32_MAX_EXP__ 97 +__DEC32_MIN__ 1E-95DF +__DEC32_MAX__ 9.999999E96DF +__DEC32_EPSILON__ 1E-6DF +__DEC32_SUBNORMAL_MIN__ 0.000001E-95DF +__DEC64_MANT_DIG__ 16 +__DEC64_MIN_EXP__ (-382) +__DEC64_MAX_EXP__ 385 +__DEC64_MIN__ 1E-383DD +__DEC64_MAX__ 9.999999999999999E384DD +__DEC64_EPSILON__ 1E-15DD +__DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD +__DEC128_MANT_DIG__ 34 +__DEC128_MIN_EXP__ (-6142) +__DEC128_MAX_EXP__ 6145 +__DEC128_MIN__ 1E-6143DL +__DEC128_MAX__ 9.999999999999999999999999999999999E6144DL +__DEC128_EPSILON__ 1E-33DL +__DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL +__REGISTER_PREFIX__ +__USER_LABEL_PREFIX__ +__GNUC_STDC_INLINE__ 1 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 +__GCC_ATOMIC_BOOL_LOCK_FREE 2 +__GCC_ATOMIC_CHAR_LOCK_FREE 2 +__GCC_ATOMIC_CHAR16_T_LOCK_FREE 2 +__GCC_ATOMIC_CHAR32_T_LOCK_FREE 2 +__GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 +__GCC_ATOMIC_SHORT_LOCK_FREE 2 +__GCC_ATOMIC_INT_LOCK_FREE 2 +__GCC_ATOMIC_LONG_LOCK_FREE 2 +__GCC_ATOMIC_LLONG_LOCK_FREE 2 +__GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 +__GCC_DESTRUCTIVE_SIZE 64 +__GCC_CONSTRUCTIVE_SIZE 64 +__GCC_ATOMIC_POINTER_LOCK_FREE 2 +__HAVE_SPECULATION_SAFE_VALUE 1 +__GCC_HAVE_DWARF2_CFI_ASM 1 +__PRAGMA_REDEFINE_EXTNAME 1 +__SIZEOF_INT128__ 16 +__SIZEOF_WCHAR_T__ 4 +__SIZEOF_WINT_T__ 4 +__SIZEOF_PTRDIFF_T__ 8 +__amd64 1 +__amd64__ 1 +__x86_64 1 +__x86_64__ 1 +__SIZEOF_FLOAT80__ 16 +__SIZEOF_FLOAT128__ 16 +__ATOMIC_HLE_ACQUIRE 65536 +__ATOMIC_HLE_RELEASE 131072 +__GCC_ASM_FLAG_OUTPUTS__ 1 +__k8 1 +__k8__ 1 +__code_model_small__ 1 +__MMX__ 1 +__SSE__ 1 +__SSE2__ 1 +__FXSR__ 1 +__SSE_MATH__ 1 +__SSE2_MATH__ 1 +__MMX_WITH_SSE__ 1 +__SEG_FS 1 +__SEG_GS 1 +__gnu_linux__ 1 +__linux 1 +__linux__ 1 +linux 1 +__unix 1 +__unix__ 1 +unix 1 +__ELF__ 1 +__DECIMAL_BID_FORMAT__ 1 +_GNU_SOURCE 1 +file /home/osandov/src/elfutils/tests/bar.cc + file /usr/include/stdc-predef.h + _STDC_PREDEF_H 1 + __STDC_IEC_559__ 1 + __STDC_IEC_60559_BFP__ 201404L + __STDC_IEC_559_COMPLEX__ 1 + __STDC_IEC_60559_COMPLEX__ 201404L + __STDC_ISO_10646__ 201706L + /file + file /home/osandov/src/elfutils/tests/foobar.h + FROB(x) ((x) ^ 0x2a2a2a2a) + FRY(x) ((x) * 0x100000001b3) + /file + ONE 1 +/file +CU main.cc +__STDC__ 1 +__cplusplus 201703L +__STDC_UTF_16__ 1 +__STDC_UTF_32__ 1 +__STDC_HOSTED__ 1 +__GNUC__ 14 +__GNUC_MINOR__ 0 +__GNUC_PATCHLEVEL__ 0 +__VERSION__ "14.0.0 20230920 (experimental)" +__ATOMIC_RELAXED 0 +__ATOMIC_SEQ_CST 5 +__ATOMIC_ACQUIRE 2 +__ATOMIC_RELEASE 3 +__ATOMIC_ACQ_REL 4 +__ATOMIC_CONSUME 1 +__OPTIMIZE__ 1 +__FINITE_MATH_ONLY__ 0 +_LP64 1 +__LP64__ 1 +__SIZEOF_INT__ 4 +__SIZEOF_LONG__ 8 +__SIZEOF_LONG_LONG__ 8 +__SIZEOF_SHORT__ 2 +__SIZEOF_FLOAT__ 4 +__SIZEOF_DOUBLE__ 8 +__SIZEOF_LONG_DOUBLE__ 16 +__SIZEOF_SIZE_T__ 8 +__CHAR_BIT__ 8 +__BIGGEST_ALIGNMENT__ 16 +__ORDER_LITTLE_ENDIAN__ 1234 +__ORDER_BIG_ENDIAN__ 4321 +__ORDER_PDP_ENDIAN__ 3412 +__BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +__FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__ +__SIZEOF_POINTER__ 8 +__GNUC_EXECUTION_CHARSET_NAME "UTF-8" +__GNUC_WIDE_EXECUTION_CHARSET_NAME "UTF-32LE" +__GNUG__ 14 +__SIZE_TYPE__ long unsigned int +__PTRDIFF_TYPE__ long int +__WCHAR_TYPE__ int +__WINT_TYPE__ unsigned int +__INTMAX_TYPE__ long int +__UINTMAX_TYPE__ long unsigned int +__CHAR16_TYPE__ short unsigned int +__CHAR32_TYPE__ unsigned int +__SIG_ATOMIC_TYPE__ int +__INT8_TYPE__ signed char +__INT16_TYPE__ short int +__INT32_TYPE__ int +__INT64_TYPE__ long int +__UINT8_TYPE__ unsigned char +__UINT16_TYPE__ short unsigned int +__UINT32_TYPE__ unsigned int +__UINT64_TYPE__ long unsigned int +__INT_LEAST8_TYPE__ signed char +__INT_LEAST16_TYPE__ short int +__INT_LEAST32_TYPE__ int +__INT_LEAST64_TYPE__ long int +__UINT_LEAST8_TYPE__ unsigned char +__UINT_LEAST16_TYPE__ short unsigned int +__UINT_LEAST32_TYPE__ unsigned int +__UINT_LEAST64_TYPE__ long unsigned int +__INT_FAST8_TYPE__ signed char +__INT_FAST16_TYPE__ long int +__INT_FAST32_TYPE__ long int +__INT_FAST64_TYPE__ long int +__UINT_FAST8_TYPE__ unsigned char +__UINT_FAST16_TYPE__ long unsigned int +__UINT_FAST32_TYPE__ long unsigned int +__UINT_FAST64_TYPE__ long unsigned int +__INTPTR_TYPE__ long int +__UINTPTR_TYPE__ long unsigned int +__GXX_WEAK__ 1 +__DEPRECATED 1 +__GXX_RTTI 1 +__cpp_rtti 199711L +__GXX_EXPERIMENTAL_CXX0X__ 1 +__cpp_binary_literals 201304L +__cpp_hex_float 201603L +__cpp_runtime_arrays 198712L +__cpp_raw_strings 200710L +__cpp_unicode_literals 200710L +__cpp_user_defined_literals 200809L +__cpp_lambdas 200907L +__cpp_decltype 200707L +__cpp_attributes 200809L +__cpp_rvalue_reference 200610L +__cpp_rvalue_references 200610L +__cpp_variadic_templates 200704L +__cpp_initializer_lists 200806L +__cpp_delegating_constructors 200604L +__cpp_nsdmi 200809L +__cpp_inheriting_constructors 201511L +__cpp_ref_qualifiers 200710L +__cpp_alias_templates 200704L +__cpp_return_type_deduction 201304L +__cpp_init_captures 201304L +__cpp_generic_lambdas 201304L +__cpp_decltype_auto 201304L +__cpp_aggregate_nsdmi 201304L +__cpp_variable_templates 201304L +__cpp_digit_separators 201309L +__cpp_unicode_characters 201411L +__cpp_static_assert 201411L +__cpp_namespace_attributes 201411L +__cpp_enumerator_attributes 201411L +__cpp_nested_namespace_definitions 201411L +__cpp_fold_expressions 201603L +__cpp_nontype_template_args 201411L +__cpp_range_based_for 201603L +__cpp_constexpr 201603L +__cpp_if_constexpr 201606L +__cpp_capture_star_this 201603L +__cpp_inline_variables 201606L +__cpp_aggregate_bases 201603L +__cpp_deduction_guides 201703L +__cpp_noexcept_function_type 201510L +__cpp_template_auto 201606L +__cpp_structured_bindings 201606L +__cpp_variadic_using 201611L +__cpp_guaranteed_copy_elision 201606L +__cpp_nontype_template_parameter_auto 201606L +__cpp_sized_deallocation 201309L +__cpp_aligned_new 201606L +__STDCPP_DEFAULT_NEW_ALIGNMENT__ 16 +__cpp_template_template_args 201611L +__cpp_threadsafe_static_init 200806L +__STDCPP_THREADS__ 1 +__EXCEPTIONS 1 +__cpp_exceptions 199711L +__GXX_ABI_VERSION 1019 +__SCHAR_MAX__ 0x7f +__SHRT_MAX__ 0x7fff +__INT_MAX__ 0x7fffffff +__LONG_MAX__ 0x7fffffffffffffffL +__LONG_LONG_MAX__ 0x7fffffffffffffffLL +__WCHAR_MAX__ 0x7fffffff +__WCHAR_MIN__ (-__WCHAR_MAX__ - 1) +__WINT_MAX__ 0xffffffffU +__WINT_MIN__ 0U +__PTRDIFF_MAX__ 0x7fffffffffffffffL +__SIZE_MAX__ 0xffffffffffffffffUL +__SCHAR_WIDTH__ 8 +__SHRT_WIDTH__ 16 +__INT_WIDTH__ 32 +__LONG_WIDTH__ 64 +__LONG_LONG_WIDTH__ 64 +__WCHAR_WIDTH__ 32 +__WINT_WIDTH__ 32 +__PTRDIFF_WIDTH__ 64 +__SIZE_WIDTH__ 64 +__GLIBCXX_TYPE_INT_N_0 __int128 +__GLIBCXX_BITSIZE_INT_N_0 128 +__INTMAX_MAX__ 0x7fffffffffffffffL +__INTMAX_C(c) c ## L +__UINTMAX_MAX__ 0xffffffffffffffffUL +__UINTMAX_C(c) c ## UL +__INTMAX_WIDTH__ 64 +__SIG_ATOMIC_MAX__ 0x7fffffff +__SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1) +__SIG_ATOMIC_WIDTH__ 32 +__INT8_MAX__ 0x7f +__INT16_MAX__ 0x7fff +__INT32_MAX__ 0x7fffffff +__INT64_MAX__ 0x7fffffffffffffffL +__UINT8_MAX__ 0xff +__UINT16_MAX__ 0xffff +__UINT32_MAX__ 0xffffffffU +__UINT64_MAX__ 0xffffffffffffffffUL +__INT_LEAST8_MAX__ 0x7f +__INT8_C(c) c +__INT_LEAST8_WIDTH__ 8 +__INT_LEAST16_MAX__ 0x7fff +__INT16_C(c) c +__INT_LEAST16_WIDTH__ 16 +__INT_LEAST32_MAX__ 0x7fffffff +__INT32_C(c) c +__INT_LEAST32_WIDTH__ 32 +__INT_LEAST64_MAX__ 0x7fffffffffffffffL +__INT64_C(c) c ## L +__INT_LEAST64_WIDTH__ 64 +__UINT_LEAST8_MAX__ 0xff +__UINT8_C(c) c +__UINT_LEAST16_MAX__ 0xffff +__UINT16_C(c) c +__UINT_LEAST32_MAX__ 0xffffffffU +__UINT32_C(c) c ## U +__UINT_LEAST64_MAX__ 0xffffffffffffffffUL +__UINT64_C(c) c ## UL +__INT_FAST8_MAX__ 0x7f +__INT_FAST8_WIDTH__ 8 +__INT_FAST16_MAX__ 0x7fffffffffffffffL +__INT_FAST16_WIDTH__ 64 +__INT_FAST32_MAX__ 0x7fffffffffffffffL +__INT_FAST32_WIDTH__ 64 +__INT_FAST64_MAX__ 0x7fffffffffffffffL +__INT_FAST64_WIDTH__ 64 +__UINT_FAST8_MAX__ 0xff +__UINT_FAST16_MAX__ 0xffffffffffffffffUL +__UINT_FAST32_MAX__ 0xffffffffffffffffUL +__UINT_FAST64_MAX__ 0xffffffffffffffffUL +__INTPTR_MAX__ 0x7fffffffffffffffL +__INTPTR_WIDTH__ 64 +__UINTPTR_MAX__ 0xffffffffffffffffUL +__GCC_IEC_559 2 +__GCC_IEC_559_COMPLEX 2 +__FLT_EVAL_METHOD__ 0 +__FLT_EVAL_METHOD_TS_18661_3__ 0 +__DEC_EVAL_METHOD__ 2 +__FLT_RADIX__ 2 +__FLT_MANT_DIG__ 24 +__FLT_DIG__ 6 +__FLT_MIN_EXP__ (-125) +__FLT_MIN_10_EXP__ (-37) +__FLT_MAX_EXP__ 128 +__FLT_MAX_10_EXP__ 38 +__FLT_DECIMAL_DIG__ 9 +__FLT_MAX__ 3.40282346638528859811704183484516925e+38F +__FLT_NORM_MAX__ 3.40282346638528859811704183484516925e+38F +__FLT_MIN__ 1.17549435082228750796873653722224568e-38F +__FLT_EPSILON__ 1.19209289550781250000000000000000000e-7F +__FLT_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F +__FLT_HAS_DENORM__ 1 +__FLT_HAS_INFINITY__ 1 +__FLT_HAS_QUIET_NAN__ 1 +__FLT_IS_IEC_60559__ 1 +__DBL_MANT_DIG__ 53 +__DBL_DIG__ 15 +__DBL_MIN_EXP__ (-1021) +__DBL_MIN_10_EXP__ (-307) +__DBL_MAX_EXP__ 1024 +__DBL_MAX_10_EXP__ 308 +__DBL_DECIMAL_DIG__ 17 +__DBL_MAX__ double(1.79769313486231570814527423731704357e+308L) +__DBL_NORM_MAX__ double(1.79769313486231570814527423731704357e+308L) +__DBL_MIN__ double(2.22507385850720138309023271733240406e-308L) +__DBL_EPSILON__ double(2.22044604925031308084726333618164062e-16L) +__DBL_DENORM_MIN__ double(4.94065645841246544176568792868221372e-324L) +__DBL_HAS_DENORM__ 1 +__DBL_HAS_INFINITY__ 1 +__DBL_HAS_QUIET_NAN__ 1 +__DBL_IS_IEC_60559__ 1 +__LDBL_MANT_DIG__ 64 +__LDBL_DIG__ 18 +__LDBL_MIN_EXP__ (-16381) +__LDBL_MIN_10_EXP__ (-4931) +__LDBL_MAX_EXP__ 16384 +__LDBL_MAX_10_EXP__ 4932 +__DECIMAL_DIG__ 21 +__LDBL_DECIMAL_DIG__ 21 +__LDBL_MAX__ 1.18973149535723176502126385303097021e+4932L +__LDBL_NORM_MAX__ 1.18973149535723176502126385303097021e+4932L +__LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L +__LDBL_EPSILON__ 1.08420217248550443400745280086994171e-19L +__LDBL_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951L +__LDBL_HAS_DENORM__ 1 +__LDBL_HAS_INFINITY__ 1 +__LDBL_HAS_QUIET_NAN__ 1 +__LDBL_IS_IEC_60559__ 1 +__FLT16_MANT_DIG__ 11 +__FLT16_DIG__ 3 +__FLT16_MIN_EXP__ (-13) +__FLT16_MIN_10_EXP__ (-4) +__FLT16_MAX_EXP__ 16 +__FLT16_MAX_10_EXP__ 4 +__FLT16_DECIMAL_DIG__ 5 +__FLT16_MAX__ 6.55040000000000000000000000000000000e+4F16 +__FLT16_NORM_MAX__ 6.55040000000000000000000000000000000e+4F16 +__FLT16_MIN__ 6.10351562500000000000000000000000000e-5F16 +__FLT16_EPSILON__ 9.76562500000000000000000000000000000e-4F16 +__FLT16_DENORM_MIN__ 5.96046447753906250000000000000000000e-8F16 +__FLT16_HAS_DENORM__ 1 +__FLT16_HAS_INFINITY__ 1 +__FLT16_HAS_QUIET_NAN__ 1 +__FLT16_IS_IEC_60559__ 1 +__FLT32_MANT_DIG__ 24 +__FLT32_DIG__ 6 +__FLT32_MIN_EXP__ (-125) +__FLT32_MIN_10_EXP__ (-37) +__FLT32_MAX_EXP__ 128 +__FLT32_MAX_10_EXP__ 38 +__FLT32_DECIMAL_DIG__ 9 +__FLT32_MAX__ 3.40282346638528859811704183484516925e+38F32 +__FLT32_NORM_MAX__ 3.40282346638528859811704183484516925e+38F32 +__FLT32_MIN__ 1.17549435082228750796873653722224568e-38F32 +__FLT32_EPSILON__ 1.19209289550781250000000000000000000e-7F32 +__FLT32_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F32 +__FLT32_HAS_DENORM__ 1 +__FLT32_HAS_INFINITY__ 1 +__FLT32_HAS_QUIET_NAN__ 1 +__FLT32_IS_IEC_60559__ 1 +__FLT64_MANT_DIG__ 53 +__FLT64_DIG__ 15 +__FLT64_MIN_EXP__ (-1021) +__FLT64_MIN_10_EXP__ (-307) +__FLT64_MAX_EXP__ 1024 +__FLT64_MAX_10_EXP__ 308 +__FLT64_DECIMAL_DIG__ 17 +__FLT64_MAX__ 1.79769313486231570814527423731704357e+308F64 +__FLT64_NORM_MAX__ 1.79769313486231570814527423731704357e+308F64 +__FLT64_MIN__ 2.22507385850720138309023271733240406e-308F64 +__FLT64_EPSILON__ 2.22044604925031308084726333618164062e-16F64 +__FLT64_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F64 +__FLT64_HAS_DENORM__ 1 +__FLT64_HAS_INFINITY__ 1 +__FLT64_HAS_QUIET_NAN__ 1 +__FLT64_IS_IEC_60559__ 1 +__FLT128_MANT_DIG__ 113 +__FLT128_DIG__ 33 +__FLT128_MIN_EXP__ (-16381) +__FLT128_MIN_10_EXP__ (-4931) +__FLT128_MAX_EXP__ 16384 +__FLT128_MAX_10_EXP__ 4932 +__FLT128_DECIMAL_DIG__ 36 +__FLT128_MAX__ 1.18973149535723176508575932662800702e+4932F128 +__FLT128_NORM_MAX__ 1.18973149535723176508575932662800702e+4932F128 +__FLT128_MIN__ 3.36210314311209350626267781732175260e-4932F128 +__FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34F128 +__FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F128 +__FLT128_HAS_DENORM__ 1 +__FLT128_HAS_INFINITY__ 1 +__FLT128_HAS_QUIET_NAN__ 1 +__FLT128_IS_IEC_60559__ 1 +__FLT32X_MANT_DIG__ 53 +__FLT32X_DIG__ 15 +__FLT32X_MIN_EXP__ (-1021) +__FLT32X_MIN_10_EXP__ (-307) +__FLT32X_MAX_EXP__ 1024 +__FLT32X_MAX_10_EXP__ 308 +__FLT32X_DECIMAL_DIG__ 17 +__FLT32X_MAX__ 1.79769313486231570814527423731704357e+308F32x +__FLT32X_NORM_MAX__ 1.79769313486231570814527423731704357e+308F32x +__FLT32X_MIN__ 2.22507385850720138309023271733240406e-308F32x +__FLT32X_EPSILON__ 2.22044604925031308084726333618164062e-16F32x +__FLT32X_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F32x +__FLT32X_HAS_DENORM__ 1 +__FLT32X_HAS_INFINITY__ 1 +__FLT32X_HAS_QUIET_NAN__ 1 +__FLT32X_IS_IEC_60559__ 1 +__FLT64X_MANT_DIG__ 64 +__FLT64X_DIG__ 18 +__FLT64X_MIN_EXP__ (-16381) +__FLT64X_MIN_10_EXP__ (-4931) +__FLT64X_MAX_EXP__ 16384 +__FLT64X_MAX_10_EXP__ 4932 +__FLT64X_DECIMAL_DIG__ 21 +__FLT64X_MAX__ 1.18973149535723176502126385303097021e+4932F64x +__FLT64X_NORM_MAX__ 1.18973149535723176502126385303097021e+4932F64x +__FLT64X_MIN__ 3.36210314311209350626267781732175260e-4932F64x +__FLT64X_EPSILON__ 1.08420217248550443400745280086994171e-19F64x +__FLT64X_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951F64x +__FLT64X_HAS_DENORM__ 1 +__FLT64X_HAS_INFINITY__ 1 +__FLT64X_HAS_QUIET_NAN__ 1 +__FLT64X_IS_IEC_60559__ 1 +__BFLT16_MANT_DIG__ 8 +__BFLT16_DIG__ 2 +__BFLT16_MIN_EXP__ (-125) +__BFLT16_MIN_10_EXP__ (-37) +__BFLT16_MAX_EXP__ 128 +__BFLT16_MAX_10_EXP__ 38 +__BFLT16_DECIMAL_DIG__ 4 +__BFLT16_MAX__ 3.38953138925153547590470800371487867e+38BF16 +__BFLT16_NORM_MAX__ 3.38953138925153547590470800371487867e+38BF16 +__BFLT16_MIN__ 1.17549435082228750796873653722224568e-38BF16 +__BFLT16_EPSILON__ 7.81250000000000000000000000000000000e-3BF16 +__BFLT16_DENORM_MIN__ 9.18354961579912115600575419704879436e-41BF16 +__BFLT16_HAS_DENORM__ 1 +__BFLT16_HAS_INFINITY__ 1 +__BFLT16_HAS_QUIET_NAN__ 1 +__BFLT16_IS_IEC_60559__ 0 +__DEC32_MANT_DIG__ 7 +__DEC32_MIN_EXP__ (-94) +__DEC32_MAX_EXP__ 97 +__DEC32_MIN__ 1E-95DF +__DEC32_MAX__ 9.999999E96DF +__DEC32_EPSILON__ 1E-6DF +__DEC32_SUBNORMAL_MIN__ 0.000001E-95DF +__DEC64_MANT_DIG__ 16 +__DEC64_MIN_EXP__ (-382) +__DEC64_MAX_EXP__ 385 +__DEC64_MIN__ 1E-383DD +__DEC64_MAX__ 9.999999999999999E384DD +__DEC64_EPSILON__ 1E-15DD +__DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD +__DEC128_MANT_DIG__ 34 +__DEC128_MIN_EXP__ (-6142) +__DEC128_MAX_EXP__ 6145 +__DEC128_MIN__ 1E-6143DL +__DEC128_MAX__ 9.999999999999999999999999999999999E6144DL +__DEC128_EPSILON__ 1E-33DL +__DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL +__REGISTER_PREFIX__ +__USER_LABEL_PREFIX__ +__GNUC_STDC_INLINE__ 1 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 +__GCC_ATOMIC_BOOL_LOCK_FREE 2 +__GCC_ATOMIC_CHAR_LOCK_FREE 2 +__GCC_ATOMIC_CHAR16_T_LOCK_FREE 2 +__GCC_ATOMIC_CHAR32_T_LOCK_FREE 2 +__GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 +__GCC_ATOMIC_SHORT_LOCK_FREE 2 +__GCC_ATOMIC_INT_LOCK_FREE 2 +__GCC_ATOMIC_LONG_LOCK_FREE 2 +__GCC_ATOMIC_LLONG_LOCK_FREE 2 +__GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 +__GCC_DESTRUCTIVE_SIZE 64 +__GCC_CONSTRUCTIVE_SIZE 64 +__GCC_ATOMIC_POINTER_LOCK_FREE 2 +__HAVE_SPECULATION_SAFE_VALUE 1 +__GCC_HAVE_DWARF2_CFI_ASM 1 +__PRAGMA_REDEFINE_EXTNAME 1 +__SIZEOF_INT128__ 16 +__SIZEOF_WCHAR_T__ 4 +__SIZEOF_WINT_T__ 4 +__SIZEOF_PTRDIFF_T__ 8 +__amd64 1 +__amd64__ 1 +__x86_64 1 +__x86_64__ 1 +__SIZEOF_FLOAT80__ 16 +__SIZEOF_FLOAT128__ 16 +__ATOMIC_HLE_ACQUIRE 65536 +__ATOMIC_HLE_RELEASE 131072 +__GCC_ASM_FLAG_OUTPUTS__ 1 +__k8 1 +__k8__ 1 +__code_model_small__ 1 +__MMX__ 1 +__SSE__ 1 +__SSE2__ 1 +__FXSR__ 1 +__SSE_MATH__ 1 +__SSE2_MATH__ 1 +__MMX_WITH_SSE__ 1 +__SEG_FS 1 +__SEG_GS 1 +__gnu_linux__ 1 +__linux 1 +__linux__ 1 +linux 1 +__unix 1 +__unix__ 1 +unix 1 +__ELF__ 1 +__DECIMAL_BID_FORMAT__ 1 +_GNU_SOURCE 1 +file /home/osandov/src/elfutils/tests/main.cc + file /usr/include/stdc-predef.h + _STDC_PREDEF_H 1 + __STDC_IEC_559__ 1 + __STDC_IEC_60559_BFP__ 201404L + __STDC_IEC_559_COMPLEX__ 1 + __STDC_IEC_60559_COMPLEX__ 201404L + __STDC_ISO_10646__ 201706L + /file + file /home/osandov/src/elfutils/tests/foobar.h + FROB(x) ((x) ^ 0x2a2a2a2a) + FRY(x) ((x) * 0x100000001b3) + /file + MAIN_ARGS int argc, char **argv +/file +EOF +done + exit 0 diff --git a/tests/run-get-units-split.sh b/tests/run-get-units-split.sh index 7a43c670..6c7a4f25 100755 --- a/tests/run-get-units-split.sh +++ b/tests/run-get-units-split.sh @@ -63,4 +63,22 @@ EOF testrun_on_self_exe ${abs_builddir}/get-units-split testrun_on_self_lib ${abs_builddir}/get-units-split +# See testfile-dwp.source. +testfiles testfile-dwp-5 testfile-dwp-5.dwp +testfiles testfile-dwp-4 testfile-dwp-4.dwp +testfiles testfile-dwp-4-strict testfile-dwp-4-strict.dwp + +for file in testfile-dwp-5 testfile-dwp-4 testfile-dwp-4-strict; do + testrun_compare ${abs_builddir}/get-units-split "$file" << EOF +file: $file +Got cudie unit_type: 4 +Found a skeleton unit, with split die: foo.cc +Got cudie unit_type: 4 +Found a skeleton unit, with split die: bar.cc +Got cudie unit_type: 4 +Found a skeleton unit, with split die: main.cc + +EOF +done + exit 0 diff --git a/tests/run-varlocs.sh b/tests/run-varlocs.sh index cbbcf6c7..4ac5f367 100755 --- a/tests/run-varlocs.sh +++ b/tests/run-varlocs.sh @@ -601,4 +601,116 @@ module 'testfile-splitdwarf4-not-split4.debug' [4011a0,4011a1) {lit0, stack_value} EOF +# See testfile-dwp.source. +testfiles testfile-dwp-5 testfile-dwp-5.dwp +testfiles testfile-dwp-4 testfile-dwp-4.dwp + +testrun_compare ${abs_builddir}/varlocs -e testfile-dwp-5 << EOF +module 'testfile-dwp-5' +[84] CU 'foo.cc'@401190 + [c6] function 'foo'@4011c0 + frame_base: {call_frame_cfa {bregx(7,8)}} + [e1] parameter 'this' + [4011c0,401200) {reg5} + [ea] variable 'x' + [4011c2,4011d4) {reg0} + [4011d4,4011d7) {reg1} + [4011d7,4011d9) {breg1(1), stack_value} + [4011f1,401200) {reg0} + [f9] inlined function 'x_x'@4011cb + [104] parameter 'x' + [4011cb,4011eb) {reg0} + [4011f1,401200) {reg0} + [14a] function 'x_x'@401190 + frame_base: {call_frame_cfa {bregx(7,8)}} + [15b] parameter 'x' + [401190,4011a1) {reg5} + [4011a1,4011bd) {reg0} +module 'testfile-dwp-5' +[1fa] CU 'bar.cc'@401200 + [23c] function 'bar'@401200 + frame_base: {call_frame_cfa {bregx(7,8)}} + [253] parameter 'this' + [401200,40121b) {reg5} +module 'testfile-dwp-5' +[272] CU 'main.cc'@0 + [2c7] function 'main'@401020 + frame_base: {call_frame_cfa {bregx(7,8)}} + [2e0] parameter 'argc' + [401020,401068) {reg5} + [401068,401080) {fbreg(-40)} + [401080,401084) {breg5(0)} + [401084,401099) {entry_value(1) {reg5}, stack_value} + [401099,4010a0) {reg5} + [2ec] parameter 'argv' + [401020,40104b) {reg4} + [40104b,401099) {entry_value(1) {reg4}, stack_value} + [401099,4010a0) {reg4} + [2f8] variable 'myfoo' + [401020,4010a0) {fbreg(-40)} + [303] variable 'mybar' + [401020,4010a0) {fbreg(-32)} + [30d] inlined function 'fibonacci'@401030 + [31c] parameter 'n' + [401030,401060) {reg5} + [401099,4010a0) {reg5} + [326] inlined function 'fibonacci' + [32f] parameter 'n' + +EOF + +testrun_compare ${abs_builddir}/varlocs -e testfile-dwp-4 << EOF +module 'testfile-dwp-4' +[b] CU 'foo.cc'@401190 + [54] function 'foo'@4011c0 + frame_base: {call_frame_cfa {bregx(7,8)}} + [6f] parameter 'this' + [4011c0,401200) {reg5} + [78] variable 'x' + [4011c2,4011d4) {reg0} + [4011d4,4011d7) {reg1} + [4011d7,4011d9) {breg1(1), stack_value} + [4011f1,401200) {reg0} + [8a] inlined function 'x_x'@4011cb + [98] parameter 'x' + [4011cb,4011eb) {reg0} + [4011f1,401200) {reg0} + [e7] function 'x_x'@401190 + frame_base: {call_frame_cfa {bregx(7,8)}} + [f8] parameter 'x' + [401190,4011a1) {reg5} + [4011a1,4011bd) {reg0} +module 'testfile-dwp-4' +[129] CU 'bar.cc'@401200 + [172] function 'bar'@401200 + frame_base: {call_frame_cfa {bregx(7,8)}} + [189] parameter 'this' + [401200,40121b) {reg5} +module 'testfile-dwp-4' +[19f] CU 'main.cc'@0 + [1fd] function 'main'@401020 + frame_base: {call_frame_cfa {bregx(7,8)}} + [216] parameter 'argc' + [401020,401068) {reg5} + [401068,401080) {fbreg(-40)} + [401080,401084) {breg5(0)} + [401084,401097) {GNU_entry_value(1) {reg5}, stack_value} + [401099,4010a0) {reg5} + [228] parameter 'argv' + [401020,40104b) {reg4} + [40104b,401099) {GNU_entry_value(1) {reg4}, stack_value} + [401099,4010a0) {reg4} + [23a] variable 'myfoo' + [401020,4010a0) {fbreg(-40)} + [247] variable 'mybar' + [401020,4010a0) {fbreg(-32)} + [253] inlined function 'fibonacci'@401030 + [265] parameter 'n' + [401030,401060) {reg5} + [401099,4010a0) {reg5} + [272] inlined function 'fibonacci' + [27e] parameter 'n' + +EOF + exit 0 From patchwork Wed Sep 27 18:21:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 76804 X-Patchwork-Delegate: mark@klomp.org 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 1CE003875DF2 for ; Wed, 27 Sep 2023 18:21:49 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id 0C9163856DD6 for ; Wed, 27 Sep 2023 18:21:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0C9163856DD6 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=osandov.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=osandov.com Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1c451541f23so93958765ad.2 for ; Wed, 27 Sep 2023 11:21:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1695838888; x=1696443688; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=m3b4weO5lENVz+HM9M0N37b3wP+fnUsrgsqtaqZZGQc=; b=uqXRj1zqd5SsJqhPZzMEvhG/GcZK6ZAd68SPhqU8k67HtLbYJx6bU/+GiNkOA0Zm1D Lev9CqPCVCO8OlKqYWCv0I2Z5+Tny/m+pZCXoB72F13AiNVjnNtlS+Y0lbiMNvO4BXVs ++wXVPacRhqKrjibu3iouUv3vdQzSIa9ZnMow63LVD1bN/NdSEM9f3Jx459/b8EbedM5 GGsNHhIN79nzBJ/6Y1gTy82Ul83v8bOwAbUQFGZfmlSCZhVyuZIQD/BzqIeul/8ykAHi bL6E2h7f7WuiyBOvkt/0YvJzqoMIdL9DoTt0uFeED2W79Tk/tfnHLJK2Uzoz/yJLAMIi efBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695838888; x=1696443688; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m3b4weO5lENVz+HM9M0N37b3wP+fnUsrgsqtaqZZGQc=; b=XRsR4GN9Ppel0VSTZDkKKLL6uzXh8xCX2XojDnzD0Fh1PaPJFMaIaRrbnx5D7Ush4T d77QftiScDEoo9NVp/icrIner0yarbZQ05qjdHd0M9Xm0tZe4XuwdQz4DMXTLH9/p9pf cVyiB22M2M38HTiucV4nAik7MIcv8N5z732q/aAX8kkhrBepn6x0/niE33fhH5vshwJv bLJT42HvjCgTN0/kbE2d27GJY33pUiqVjG5HALskKUVaHiH4f6+WVfBoHMW1TXsKHxuL iNI/tXo1e7cn9zV91uMvBx02EljPDVHGFMzY22LG2ahYv1Eqc//PXH9iri80+IEhfOKL CrCA== X-Gm-Message-State: AOJu0YzwU0RE7txMWFlMWHEBN3kSRN9QDH3zUSAikFrAXnYfkWw9GENJ LsKMzZEi0kmBIe+MR+VPjxxaq1M8iuKCvbzO1Z0pZw== X-Google-Smtp-Source: AGHT+IHd0BxU5YPUCJH50XILkY87Dkj2wiX4N2VpTxMmhmGW6QDC4BIOU6mzNvU+eTENbbu8c6uf+g== X-Received: by 2002:a17:902:ea02:b0:1c0:cb4d:df7c with SMTP id s2-20020a170902ea0200b001c0cb4ddf7cmr2767155plg.1.1695838887173; Wed, 27 Sep 2023 11:21:27 -0700 (PDT) Received: from telecaster.thefacebook.com ([2620:10d:c090:500::6:efab]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e81000b001bf6ea340a9sm13397842plg.159.2023.09.27.11.21.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:21:26 -0700 (PDT) From: Omar Sandoval To: elfutils-devel@sourceware.org Subject: [PATCH 14/14] libdw: Handle overflowed DW_SECT_INFO offsets in DWARF package file indexes Date: Wed, 27 Sep 2023 11:21:03 -0700 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_LOTSOFHASH, LOTS_OF_MONEY, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" From: Omar Sandoval Meta uses DWARF package files for our large, statically-linked C++ applications. Some of our largest applications have more than 4GB in .debug_info.dwo, but the section offsets in .debug_cu_index and .debug_tu_index are 32 bits; see the discussion here [1]. We implemented a workaround/extension for this in LLVM. Implement the equivalent in libdw. To test this, we need files with more than 4GB in .debug_info.dwo. I created these artificially by editing GCC's assembly output. They compress down to 6KB. I test them from run-large-elf-file.sh to take advantage of the existing checks for large file support. 1: https://discourse.llvm.org/t/dwarf-dwp-4gb-limit/63902. Signed-off-by: Omar Sandoval --- libdw/ChangeLog | 1 + libdw/dwarf_cu_dwp_section_info.c | 143 +++++++++++++- libdw/dwarf_end.c | 15 +- libdw/libdwP.h | 3 + tests/ChangeLog | 7 + tests/Makefile.am | 6 +- tests/run-large-elf-file.sh | 174 ++++++++++++++++++ tests/testfile-dwp-4-cu-index-overflow.bz2 | Bin 0 -> 4490 bytes .../testfile-dwp-4-cu-index-overflow.dwp.bz2 | Bin 0 -> 5584 bytes tests/testfile-dwp-5-cu-index-overflow.bz2 | Bin 0 -> 4544 bytes .../testfile-dwp-5-cu-index-overflow.dwp.bz2 | Bin 0 -> 5790 bytes tests/testfile-dwp-cu-index-overflow.source | 86 +++++++++ 12 files changed, 430 insertions(+), 5 deletions(-) create mode 100755 tests/testfile-dwp-4-cu-index-overflow.bz2 create mode 100644 tests/testfile-dwp-4-cu-index-overflow.dwp.bz2 create mode 100755 tests/testfile-dwp-5-cu-index-overflow.bz2 create mode 100644 tests/testfile-dwp-5-cu-index-overflow.dwp.bz2 create mode 100644 tests/testfile-dwp-cu-index-overflow.source new file mode 100644 index 0000000000000000000000000000000000000000..0718c1b2c40310655cdb78ae9859b7b682a5fcaf GIT binary patch literal 5584 zcmeHL`#aP98~@Bk8^eq-qZ(tjg@z%bcB1Au4G&Tl$>vZgdZZp9!a}1ttvg}bH$8x7XF>DF zbNn}Ty>L`akS+bRAHN^@zO?wZX@2R;#N<3#l1QZz+LaU_*h0Vy$_9_u+g!rI$HY&J za`{^Ci}96G;e5_q{3%VZxmCFoN))ZK)X|fzlm#l2ud0^H^;l)jiF_EkQd%i3tQ6Rk z%mDyM0#JZo#shMY-k)9g(xNqN8BeB50l-w5Y&i*%EEhpA!Q6k>{q)dVC|%V*iF*n?Glfft)cNVww%zZ4xY(hl0m!zz<9h^HEGIUt|hZql_* zq`w8PKUrrZ_gBt+J~OZK?&#W29$G!5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F;7y0N?V5<3ZnM6pH^!a(c ztb+*y3owh=vasyyeyflJ8@R%BWG%Ob`gK(3m#*7A#Pn~S=_fIPjt_l|{2t`XG_n)4 zgeYj|%cc@0%vZpc6|EZ2ZOQ5Hi@$=UnT+mUOw@WQY7Ul$TsHmUdC9eU{}C*;amA8I zQDPYuVW8~ejpcG@?8-BK5^%9A4D7C}%v~liYq9SM!?2A9&9hXmiFzR)`gD36h59nq zE0d=k?9}w8>}!$gO4&O8_72PqrNa7ihX|oJ=pu0#ytj^o>~;yhUSe-vy>qADc_pf@ zs-r1lIhK=?nX#ZT<=`3fB#q(9u-Y1fQ+Wxl;W{P&xlDk5?7!vaxuXDLjPT`Kb8`wo z+*PKx6UZ6dnmXg8dgoa)4*vN>yRU4Hm2hWP^90KNKVOTO%YFNE2GzrIKk4P?UVN1zg~9Me;B%9v@|-+x9|vBdvwGoSZbPu{-s*{ z3@MmO?NtObN8jFQwH@GZqR1BvYXG(&Jn+@fhHWbJ`c z`P+AeR$fbnky{tm91{d-TlynDQbj>>Ua^c3KN}cJ)D|s0!(M5xrV-SBhk&(W-UO9* ztF%|l6*g5|C=r3QJvSXavlk|?ZKc@`kIMBb|Qn`@z)3<cu_index and dwarf->tu_index. Free dwarf->elfpath. Free dwarf->dwp_dwarf and close dwarf->dwp_fd. (cu_free): Don't free split dbg if it is dwp_dwarf. + (dwarf_package_index_free): New function. * dwarf_error.c (errmsgs): Add DWARF_E_UNKNOWN_SECTION. * libdw.h (dwarf_cu_dwp_section_info): New declaration. * libdw.map (ELFUTILS_0.190): Add dwarf_cu_dwp_section_info. diff --git a/libdw/dwarf_cu_dwp_section_info.c b/libdw/dwarf_cu_dwp_section_info.c index 7bf08d9d..8999c382 100644 --- a/libdw/dwarf_cu_dwp_section_info.c +++ b/libdw/dwarf_cu_dwp_section_info.c @@ -30,6 +30,8 @@ # include #endif +#include + #include "libdwP.h" static Dwarf_Package_Index * @@ -161,6 +163,7 @@ __libdw_read_package_index (Dwarf *dbg, bool tu) index->indices = indices; index->section_offsets = section_offsets; index->section_sizes = section_sizes; + index->debug_info_offsets = NULL; return index; } @@ -177,6 +180,137 @@ __libdw_package_index (Dwarf *dbg, bool tu) if (index == NULL) return NULL; + /* Offsets in the section offset table are 32-bit unsigned integers. In + practice, the .debug_info.dwo section for very large executables can be + larger than 4GB. GNU dwp as of binutils 2.41 and llvm-dwp before LLVM 15 + both accidentally truncate offsets larger than 4GB. + + LLVM 15 detects the overflow and errors out instead; see LLVM commit + f8df8114715b ("[DWP][DWARF] Detect and error on debug info offset + overflow"). However, lldb in LLVM 16 supports using dwp files with + truncated offsets by recovering them directly from the unit headers in the + .debug_info.dwo section; see LLVM commit c0db06227721 ("[DWARFLibrary] Add + support to re-construct cu-index"). Since LLVM 17, the overflow error can + be turned into a warning instead; see LLVM commit 53a483cee801 ("[DWP] add + overflow check for llvm-dwp tools if offset overflow"). + + LLVM's support for > 4GB offsets is effectively an extension to the DWARF + package file format, which we implement here. The strategy is to walk the + unit headers in .debug_info.dwo in lockstep with the DW_SECT_INFO columns + in the section offset tables. As long as they are in the same order + (which they are in practice for both GNU dwp and llvm-dwp), we can + correlate the truncated offset and produce a corrected array of offsets. + + Note that this will be fixed properly in DWARF 6: + https://dwarfstd.org/issues/220708.2.html. */ + if (index->sections[DW_SECT_INFO - 1] != UINT32_MAX + && dbg->sectiondata[IDX_debug_info]->d_size > UINT32_MAX) + { + Dwarf_Package_Index *cu_index, *tu_index = NULL; + if (tu) + { + tu_index = index; + assert (dbg->cu_index == NULL); + cu_index = __libdw_read_package_index (dbg, false); + if (cu_index == NULL) + { + free(index); + return NULL; + } + } + else + { + cu_index = index; + if (dbg->sectiondata[IDX_debug_tu_index] != NULL + && dbg->sectiondata[IDX_debug_types] == NULL) + { + assert (dbg->tu_index == NULL); + tu_index = __libdw_read_package_index (dbg, true); + if (tu_index == NULL) + { + free(index); + return NULL; + } + } + } + + cu_index->debug_info_offsets = malloc (cu_index->unit_count + * sizeof (Dwarf_Off)); + if (cu_index->debug_info_offsets == NULL) + { + free (tu_index); + free (cu_index); + __libdw_seterrno (DWARF_E_NOMEM); + return NULL; + } + if (tu_index != NULL) + { + tu_index->debug_info_offsets = malloc (tu_index->unit_count + * sizeof (Dwarf_Off)); + if (tu_index->debug_info_offsets == NULL) + { + free (tu_index); + free (cu_index->debug_info_offsets); + free (cu_index); + __libdw_seterrno (DWARF_E_NOMEM); + return NULL; + } + } + + Dwarf_Off off = 0; + uint32_t cui = 0, tui = 0; + uint32_t cu_count = cu_index->unit_count; + const unsigned char *cu_offset + = cu_index->section_offsets + cu_index->sections[DW_SECT_INFO - 1] * 4; + uint32_t tu_count = 0; + const unsigned char *tu_offset; + if (tu_index != NULL) + { + tu_count = tu_index->unit_count; + tu_offset = tu_index->section_offsets + + tu_index->sections[DW_SECT_INFO - 1] * 4; + } + while (cui < cu_count || tui < tu_count) + { + Dwarf_Off next_off; + uint8_t unit_type; + if (__libdw_next_unit (dbg, false, off, &next_off, NULL, NULL, + &unit_type, NULL, NULL, NULL, NULL, NULL) + != 0) + { + not_sorted: + free (cu_index->debug_info_offsets); + cu_index->debug_info_offsets = NULL; + if (tu_index != NULL) + { + free (tu_index->debug_info_offsets); + tu_index->debug_info_offsets = NULL; + } + break; + } + if (unit_type != DW_UT_split_type && cui < cu_count) + { + if ((off & UINT32_MAX) != read_4ubyte_unaligned (dbg, cu_offset)) + goto not_sorted; + cu_index->debug_info_offsets[cui++] = off; + cu_offset += cu_index->section_count * 4; + } + else if (unit_type == DW_UT_split_type && tui < tu_count) + { + if ((off & UINT32_MAX) != read_4ubyte_unaligned (dbg, tu_offset)) + goto not_sorted; + tu_index->debug_info_offsets[tui++] = off; + tu_offset += tu_index->section_count * 4; + } + off = next_off; + } + + if (tu) + dbg->cu_index = cu_index; + else if (tu_index != NULL) + dbg->tu_index = tu_index; + } + if (tu) dbg->tu_index = index; else @@ -244,8 +378,13 @@ __libdw_dwp_section_info (Dwarf_Package_Index *index, uint32_t unit_row, size_t i = (size_t)(unit_row - 1) * index->section_count + index->sections[section - 1]; if (offsetp != NULL) - *offsetp = read_4ubyte_unaligned (index->dbg, - index->section_offsets + i * 4); + { + if (section == DW_SECT_INFO && index->debug_info_offsets != NULL) + *offsetp = index->debug_info_offsets[unit_row - 1]; + else + *offsetp = read_4ubyte_unaligned (index->dbg, + index->section_offsets + i * 4); + } if (sizep != NULL) *sizep = read_4ubyte_unaligned (index->dbg, index->section_sizes + i * 4); diff --git a/libdw/dwarf_end.c b/libdw/dwarf_end.c index 78224ddb..ed8d27be 100644 --- a/libdw/dwarf_end.c +++ b/libdw/dwarf_end.c @@ -40,6 +40,17 @@ #include "cfi.h" +static void +dwarf_package_index_free (Dwarf_Package_Index *index) +{ + if (index != NULL) + { + free (index->debug_info_offsets); + free (index); + } +} + + static void noop_free (void *arg __attribute__ ((unused))) { @@ -79,8 +90,8 @@ dwarf_end (Dwarf *dwarf) { if (dwarf != NULL) { - free (dwarf->tu_index); - free (dwarf->cu_index); + dwarf_package_index_free (dwarf->tu_index); + dwarf_package_index_free (dwarf->cu_index); if (dwarf->cfi != NULL) /* Clean up the CFI cache. */ diff --git a/libdw/libdwP.h b/libdw/libdwP.h index bdbf5e5a..422e7bb8 100644 --- a/libdw/libdwP.h +++ b/libdw/libdwP.h @@ -371,6 +371,9 @@ typedef struct Dwarf_Package_Index_s const unsigned char *indices; const unsigned char *section_offsets; const unsigned char *section_sizes; + /* If DW_SECT_INFO section offsets were truncated to 32 bits, recovered + 64-bit offsets. */ + Dwarf_Off *debug_info_offsets; } Dwarf_Package_Index; /* Used in GNU DebugFission for DWARF 4. Reserved in DWARF 5. */ diff --git a/tests/ChangeLog b/tests/ChangeLog index 93503f57..d899cac8 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -26,6 +26,13 @@ testfile-dwp-4-strict. * run-get-units-split.sh: Check testfile-dwp-5, testfile-dwp-4, and testfile-dwp-4-strict. + * testfile-dwp-4-cu-index-overflow.bz2: New test file. + * testfile-dwp-4-cu-index-overflow.dwp.bz2: New test file. + * testfile-dwp-5-cu-index-overflow.bz2: New test file. + * testfile-dwp-5-cu-index-overflow.dwp.bz2: New test file. + * testfile-dwp-cu-index-overflow.source: New file. + * run-large-elf-file.sh: Check testfile-dwp-5-cu-index-overflow and + testfile-dwp-4-cu-index-overflow. 2023-04-21 Frank Ch. Eigler diff --git a/tests/Makefile.am b/tests/Makefile.am index 0938882b..c62e7d4c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -633,7 +633,11 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \ testfile-dwp-4.bz2 testfile-dwp-4.dwp.bz2 \ testfile-dwp-4-strict.bz2 testfile-dwp-4-strict.dwp.bz2 \ testfile-dwp-5.bz2 testfile-dwp-5.dwp.bz2 testfile-dwp.source \ - run-cu-dwp-section-info.sh + run-cu-dwp-section-info.sh testfile-dwp-5-cu-index-overflow \ + testfile-dwp-5-cu-index-overflow.dwp \ + testfile-dwp-4-cu-index-overflow \ + testfile-dwp-4-cu-index-overflow.dwp \ + testfile-dwp-cu-index-overflow.source if USE_VALGRIND diff --git a/tests/run-large-elf-file.sh b/tests/run-large-elf-file.sh index 7116de53..8108cb4b 100755 --- a/tests/run-large-elf-file.sh +++ b/tests/run-large-elf-file.sh @@ -122,4 +122,178 @@ test_file testfile38 # 64bit, big endian, non-rel test_file testfile27 +# See testfile-dwp-cu-index-overflow.source +testfiles testfile-dwp-5-cu-index-overflow testfile-dwp-5-cu-index-overflow.dwp + +testrun_compare ${abs_builddir}/cu-dwp-section-info testfile-dwp-5-cu-index-overflow.dwp << EOF +file: testfile-dwp-5-cu-index-overflow.dwp +INFO: 0x0 0x8000004c +TYPES: 0x0 0x0 +ABBREV: 0x0 0x50 +LINE: 0x0 0x61 +LOCLISTS: 0x0 0x0 +STR_OFFSETS: 0x0 0x1c +MACRO: 0x0 0x0 +RNGLISTS: 0x0 0x0 + +INFO: 0x8000004c 0x6f +TYPES: 0x0 0x0 +ABBREV: 0x50 0x15e +LINE: 0x61 0x63 +LOCLISTS: 0x0 0xd4 +STR_OFFSETS: 0x1c 0x24 +MACRO: 0x0 0x0 +RNGLISTS: 0x0 0x22 + +INFO: 0x800000bb 0xff +TYPES: 0x0 0x0 +ABBREV: 0x50 0x15e +LINE: 0x61 0x63 +LOCLISTS: 0x0 0xd4 +STR_OFFSETS: 0x1c 0x24 +MACRO: 0x0 0x0 +RNGLISTS: 0x0 0x22 + +INFO: 0x800001ba 0x8000004c +TYPES: 0x0 0x0 +ABBREV: 0x1ae 0x50 +LINE: 0xc4 0x61 +LOCLISTS: 0x0 0x0 +STR_OFFSETS: 0x40 0x1c +MACRO: 0x0 0x0 +RNGLISTS: 0x0 0x0 + +INFO: 0x100000206 0x6c +TYPES: 0x0 0x0 +ABBREV: 0x1fe 0xc8 +LINE: 0x125 0x63 +LOCLISTS: 0x0 0x0 +STR_OFFSETS: 0x5c 0x20 +MACRO: 0x0 0x0 +RNGLISTS: 0x0 0x0 + +INFO: 0x100000272 0x6f +TYPES: 0x0 0x0 +ABBREV: 0x1fe 0xc8 +LINE: 0x125 0x63 +LOCLISTS: 0x0 0x0 +STR_OFFSETS: 0x5c 0x20 +MACRO: 0x0 0x0 +RNGLISTS: 0x0 0x0 + +INFO: 0x1000002e1 0x182 +TYPES: 0x0 0x0 +ABBREV: 0x2c6 0x188 +LINE: 0x188 0x65 +LOCLISTS: 0xd4 0xee +STR_OFFSETS: 0x7c 0x44 +MACRO: 0x0 0x0 +RNGLISTS: 0x22 0x43 + +EOF + +testrun_compare ${abs_builddir}/get-units-split testfile-dwp-5-cu-index-overflow << EOF +file: testfile-dwp-5-cu-index-overflow +Got cudie unit_type: 4 +Found a skeleton unit, with split die: filler1.cc +Got cudie unit_type: 4 +Found a skeleton unit, with split die: foo.cc +Got cudie unit_type: 4 +Found a skeleton unit, with split die: filler2.cc +Got cudie unit_type: 4 +Found a skeleton unit, with split die: bar.cc +Got cudie unit_type: 4 +Found a skeleton unit, with split die: main.cc + +EOF + +rm -f testfile-dwp-5-cu-index-overflow testfile-dwp-5-cu-index-overflow.dwp + +# See testfile-dwp-cu-index-overflow.source +testfiles testfile-dwp-4-cu-index-overflow testfile-dwp-4-cu-index-overflow.dwp + +testrun_compare ${abs_builddir}/cu-dwp-section-info testfile-dwp-4-cu-index-overflow.dwp << EOF +file: testfile-dwp-4-cu-index-overflow.dwp +INFO: 0x0 0x8000004b +TYPES: 0x0 0x0 +ABBREV: 0x0 0x58 +LINE: 0x0 0x2c +LOCLISTS: 0x0 0x0 +STR_OFFSETS: 0x0 0x14 +MACRO: 0x0 0x0 +RNGLISTS: 0x0 0x0 + +INFO: 0x8000004b 0x116 +TYPES: 0x0 0x0 +ABBREV: 0x58 0x16f +LINE: 0x2c 0x34 +LOCLISTS: 0x0 0x110 +STR_OFFSETS: 0x14 0x1c +MACRO: 0x0 0x0 +RNGLISTS: 0x0 0x0 + +INFO: 0x80000161 0x8000004b +TYPES: 0x0 0x0 +ABBREV: 0x1c7 0x58 +LINE: 0x60 0x2c +LOCLISTS: 0x0 0x0 +STR_OFFSETS: 0x30 0x14 +MACRO: 0x0 0x0 +RNGLISTS: 0x0 0x0 + +INFO: 0x1000001ac 0x6e +TYPES: 0x0 0x0 +ABBREV: 0x21f 0xd4 +LINE: 0x8c 0x34 +LOCLISTS: 0x0 0x0 +STR_OFFSETS: 0x44 0x18 +MACRO: 0x0 0x0 +RNGLISTS: 0x0 0x0 + +INFO: 0x10000021a 0x1b5 +TYPES: 0x0 0x0 +ABBREV: 0x2f3 0x19b +LINE: 0xc0 0x35 +LOCLISTS: 0x110 0x12a +STR_OFFSETS: 0x5c 0x3c +MACRO: 0x0 0x0 +RNGLISTS: 0x0 0x0 + +INFO: 0x0 0x0 +TYPES: 0x0 0x6e +ABBREV: 0x58 0x16f +LINE: 0x2c 0x34 +LOCLISTS: 0x0 0x110 +STR_OFFSETS: 0x14 0x1c +MACRO: 0x0 0x0 +RNGLISTS: 0x0 0x0 + +INFO: 0x0 0x0 +TYPES: 0x6e 0x6b +ABBREV: 0x21f 0xd4 +LINE: 0x8c 0x34 +LOCLISTS: 0x0 0x0 +STR_OFFSETS: 0x44 0x18 +MACRO: 0x0 0x0 +RNGLISTS: 0x0 0x0 + +EOF + +testrun_compare ${abs_builddir}/get-units-split testfile-dwp-4-cu-index-overflow << EOF +file: testfile-dwp-4-cu-index-overflow +Got cudie unit_type: 4 +Found a skeleton unit, with split die: filler1.cc +Got cudie unit_type: 4 +Found a skeleton unit, with split die: foo.cc +Got cudie unit_type: 4 +Found a skeleton unit, with split die: filler2.cc +Got cudie unit_type: 4 +Found a skeleton unit, with split die: bar.cc +Got cudie unit_type: 4 +Found a skeleton unit, with split die: main.cc + +EOF + +rm -f testfile-dwp-4-cu-index-overflow testfile-dwp-4-cu-index-overflow.dwp + exit 0 diff --git a/tests/testfile-dwp-4-cu-index-overflow.bz2 b/tests/testfile-dwp-4-cu-index-overflow.bz2 new file mode 100755 index 0000000000000000000000000000000000000000..2aaa4f40b8d0bacf75f617a9ad642a6ead10a6ef GIT binary patch literal 4490 zcmV;55q0iDT4*^jL0KkKS;k-Cc>o)=|NsC0|NZ~}|NsC0|NH;{|M&kt?f>n5|9$`N z=j{Lg|9{{RZ`Bs^2d%5OzKMLb0Eo+Q)KW~0duQKmt)4^zn+Jxq^K#M(_gL7+CF>SzJ9jT${e zBh(Cl^#Bb6)M9#`q2(HEpwR**YBFg(O&cJlnx2y<>Kac_dYeQ%lT1hIPt=X5dV^{- zdYJ$NAT$7afHcqm4^g3rWXKHw4F{+I00w{&Q^7>k%|;Uw6GoT-m=g%ZGHHNJCYoYk z353F8dWHmPp^=Gzn3)WkX^_atiG*N=34jP`h|?oOK~(h+4FC-Q000000000000000 z000000000000000004?eAOdNrJtwr&MLja7=}#%NG(*K10MX?%3_}5-HiJa;o}kI< zH1tf=^qCl*P;C(P0ku6wnqi13LDgFc{I?; zNv3HuXnJZrN2XBGp^2uM8eudUGypUJ&;g)i8fX9+00006f!09)9xqk3^8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Mt~A)?_a8F8@e(796+*sM!DR&mNZG19AaU zN;EnQ<2CCxAL=7<6@DxijGzp#4Nbqavjzit0QZ0v>3~X{?^D14BK?Zj!*!lNW0aD7 zf6DIMbT)?C%sTkK^}GNL@C9ao1r;@qRL)&)8~i&;_S8}6`EI7r$CPCNUAmm;@svd4 zS7|vet2A&f5YfJ8Z6OrF-O@g|pZH03aa%{~I}^~)vP<&`d>_G9IZ{Q!Ri#bQD$-AM zx+RBlugWUZjI9DD%0k*U79A=COL+TMrb8N93X~h^lys2fQvT)Phq)GWj$(QenVL0W)z_k~y3< z0@4OSq@-?a7ziLLfw+12b|(Z|Wo?KSUBL zqfv!)luvsr21Qh6#I2kqQ&E-t0Ik(tgBrf~1! z1lWo?XgOWnZWPH+Fam-mnLEC=`Ea1igOw8Y_j`vLh8^E@|>#e{fbW5DT|4^0OefR+@x;IVEAe z@QBFI*BwJh2V}^F@=YnIuCqsx{_wV~heC;fLZmfHb$bi<3BU-*!^m-$h)P=$EA1Jw z+upPYWFkXSJt7KIyI`W4%A;*Dg{>el)8K?j6D{IGRV8&~7pQv*#Y9U$8=cxf9ViIu zNQMRefeB)7Z~=)c8C_KH_B-Ep2B7Z6)BUyuEZNKZZu;lw!bT_C#8ZJAI)1x5N{cE; zFVY((7#AszH1cHL>GoTC8T`v` zKS`GP?A+?9b5SVn+GC(+o2FTbL5=4;-P~N_Q10HFislyUmTw7h8(ttWzHNrDx#Sw= z#NI!I$C+v&j&j^k%c7M0%cgYkX3?8M5LZaG-Tvo&%w1Xoxz>% literal 0 HcmV?d00001 diff --git a/tests/testfile-dwp-4-cu-index-overflow.dwp.bz2 b/tests/testfile-dwp-4-cu-index-overflow.dwp.bz2 diff --git a/tests/testfile-dwp-5-cu-index-overflow.bz2 b/tests/testfile-dwp-5-cu-index-overflow.bz2 new file mode 100755 index 0000000000000000000000000000000000000000..07185fe56fcbfcf9a6fa01e6ef9428fee3843f34 GIT binary patch literal 4544 zcmV;x5kKxiT4*^jL0KkKS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{fy>GpZq5S$KL4!L(BRlTI~5lj53JeOc2K>RBPAk`+>3 z%PQFEA%S(&UBF6u2vMSgB6Pq=B1qH-(6!JDZ0H(^WF)YFRg-|sNiAIK6r*qu8v}Ae zvmEZK`XpTxWUQG_S|Lb;)*)tQ5B1F${{;@8fjSE=i65>$3=-eQPgvWXzW#A(Dvq6-48E)cX4zex2W zODwuU+8eP3F+k48eT#YlJ{Jb!&1x#3pj~DxS+t8jp(!F@a1$$55eJ*7w38V?Z-rn3 zhQhfd*4uyse_52olCU)7klu{#?7;x%UIdmS46>r}uwQd$TuEpaj(5GvX|1Z#RqZ+9 z174x8%n-auj1`Oe@Bk22Aj5h?1Pli`e>Nm=p-A%q7KTQH85dBJN60-C;8sEYq#0($ld>n9RctZWvN zx~9z4NZ?fgx&f!C5s)@Y(p13+TNgyPfE2Jah#_ZTSp*7QGD>CAh78JT{B?stjI#l+ zfCC=FsDx$CZckp4_~|NP6B9z4=^1Y7lhY?A1@pw%+im3F(o=wRZ`=L$7&849XL^5m zuW*bPs2MKg6Kql;!datlwc}CIqTL{Xb6c~0+oWrp_YwTa$7lQ2I!I%h5=NP z>H324V6S*!z4;wbyxa$lM8bB;FAacWnwBNEa@kfm`ew0Tl$TGVCI!Tq;*)P96d$^ zG>fAG<*W(tms)v)Zb|{KCGEh8e*OrU0L+S%66PjyFjt|sa#({7=gWFF%+k0Mi+?xM zYB5XzR_;84DIJ&>3`z8JQkgu?8r0@Z^U6?|f-)fbtJ^3K633kW`PwAXQ%ZM34+@?u zJI9_9=h0AxmJOJufT`gr-Tc5PkgBaTK;I$lK6{l+oXDyii+RM#e_G6#Br@8*uwn%q z|F)gd{?nHz3J}qe)JYi+qVtC?l5euFGKfkg2reLyL filler$i.cc; done +$ g++ -O2 -g -gsplit-dwarf -fdebug-types-section -dA -S filler{1,2}.cc foo.cc bar.cc main.cc +# Patch the DWARF blocks to be 2GB. +$ for (( i = 1; i <= 2; i++ )); do patch -p1 << EOF +--- a/filler$i.s ++++ b/filler$i.s +@@ -7,5 +7,5 @@ + .section .debug_info.dwo,"e",@progbits + .Ldebug_info0: +- .long 0x49 # Length of Compilation Unit Info ++ .long 0x80000048 # Length of Compilation Unit Info + .value 0x5 # DWARF version number + .byte 0x5 # DW_UT_split_compile +@@ -51,9 +51,6 @@ + .long 0x29 # DW_AT_type + # DW_AT_const_expr +- .byte 0x4 # DW_AT_const_value +- .byte 0x1 # fp or vector constant word 0 +- .byte 0 # fp or vector constant word 1 +- .byte 0 # fp or vector constant word 2 +- .byte 0 # fp or vector constant word 3 ++ .long 0x80000000 # DW_AT_const_value ++ .fill 0x80000000 + .byte 0 # end of children of DIE 0x14 + .section .debug_info,"",@progbits +@@ -171,5 +168,5 @@ + .uleb128 0x19 # (DW_FORM_flag_present) + .uleb128 0x1c # (DW_AT_const_value) +- .uleb128 0xa # (DW_FORM_block1) ++ .uleb128 0x4 # (DW_FORM_block4) + .byte 0 + .byte 0 +EOF +done +$ for (( i = 1; i <= 2; i++ )); do as filler$i.s -o filler$i.o; done +$ as foo.s -o foo.o +$ as bar.s -o bar.o +$ as main.s -o main.o +$ g++ filler1.o foo.o filler2.o bar.o main.o -o testfile-dwp-5-cu-index-overflow +# -continue-on-cu-index-overflow was added in LLVM 17: +# https://reviews.llvm.org/D144565. +$ llvm-dwp -continue-on-cu-index-overflow filler1.o foo.o filler2.o bar.o main.o -o testfile-dwp-5-cu-index-overflow.dwp + +# Same thing for DWARF 4. +$ g++ -O2 -g -gdwarf-4 -gsplit-dwarf -fdebug-types-section -dA -S filler{1,2}.cc foo.cc bar.cc main.cc +$ for (( i = 1; i <= 2; i++ )); do patch -p1 << EOF +--- a/filler$i.s ++++ b/filler$i.s +@@ -6,5 +6,5 @@ + .section .debug_info.dwo,"e",@progbits + .Ldebug_info0: +- .long 0x48 # Length of Compilation Unit Info ++ .long 0x80000047 # Length of Compilation Unit Info + .value 0x4 # DWARF version number + .long .Ldebug_abbrev0 # Offset Into Abbrev. Section +@@ -49,9 +49,6 @@ + .long 0x28 # DW_AT_type + # DW_AT_const_expr +- .byte 0x4 # DW_AT_const_value +- .byte 0x1 # fp or vector constant word 0 +- .byte 0 # fp or vector constant word 1 +- .byte 0 # fp or vector constant word 2 +- .byte 0 # fp or vector constant word 3 ++ .long 0x80000000 # DW_AT_const_value ++ .fill 0x80000000 + .byte 0 # end of children of DIE 0xb + .section .debug_info,"",@progbits +@@ -172,5 +169,5 @@ + .uleb128 0x19 # (DW_FORM_flag_present) + .uleb128 0x1c # (DW_AT_const_value) +- .uleb128 0xa # (DW_FORM_block1) ++ .uleb128 0x4 # (DW_FORM_block4) + .byte 0 + .byte 0 +EOF +done +$ for (( i = 1; i <= 2; i++ )); do as filler$i.s -o filler$i.o; done +$ as foo.s -o foo.o +$ as bar.s -o bar.o +$ as main.s -o main.o +$ g++ filler1.o foo.o filler2.o bar.o main.o -o testfile-dwp-4-cu-index-overflow +$ llvm-dwp -continue-on-cu-index-overflow filler1.o foo.o filler2.o bar.o main.o -o testfile-dwp-4-cu-index-overflow.dwp