Message ID | cover.1701854319.git.osandov@fb.com |
---|---|
Headers |
Return-Path: <elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org> 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 BAFF23857C7D for <patchwork@sourceware.org>; Wed, 6 Dec 2023 09:22:49 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id 4F17C3858C56 for <elfutils-devel@sourceware.org>; Wed, 6 Dec 2023 09:22:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4F17C3858C56 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=osandov.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=osandov.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4F17C3858C56 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701854564; cv=none; b=jvSqfFLxyftPRJS93FEfiiFP9TBdIwI5symqUzhcUb+VBdsdG9QWcIyh1FGvYkJgKpjqaLlGwARHZ/ShNUIJcISKyQtLEVLrryQatEDcKKbOzxLlttBP/DXC95ZU3TU2wR+2B7lYkW9VV9rk2X+iDk+oBCj3Jtd19Z9z3vW/3Gg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701854564; c=relaxed/simple; bh=AUjZJ+FTfPOxKlylmViclHMyLuNVTFC3O+gshgBcmbY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=I83X+w4m28YaMexMoFuGVWx4ktAZKRaqkgDHWwiqo+XMKj7VP3JOqxvmR1o/ihPOVWmj+8b2IzQml05nPG8a1BBGUl+SZb98cjgtkku8z+UP6ozbmzoRPrfx0PvxYd7d2TasjA9JT2+1EI8k+fvr3q9AkO0z/psfShxespDariY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-53fa455cd94so2985766a12.2 for <elfutils-devel@sourceware.org>; Wed, 06 Dec 2023 01:22:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1701854560; x=1702459360; 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=eN4rcTmiUIb9BAX5y56k2hhLKbaScdxcgzu2XRyOAKs=; b=04fxMc7J1PJ7K87F+roiw8Nb9q3XYup/HhDlvPMKZvfTgnh/XUZswJBMdvcsgTLNEq LIkwe7/FxI4we2u/OvhUhb3WiYZ0Cg6OlaZfvcgTAM2klsOHGZMVLHKJh5tssJ9p7Ytk pBxuqUJptQ7lxrmPCU6C6q+io7VdzyhS7uXcoJT+dzNpH6Mg9qa80ZlKDFri827JslaX kFCoHMfEo6wtgoosTYgjOs5VBESErReTsdAwITz9g8N7Mgy58HuFnqRssCDCh4Ud3n+S TZqEXntV/Hn6fD7tMmQ2uPZX+uXuOqRqobFnaNWCTRQKAOKhnoPnWuzjyAWCuAB3XJZm Hlnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701854560; x=1702459360; 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=eN4rcTmiUIb9BAX5y56k2hhLKbaScdxcgzu2XRyOAKs=; b=BcyUIUn2vvYuppu60yQYL2oMjkRs+l3EJiGGB0F5aeMUWhwg1eDl9z1EWYTBb/UbGI sNdHsTxLoUJoBDunvO2blYWpzp6wNSBg4wY40AdhGzI96kni0UJe5wICB0lxSoB+MCSG iHdI/GlN+WVEYWU2n0SyDP5kf14+tF2DLjJ7kWvnIOpO7B1WvkW+6G93ZOnGntU22D0d MYeAR73UWJAYhRzk11kRBRqtePfO9MuIxnpNQsnHdsGtpT+kWr/TWmgKeVGhBNDgFwqy QCXYgM3UnaVKlIz40rlhlg9qIUbvX9DTXjWvfTPefXBdHlTaikEFXVffU2TZZpPxfn9h d5tQ== X-Gm-Message-State: AOJu0YxJYV1gxDq9eh7Wu1CrQ1JSsUNuQzXZ0decCnep7HJiPBRi+toO CnI4l0YXW3pGEZOs3eOjxQrs5VjN9RGuuxLkuX4= X-Google-Smtp-Source: AGHT+IF8kjdRvz6q0F65lFafwL3tBpgFiyvE4JQZOR7hKt4OAHjXRnoSJe8FmUGiaPwhqJ6AUYjkXw== X-Received: by 2002:a05:6a20:e101:b0:18f:97c:b9f3 with SMTP id kr1-20020a056a20e10100b0018f097cb9f3mr488639pzb.77.1701854559740; Wed, 06 Dec 2023 01:22:39 -0800 (PST) Received: from telecaster.hsd1.wa.comcast.net ([2601:602:a300:3bc0::826d]) by smtp.gmail.com with ESMTPSA id j6-20020a170902c3c600b001cfd049528esm6364165plj.110.2023.12.06.01.22.38 for <elfutils-devel@sourceware.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 01:22:39 -0800 (PST) From: Omar Sandoval <osandov@osandov.com> To: elfutils-devel@sourceware.org Subject: [PATCH v2 0/4] elfutils: DWARF package (.dwp) file support Date: Wed, 6 Dec 2023 01:22:15 -0800 Message-ID: <cover.1701854319.git.osandov@fb.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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 <elfutils-devel.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/elfutils-devel/> List-Post: <mailto:elfutils-devel@sourceware.org> List-Help: <mailto:elfutils-devel-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=subscribe> Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org |
Series |
elfutils: DWARF package (.dwp) file support
|
|
Message
Omar Sandoval
Dec. 6, 2023, 9:22 a.m. UTC
From: Omar Sandoval <osandov@fb.com>
Hi,
This is version 2 of my patch series adding support for DWARF package
files to libdw and the elfutils tools. Version 1 is here [1].
Patches 1-3 add the main implementation and tests for dwp files.
Most of this support is internal to libdw, but patch 1 adds a new public
function, dwarf_cu_dwp_section_info. drgn's dwp branch [2] demonstrates
how that function will be used. Also see [3] for more context on why
drgn needs this.
Patch 4 adds support and tests for an LLVM extension to the dwp format.
The "extension" is ugly because of an oversight in the design of the
format that LLVM had to make the best of, but unfortunately it's
necessary for a lot of our use cases.
With this patch series, drgn's test suite passes against a Linux kernel
build using .dwp.
Changes from v1:
* Rebased on main and dropped patches that were already merged.
* Moved ChangeLog entries to commit messages.
* Updated version in libdw.map to 0.191.
* Moved DW_SECT_TYPES definition to dwarf.h.
* Added copyright years.
* Added error handling for dwarf_cu_dwp_section_info calls in
str_offsets_base_off, __libdw_cu_ranges_base, and __libdw_cu_locs_base
* Changed memset initialization of index->sections to an explicit
loop.
* Added comment explaining __libdw_link_skel_split change.
There were a couple of things that were mentioned in review that I
didn't change:
* I kept dwarf_cu_dwp_section_info in patch 1 instead of separating it
into its own patch so that I could test the dwp index implementation
in the same commit that I introduced it in.
* I didn't make try_dwp_file return an error since try_split_file that
it's based on doesn't either.
Thanks!
Omar
1: https://sourceware.org/pipermail/elfutils-devel/2023q3/006410.html
2: https://github.com/osandov/drgn/tree/dwp
3: https://sourceware.org/pipermail/elfutils-devel/2023q4/006630.html
Omar Sandoval (4):
libdw: Parse DWARF package file index sections
libdw: Try .dwp file in __libdw_find_split_unit()
libdw: Apply DWARF package file section offsets where appropriate
libdw: Handle overflowed DW_SECT_INFO offsets in DWARF package file
indexes
libdw/Makefile.am | 2 +-
libdw/dwarf.h | 2 +-
libdw/dwarf_begin_elf.c | 1 +
libdw/dwarf_cu_dwp_section_info.c | 531 +++++++
libdw/dwarf_end.c | 24 +-
libdw/dwarf_error.c | 1 +
libdw/dwarf_getlocation.c | 6 +
libdw/dwarf_getmacros.c | 26 +-
libdw/libdw.h | 23 +
libdw/libdw.map | 5 +
libdw/libdwP.h | 101 +-
libdw/libdw_find_split_unit.c | 75 +-
libdw/libdw_findcu.c | 8 +
tests/.gitignore | 1 +
tests/Makefile.am | 15 +-
tests/cu-dwp-section-info.c | 73 +
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 | 112 ++
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 ++
34 files changed, 3051 insertions(+), 29 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
Comments
On Wed, Dec 06, 2023 at 01:22:15AM -0800, Omar Sandoval wrote: > From: Omar Sandoval <osandov@fb.com> > > Hi, > > This is version 2 of my patch series adding support for DWARF package > files to libdw and the elfutils tools. Version 1 is here [1]. > > Patches 1-3 add the main implementation and tests for dwp files. > > Most of this support is internal to libdw, but patch 1 adds a new public > function, dwarf_cu_dwp_section_info. drgn's dwp branch [2] demonstrates > how that function will be used. Also see [3] for more context on why > drgn needs this. > > Patch 4 adds support and tests for an LLVM extension to the dwp format. > The "extension" is ugly because of an oversight in the design of the > format that LLVM had to make the best of, but unfortunately it's > necessary for a lot of our use cases. > > With this patch series, drgn's test suite passes against a Linux kernel > build using .dwp. > > Changes from v1: > > * Rebased on main and dropped patches that were already merged. > * Moved ChangeLog entries to commit messages. > * Updated version in libdw.map to 0.191. > * Moved DW_SECT_TYPES definition to dwarf.h. > * Added copyright years. > * Added error handling for dwarf_cu_dwp_section_info calls in > str_offsets_base_off, __libdw_cu_ranges_base, and __libdw_cu_locs_base > * Changed memset initialization of index->sections to an explicit > loop. > * Added comment explaining __libdw_link_skel_split change. > > There were a couple of things that were mentioned in review that I > didn't change: > > * I kept dwarf_cu_dwp_section_info in patch 1 instead of separating it > into its own patch so that I could test the dwp index implementation > in the same commit that I introduced it in. > * I didn't make try_dwp_file return an error since try_split_file that > it's based on doesn't either. > > Thanks! > Omar > > 1: https://sourceware.org/pipermail/elfutils-devel/2023q3/006410.html > 2: https://github.com/osandov/drgn/tree/dwp > 3: https://sourceware.org/pipermail/elfutils-devel/2023q4/006630.html > > Omar Sandoval (4): > libdw: Parse DWARF package file index sections > libdw: Try .dwp file in __libdw_find_split_unit() > libdw: Apply DWARF package file section offsets where appropriate > libdw: Handle overflowed DW_SECT_INFO offsets in DWARF package file > indexes Ping, and happy new year :)