Skip to content

Commit

Permalink
Support reading Playstation DebugId and Object Kind (#782)
Browse files Browse the repository at this point in the history
  • Loading branch information
Swatinem authored Apr 14, 2023
1 parent 5fd06d4 commit bb71c54
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions symbolic-debuginfo/src/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,12 +434,17 @@ impl<'data> ElfObject<'data> {

/// The kind of this object, as specified in the ELF header.
pub fn kind(&self) -> ObjectKind {
const ET_SCE_DYNEXEC: u16 = 0xfe10;
const ET_SCE_DYNAMIC: u16 = 0xfe18;

let kind = match self.elf.header.e_type {
goblin::elf::header::ET_NONE => ObjectKind::None,
goblin::elf::header::ET_REL => ObjectKind::Relocatable,
goblin::elf::header::ET_EXEC => ObjectKind::Executable,
goblin::elf::header::ET_DYN => ObjectKind::Library,
goblin::elf::header::ET_CORE => ObjectKind::Dump,
ET_SCE_DYNEXEC => ObjectKind::Executable,
ET_SCE_DYNAMIC => ObjectKind::Library,
_ => ObjectKind::Other,
};

Expand Down Expand Up @@ -669,6 +674,15 @@ impl<'data> ElfObject<'data> {
}
}

const PT_SCE_DYNLIBDATA: u32 = 0x61000000;

for ph in &self.elf.program_headers {
if ph.p_type == PT_SCE_DYNLIBDATA && ph.p_filesz >= 20 {
let offset = ph.p_offset as usize;
return self.data.get(offset..offset.saturating_add(20));
}
}

None
}

Expand Down

0 comments on commit bb71c54

Please sign in to comment.