Skip to content

Commit

Permalink
Factor out R typedef into dwarf::reader module
Browse files Browse the repository at this point in the history
This change moves the R typedef and associated functionality into the
newly introduced dwarf::reader module.

Signed-off-by: Daniel Müller <deso@posteo.net>
  • Loading branch information
d-e-s-o committed Jul 19, 2023
1 parent 286e894 commit 20d8e90
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/dwarf/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
mod parser;
mod reader;
mod resolver;

pub(crate) use self::resolver::DwarfResolver;
12 changes: 2 additions & 10 deletions src/dwarf/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ use gimli::SectionId;
use gimli::Unit;
use gimli::UnitSectionOffset;

use super::reader::R;

use crate::elf::ElfParser;
use crate::inspect::SymType;
use crate::log::warn;
Expand All @@ -23,16 +25,6 @@ use crate::ErrorExt as _;
use crate::Result;


#[cfg(target_endian = "little")]
type Endianess = gimli::LittleEndian;
#[cfg(target_endian = "big")]
type Endianess = gimli::BigEndian;

/// The gimli reader type we currently use. Could be made generic if
/// need be, but we keep things simple while we can.
type R<'dat> = EndianSlice<'dat, Endianess>;


fn format_offset(offset: UnitSectionOffset<usize>) -> String {
match offset {
UnitSectionOffset::DebugInfoOffset(o) => {
Expand Down
10 changes: 10 additions & 0 deletions src/dwarf/reader.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use gimli::EndianSlice;

#[cfg(target_endian = "little")]
type Endianess = gimli::LittleEndian;
#[cfg(target_endian = "big")]
type Endianess = gimli::BigEndian;

/// The gimli reader type we currently use. Could be made generic if
/// need be, but we keep things simple while we can.
pub(crate) type R<'dat> = EndianSlice<'dat, Endianess>;

0 comments on commit 20d8e90

Please sign in to comment.