Move rust-readelf out into its own package
This commit is contained in:
parent
0a9f684c9b
commit
2810b1b803
@ -10,9 +10,6 @@ description = "A pure-rust library for parsing ELF files"
|
||||
keywords = ["elf"]
|
||||
readme = "README.md"
|
||||
|
||||
[[bin]]
|
||||
name = "rust-readelf"
|
||||
|
||||
[lib]
|
||||
name = "elf"
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
extern crate elf;
|
||||
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
let paths: Vec<PathBuf> = if args.len() == 1 {
|
||||
vec!(From::from("stress"))
|
||||
} else {
|
||||
let mut i = args.into_iter();
|
||||
i.next();
|
||||
i.map(|arg| From::from(arg) )
|
||||
.collect()
|
||||
};
|
||||
for path in paths.into_iter() {
|
||||
let file = match elf::File::open_path(&path) {
|
||||
Ok(f) => f,
|
||||
Err(e) => panic!("Error: {:?}", e),
|
||||
};
|
||||
println!("Debug-print ELF file:");
|
||||
println!("{:?}", file);
|
||||
println!("");
|
||||
println!("Pretty-print ELF file:");
|
||||
println!("{}", file);
|
||||
|
||||
println!("Getting the .text section");
|
||||
let text = file.get_section(".text");
|
||||
match text {
|
||||
Some(s) => println!("shdr: {}", s),
|
||||
None => println!("Failed to look up .text section!"),
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user