summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authortzlil <tzlils@protonmail.com>2023-03-22 01:47:48 +0200
committertzlil <tzlils@protonmail.com>2023-03-22 01:47:48 +0200
commit8c284c3344c68cfda9e2a4b4fba171f29a8c05cf (patch)
tree2c99541092a079c0bf5ff1b545d62a5292176cf5 /src
parent2246c9e8a73fee10dc8ffcfe178538ff678df8bc (diff)
sleep HEAD master
Diffstat (limited to 'src')
-rw-r--r--src/main.rs10
-rw-r--r--src/structs.rs8
2 files changed, 14 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index 6032500..c143e22 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -134,6 +134,16 @@ impl std::fmt::Display for Elf {
                 ));
             }
         }
+
+        // printing notes is a littlec complicated
+        // for section in self.sections.iter().filter(|&&sec| sec.r#type == ElfSectionType::Note) {
+        //     let name = unsafe {
+        //         std::ffi::CStr::from_ptr(self.shstrtab.add(section.name as usize) as *const i8)
+        //             .to_str()
+        //             .expect("Bad section name")
+        //     };
+        //     formatter.write_fmt(format_args!("Displaying notes found in: {}\n{}\n", name, section))?;
+        // }
         Ok(())
     }
 }
diff --git a/src/structs.rs b/src/structs.rs
index 673ae35..2a101d9 100644
--- a/src/structs.rs
+++ b/src/structs.rs
@@ -323,7 +323,7 @@ pub struct ElfSectionHeader {
 impl std::fmt::Display for ElfSectionHeader {
     fn fmt(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
         formatter.write_fmt(format_args!(
-            "{: <16} {:0>16x} {:0>8x}\n       {:0>16x} {:0>16x}   {: <10} {: <5} {: <5} {}",
+            "{: <16} {:0>16x}  {:0>8x}\n       {:0>16x}  {:0>16x}  {: <8} {: <5} {: <5} {}",
             self.r#type,
             self.addr,
             self.offset,
@@ -457,14 +457,14 @@ impl std::fmt::Display for ElfSectionFlags {
                 if self.contains(ElfSectionFlags::WRITE) {
                     "W"
                 } else {
-                    ""
+                    " "	
                 }
             },
             {
                 if self.contains(ElfSectionFlags::ALLOC) {
                     "A"
                 } else {
-                    ""
+                    " "
                 }
             },
             {
@@ -543,7 +543,7 @@ pub struct ElfProgramHeader {
 impl std::fmt::Display for ElfProgramHeader {
     fn fmt(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
         formatter.write_fmt(format_args!(
-            "{: <14} {:#016x} {:#016x} {:#016x}\n                 {:#016x} {:#016x}   {: <10} {:#08x}",
+            "{: <14} {:#018x} {:#018x} {:#018x}\n                 {:#018x} {:#018x}  {: <6} {:#x}",
             self.r#type,
 			self.offset,
             self.vaddr,