From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 649DA3858C5E for ; Wed, 27 Sep 2023 18:21:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 649DA3858C5E 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-1c5c91bece9so94065255ad.3 for ; Wed, 27 Sep 2023 11:21:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1695838873; x=1696443673; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=jMovEEkw1GT6Biu/m522Pyu9e+sIHDB7reNnjLDD3Xg=; b=P+7iZPTBydXAxxlPIH0bTAIlFla/0Z9thTAu2/v0RqJS9C+SLSvZPRdCAussWu9xpW qGA16oPZkxtSA2TpqFBomjVvjZtGwZuCRXfhcn5xM8zGnoN4ppju6WZKHGwlO9vfPfit GtlveHgWMQ3bbFEeJ/qrpI6frbizJay2n2easkuxYiF+P+cJ46/w9xRgJPVD7wAO6Mh6 CjrLGp9nSp03OOgbYG4SNkFrkY136YsSGmivQMD31PZKz9w6Sibli8SQwR7HrtydRpzx DQCmea/QxMtGNYc8dIfe4E/GfrOBCIJ6XaoPMHoDiSxEzkePnoX+AJGGCEUjp1BL2/rt OH9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695838873; x=1696443673; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jMovEEkw1GT6Biu/m522Pyu9e+sIHDB7reNnjLDD3Xg=; b=CzQ2is4CC3VAOD+YpexS6MLyCaX4NdQQpDQVjoaqVVjEH1miC3KD9iqnVuBLkQBor9 xldsJ9jBLYghhSw53WQ+jvgfMV/4eFgp5hfWhdnAZk//S+qAyzXieFRLurz1TZOxAlNk O5JTqxAfoE18w0vEH4y+QwCERojfqWBwzKrtTOodQ57B3BdLMvEdzUYlqqDCt4I9xowK K+CBZEIPb37P6syrMUzoO2x5Xy8aNwCf7a3FayKLT/ZTr16hneMA44VJn6taWlBQj1lb QNUbmrewUsygFdz3vN0aoO20r9WqaoChaMp5srrS64fqOwwHCoVvDEPZJQm/bm9uVDzM y6Bw== X-Gm-Message-State: AOJu0YymDZoBU3MMtDesobIAAF/udXM6A12GzSHIWDqkJ/wJK4GxnsEh dJk15rmvIkjnfYU2EcSV095AASvuU8Axfy7TO0W4Ww== X-Google-Smtp-Source: AGHT+IEIJ+TwoNBOE1TUsd6QjavQlTQf7Wo02w1GrnWQeCNCf3PyUNn3wTJ5mjliqpTG/ao9qSfgsA== X-Received: by 2002:a17:903:41cb:b0:1c5:fa2d:b251 with SMTP id u11-20020a17090341cb00b001c5fa2db251mr3088647ple.5.1695838872968; Wed, 27 Sep 2023 11:21:12 -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.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:21:12 -0700 (PDT) From: Omar Sandoval To: elfutils-devel@sourceware.org Subject: [PATCH 00/14] elfutils: DWARF package (.dwp) file support Date: Wed, 27 Sep 2023 11:20:49 -0700 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,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 List-Id: From: Omar Sandoval Hi, This patch series adds support for DWARF package files to libdw and the elfutils tools. It supports the GNU DebugFission format for DWARF 4 [1] and the format standardized in DWARF 5 (section 7.3.5 "DWARF Package Files"). It supports both automatically opening the .dwp file for a skeleton unit and examining the .dwp file alone, just like for .dwo files. Patch 1 is a trivial cleanup I found while developing this. Patches 2-6 are fixes for unrelated bugs in split DWARF and/or DWARF 5 that I encountered while adding test cases for this series. I didn't add test cases explicitly for those fixes because they are covered by the dwp tests later in the series. The actual dwp support is in patches 7-10 and 13, including test cases. Patches 11 and 12 enable testing macro information in dwp files. Patch 14 adds support and tests for an LLVM extension to the dwp format. More details in the individual commit messages. Thanks! Omar P.S. drgn's dwp branch [2] demonstrates how the new dwarf_cu_dwp_section_info function will be used. With this patch series, drgn's test suite passes against a Linux kernel build using .dwp. 1: https://gcc.gnu.org/wiki/DebugFissionDWP 2: https://github.com/osandov/drgn/tree/dwp Omar Sandoval (14): libdw: Make try_split_file static libdw: Handle split DWARF in dwarf_entrypc libdw: Handle DW_AT_ranges in split DWARF 5 skeleton in dwarf_ranges libdw: Handle other string forms in dwarf_macro_param2 libdw: Fix dwarf_macro_getsrcfiles for DWARF 5 libdw: Handle split DWARF in dwarf_macro_getsrcfiles libdw: Recognize .debug_[ct]u_index sections in dwarf_elf_begin libdw: Parse DWARF package file index sections libdw, libdwfl: Save original path of ELF file libdw: Try .dwp file in __libdw_find_split_unit() tests: Handle DW_MACRO_{define,undef}_{strx,sup} in dwarf-getmacros tests: Optionally dump all units in dwarf-getmacros libdw: Apply DWARF package file section offsets where appropriate libdw: Handle overflowed DW_SECT_INFO offsets in DWARF package file indexes libdw/ChangeLog | 72 + libdw/Makefile.am | 2 +- libdw/dwarf_begin_elf.c | 88 +- libdw/dwarf_cu_dwp_section_info.c | 529 ++++++ libdw/dwarf_end.c | 27 +- libdw/dwarf_entrypc.c | 12 +- libdw/dwarf_error.c | 1 + libdw/dwarf_getlocation.c | 6 + libdw/dwarf_getmacros.c | 54 +- libdw/dwarf_macro_getsrcfiles.c | 8 +- libdw/dwarf_macro_param2.c | 21 +- libdw/dwarf_ranges.c | 4 +- libdw/libdw.h | 23 + libdw/libdw.map | 5 + libdw/libdwP.h | 112 +- libdw/libdw_find_split_unit.c | 77 +- libdw/libdw_findcu.c | 8 + libdwfl/ChangeLog | 9 + libdwfl/dwfl_module.c | 2 +- libdwfl/dwfl_module_getdwarf.c | 11 +- libdwfl/libdwflP.h | 2 +- libdwfl/offline.c | 4 +- tests/.gitignore | 1 + tests/ChangeLog | 36 + tests/Makefile.am | 15 +- tests/cu-dwp-section-info.c | 74 + tests/dwarf-getmacros.c | 55 +- tests/run-all-dwarf-ranges.sh | 114 ++ tests/run-cu-dwp-section-info.sh | 168 ++ tests/run-dwarf-getmacros.sh | 1412 +++++++++++++++++ tests/run-get-units-split.sh | 18 + tests/run-large-elf-file.sh | 174 ++ tests/run-varlocs.sh | 126 +- 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-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-cu-index-overflow.bz2 | Bin 0 -> 4544 bytes .../testfile-dwp-5-cu-index-overflow.dwp.bz2 | Bin 0 -> 5790 bytes tests/testfile-dwp-5.bz2 | Bin 0 -> 4223 bytes tests/testfile-dwp-5.dwp.bz2 | Bin 0 -> 10313 bytes tests/testfile-dwp-cu-index-overflow.source | 86 + tests/testfile-dwp.source | 102 ++ 45 files changed, 3337 insertions(+), 121 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-cu-index-overflow.bz2 create mode 100644 tests/testfile-dwp-4-cu-index-overflow.dwp.bz2 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-cu-index-overflow.bz2 create mode 100644 tests/testfile-dwp-5-cu-index-overflow.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-cu-index-overflow.source create mode 100644 tests/testfile-dwp.source -- 2.41.0