Created
June 21, 2015 00:21
-
-
Save radare/36d2f7df5bc19ef8063f to your computer and use it in GitHub Desktop.
rust main
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this file is included when compiling src/bin/*.rs or tests | |
// maybe we shouldn't define 'main' here | |
extern crate radeco; | |
use std::env; | |
use radeco::frontend::esil; | |
fn parse_verbose<'a> (p: &mut esil::Parser, expression: &'a String) { | |
let expstr = expression.as_str(); | |
println!("< {}", expression); | |
if let Err(e) = p.parse(expstr) { | |
panic!("Error: {:?}", e) | |
} | |
for inst in &p.emit_insts() { | |
println!("> {}", inst); | |
} | |
} | |
// attribute to ignore unused 'main' when running tests | |
#[cfg_attr(test, allow(dead_code))] | |
fn main() { | |
let mut p = esil::Parser::new(); | |
let expression: String; | |
if env::args().count() > 1 { | |
expression = env::args().nth(1).unwrap(); | |
} else { | |
expression = String::from_str("rax,rbx,+"); | |
} | |
parse_verbose(&mut p, &expression); | |
} |
Author
radare
commented
Jun 21, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment