Skip to content

Commit

Permalink
read: Add IndexSectionId::section_id
Browse files Browse the repository at this point in the history
  • Loading branch information
philipc committed May 28, 2024
1 parent de4016f commit 26af253
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/read/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,9 @@ pub enum IndexSectionId {
}

impl IndexSectionId {
/// Returns the ELF section name for this kind, when found in a .dwo or .dwp file.
pub fn dwo_name(self) -> &'static str {
let section_id = match self {
/// Returns the corresponding `SectionId`.
pub fn section_id(self) -> SectionId {
match self {
IndexSectionId::DebugAbbrev => SectionId::DebugAbbrev,
IndexSectionId::DebugInfo => SectionId::DebugInfo,
IndexSectionId::DebugLine => SectionId::DebugLine,
Expand All @@ -376,8 +376,12 @@ impl IndexSectionId {
IndexSectionId::DebugRngLists => SectionId::DebugRngLists,
IndexSectionId::DebugStrOffsets => SectionId::DebugStrOffsets,
IndexSectionId::DebugTypes => SectionId::DebugTypes,
};
section_id.dwo_name().unwrap()
}
}

/// Returns the ELF section name for this kind, when found in a .dwo or .dwp file.
pub fn dwo_name(self) -> &'static str {
self.section_id().dwo_name().unwrap()
}
}

Expand Down

0 comments on commit 26af253

Please sign in to comment.