Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
262 changes: 96 additions & 166 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ You could also call this project <code>rust-dwp</code>, if you'd prefer that.

#### Author and acknowledgements
<sup>
<code>thorin</code> is authored by <a href="https://davidtw.co">David Wood</a> of <i>Huawei
Technologies Research & Development (UK) Ltd</i>. <code>thorin</code> is maintained by the
<code>thorin</code> is authored by <a href="https://davidtw.co">David Wood</a>.
<code>thorin</code> is maintained by the
<a href="https://rust-lang.org/governance/teams/compiler">Rust Compiler Team</a>.
</sup>

Expand Down
2 changes: 1 addition & 1 deletion tests/invalid-cu-header-length-type.s
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# CHECK: Error: Failed to add `{{.*}}/invalid-cu-header-length-type.s.tmp.dwo` to DWARF package
# CHECK: 0: Failed to parse unit header
# CHECK: 1: Hit the end of input before it was expected
# CHECK: 1: unexpected end of input

.section .debug_info.dwo,"e",@progbits
.short 0 # Length of Unit
2 changes: 1 addition & 1 deletion tests/invalid-cu-header-length.s
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# CHECK: Error: Failed to add `{{.*}}/invalid-cu-header-length.s.tmp.dwo` to DWARF package
# CHECK: 0: Failed to parse unit header
# CHECK: 1: Hit the end of input before it was expected
# CHECK: 1: unexpected end of input

.section .debug_info.dwo,"e",@progbits
.long 16 # Length of Unit
Expand Down
2 changes: 1 addition & 1 deletion tests/invalid-cu-header-version.s
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# CHECK: Error: Failed to add `{{.*}}/invalid-cu-header-version.s.tmp.dwo` to DWARF package
# CHECK: 0: Failed to parse unit header
# CHECK: 1: Hit the end of input before it was expected
# CHECK: 1: unexpected end of input

.section .debug_info.dwo,"e",@progbits
.long 0 # Length of Unit
2 changes: 1 addition & 1 deletion tests/invalid-cu-index.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ RUN: not thorin %p/inputs/invalid-cu-index.dwp -o %t 2>&1 | FileCheck %s

CHECK: Error: Failed to add `{{.*}}/invalid-cu-index.dwp` to DWARF package
CHECK: 0: Failed to parse `.debug_cu_index` index section
CHECK: 1: Hit the end of input before it was expected
CHECK: 1: unexpected end of input
3 changes: 1 addition & 2 deletions tests/invalid-string-form.test
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
RUN: not thorin %p/inputs/invalid-string-form.dwo -o %t 2>&1 | FileCheck %s

CHECK: Error: Failed to add `{{.*}}/invalid-string-form.dwo` to DWARF package
CHECK: 0: Failed to parse unit attribute
CHECK: 1: Found an unknown `DW_FORM_*` type
CHECK: unknown attribute form: 0x1e02
2 changes: 1 addition & 1 deletion tests/invalid-tu-header-length.s
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# CHECK: Error: Failed to add `{{.*}}/invalid-tu-header-length.s.tmp.dwo` to DWARF package
# CHECK: 0: Failed to parse unit header
# CHECK: 1: Hit the end of input before it was expected
# CHECK: 1: unexpected end of input

.section .debug_info.dwo,"e",@progbits
.long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit
Expand Down
2 changes: 1 addition & 1 deletion tests/missing-tu-index.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# CHECK: Error: Failed to add `{{.*}}/missing-tu-index.test.tmp.dwp` to DWARF package
# CHECK: 0: Failed to parse `.debug_tu_index` index section
# CHECK: 1: Hit the end of input before it was expected
# CHECK: 1: unexpected end of input

.section .debug_abbrev.dwo, "e", @progbits
.LAbbrevBegin:
Expand Down
2 changes: 1 addition & 1 deletion tests/multiple-debug-info-sections-in-dwp.s
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# CHECK: Error: Failed to add `{{.*}}/multiple-debug-info-sections-in-dwp.s.tmp.dwp` to DWARF package
# CHECK: 0: Failed to parse `.debug_cu_index` index section
# CHECK: 1: Hit the end of input before it was expected
# CHECK: 1: unexpected end of input

.section .debug_info.dwo,"G",@progbits,0xFDFDFDFD,comdat
.long .Ldebug_info_dwo_end1-.Ldebug_info_dwo_start1 # Length of Unit
Expand Down
2 changes: 1 addition & 1 deletion tests/no-cu-found.s
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# CHECK: Error: Failed to add `{{.*}}/no-cu-found.s.tmp.dwo` to DWARF package
# CHECK: 0: Failed to parse unit header
# CHECK: 1: The `DW_UT_*` value for this unit is not supported yet
# CHECK: 1: unknown unit type: 0xc

.section .debug_info.dwo,"e",@progbits
.long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit
Expand Down
2 changes: 1 addition & 1 deletion tests/wrong-unit-type-info-v4.s
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# CHECK: Error: Failed to add `{{.*}}/wrong-unit-type-info-v4.s.tmp.dwp` to DWARF package
# CHECK: 0: Failed to parse unit
# CHECK: 1: Hit the end of input before it was expected
# CHECK: 1: unexpected end of input

.section .debug_info.dwo,"e",@progbits
.long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit
Expand Down
22 changes: 11 additions & 11 deletions thorin-bin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
[package]
name = "thorin-dwp-bin"
authors = [ "David Wood <david.wood@huawei.com>" ]
authors = [ "David Wood <david.wood2@arm.com>" ]
categories = ["development-tools::debugging", "command-line-utilities"]
description = "Merge DWARF objects and packages into DWARF packages"
homepage = "https://github.com/rust-lang/thorin"
keywords = ["dwarf", "split-dwarf", "dwarf-package", "dwarf-object", "dwp"]
license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/rust-lang/thorin"
version = "0.9.0"
version = "0.10.0"
edition = "2021"

[dependencies]
thorin-dwp = { version = "0.9.0", path = "../thorin" }
thorin-dwp = { version = "0.10.0", path = "../thorin" }

anyhow = "1.0.51"
memmap2 = "0.5.0"
thiserror = "1.0.30"
tracing = "0.1.29"
tracing-subscriber = { version = "0.3.18", features = [ "env-filter" ] }
tracing-tree = "0.2.3"
typed-arena = "2.0.1"
anyhow = "1.0.102"
clap = { version = "4.5.60", features = ["derive"] }
memmap2 = "0.9.10"
thiserror = "2.0.18"
tracing = "0.1.44"
tracing-subscriber = { version = "0.3.22", features = [ "env-filter" ] }
tracing-tree = "0.4.1"
typed-arena = "2.0.2"

[dependencies.object]
version = "0.36.0"
version = "0.38.0"
default-features = false
features = [ "archive", "read", "write", "compression" ]

Expand Down
6 changes: 3 additions & 3 deletions thorin-bin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ objects (including DWARF objects in archive files, such as Rust rlibs)! Install
```shell-session
$ cargo install thorin-dwp-bin
$ thorin --help
thorin 0.9.0
thorin 0.10.0
merge dwarf objects into dwarf packages

USAGE:
Expand Down Expand Up @@ -61,8 +61,8 @@ You could also call this project <code>rust-dwp</code>, if you'd prefer that.

#### Author and acknowledgements
<sup>
<code>thorin</code> is authored by <a href="https://davidtw.co">David Wood</a> of <i>Huawei
Technologies Research & Development (UK) Ltd</i>. <code>thorin</code> is maintained by the
<code>thorin</code> is authored by <a href="https://davidtw.co">David Wood</a>.
<code>thorin</code> is maintained by the
<a href="https://rust-lang.org/governance/teams/compiler">Rust Compiler Team</a>.
</sup>

Expand Down
12 changes: 6 additions & 6 deletions thorin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
[package]
name = "thorin-dwp"
authors = [ "David Wood <david.wood@huawei.com>" ]
authors = [ "David Wood <david.wood2@arm.com>" ]
categories = ["development-tools::debugging"]
description = "Library for building DWARF packages from input DWARF objects and packages"
homepage = "https://docs.rs/thorin-dwp"
keywords = ["dwarf", "split-dwarf", "dwarf-package", "dwarf-object", "dwp"]
license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/rust-lang/thorin"
version = "0.9.0"
version = "0.10.0"
edition = "2021"

[dependencies]
tracing = "0.1.29"
hashbrown = "0.15.0"
tracing = "0.1.44"
hashbrown = "0.16.0"

[dependencies.gimli]
version = "0.31.0"
version = "0.33.0"
default-features = false
# `gimli/std` pulls in `fallible-iterator` which we don't use, but can't opt out of, because of
# cargo#8832.
features = [ "read", "write", "std" ]

[dependencies.object]
version = "0.36.0"
version = "0.38.0"
default-features = false
features = [ "archive", "read", "write", "compression" ]

Expand Down
6 changes: 3 additions & 3 deletions thorin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cross-crate Split DWARF packaging in `rustc`.
To use `thorin` in your own project, add it to your `Cargo.toml`:

```toml
thorin-dwp = "0.9.0"
thorin-dwp = "0.10.0"
```

See the [`thorin-bin`](../thorin-bin/README.md) crate for an example of using `thorin`'s library
Expand Down Expand Up @@ -43,8 +43,8 @@ You could also call this project <code>rust-dwp</code>, if you'd prefer that.

#### Author and acknowledgements
<sup>
<code>thorin</code> is authored by <a href="https://davidtw.co">David Wood</a> of <i>Huawei
Technologies Research & Development (UK) Ltd</i>. <code>thorin</code> is maintained by the
<code>thorin</code> is authored by <a href="https://davidtw.co">David Wood</a>.
<code>thorin</code> is maintained by the
<a href="https://rust-lang.org/governance/teams/compiler">Rust Compiler Team</a>.
</sup>

Expand Down
4 changes: 0 additions & 4 deletions thorin/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ pub enum Error {
MissingRequiredSection(&'static str),
/// Failed to parse unit abbreviations.
ParseUnitAbbreviations(gimli::read::Error),
/// Failed to parse unit attribute.
ParseUnitAttribute(gimli::read::Error),
/// Failed to parse unit header.
ParseUnitHeader(gimli::read::Error),
/// Failed to parse unit.
Expand Down Expand Up @@ -137,7 +135,6 @@ impl StdError for Error {
Error::TopLevelDieNotUnit => None,
Error::MissingRequiredSection(_) => None,
Error::ParseUnitAbbreviations(source) => Some(source.as_dyn_error()),
Error::ParseUnitAttribute(source) => Some(source.as_dyn_error()),
Error::ParseUnitHeader(source) => Some(source.as_dyn_error()),
Error::ParseUnit(source) => Some(source.as_dyn_error()),
Error::IncompatibleIndexVersion(_, _, _) => None,
Expand Down Expand Up @@ -208,7 +205,6 @@ impl fmt::Display for Error {
write!(f, "Input object missing required section `{}`", section)
}
Error::ParseUnitAbbreviations(_) => write!(f, "Failed to parse unit abbreviations"),
Error::ParseUnitAttribute(_) => write!(f, "Failed to parse unit attribute"),
Error::ParseUnitHeader(_) => write!(f, "Failed to parse unit header"),
Error::ParseUnit(_) => write!(f, "Failed to parse unit"),
Error::IncompatibleIndexVersion(section, format, actual) => {
Expand Down
4 changes: 2 additions & 2 deletions thorin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ where
cursor.next_dfs()?;
let root = cursor.current().expect("unit w/out root debugging information entry");

let dwo_name = if let Some(val) = root.attr_value(gimli::DW_AT_dwo_name)? {
let dwo_name = if let Some(val) = root.attr_value(gimli::DW_AT_dwo_name) {
// DWARF 5
val
} else if let Some(val) = root.attr_value(gimli::DW_AT_GNU_dwo_name)? {
} else if let Some(val) = root.attr_value(gimli::DW_AT_GNU_dwo_name) {
// GNU Extension
val
} else {
Expand Down
11 changes: 3 additions & 8 deletions thorin/src/package.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{collections::HashSet, fmt};

use gimli::{Encoding, RunTimeEndian, UnitHeader, UnitIndex, UnitSectionOffset, UnitType};
use gimli::{Encoding, RunTimeEndian, UnitHeader, UnitIndex, UnitType};
use object::{
write::{Object as WritableObject, SectionId},
BinaryFormat, Object, ObjectSection, SectionKind,
Expand Down Expand Up @@ -113,8 +113,7 @@ pub(crate) fn dwo_identifier_of_unit<R: gimli::Reader>(
gimli::DW_TAG_compile_unit | gimli::DW_TAG_type_unit => (),
_ => return Err(Error::TopLevelDieNotUnit),
}
let mut attrs = root.attrs();
while let Some(attr) = attrs.next().map_err(Error::ParseUnitAttribute)? {
for attr in root.attrs() {
match (attr.name(), attr.value()) {
(gimli::constants::DW_AT_GNU_dwo_id, gimli::AttributeValue::DwoId(dwo_id)) => {
return Ok(Some(DwarfObject::Compilation(dwo_id.into())))
Expand Down Expand Up @@ -615,15 +614,11 @@ impl<'file> InProgressDwarfPackage<'file> {
.length_including_self()
.try_into()
.expect("unit header length larger than u64");
let offset = match header.offset() {
UnitSectionOffset::DebugInfoOffset(offset) => offset.0,
UnitSectionOffset::DebugTypesOffset(offset) => offset.0,
};

let data = section
.compressed_data_range(
sess,
offset.try_into().expect("offset larger than u64"),
header.offset().0.try_into().expect("offset larger than u64"),
size,
)
.map_err(Error::DecompressData)?
Expand Down