Skip to main content

RawFileContext

Struct RawFileContext 

Source
pub struct RawFileContext<'data> { /* private fields */ }

Implementations§

Source§

impl<'data> RawFileContext<'data>

Source

pub fn from_bytes( target_platform: &str, data: &'data [u8], ) -> Result<Self, DecompError>

Examples found in repository?
examples/decompile.rs (line 22)
14fn main() -> Result<(), DecompError> {
15    let ghidra_dir = env::var("GHIDRA_INSTALL_DIR").expect(
16        "Please provide an environment variable \
17        GHIDRA_INSTALL_DIR with the path to the Ghidra root directory. \
18        This is needed to find the SLEIGH specification files",
19    );
20
21    initialize_decompiler(Path::new(&ghidra_dir), true)?;
22    let mut ctx = RawFileContext::from_bytes("x86:LE:64:default", &PROGRAM)?;
23
24    let addr = 0x0;
25    ctx.define_function(addr, "fib")?;
26    let decomp = ctx.decompile_function(addr)?;
27    println!("{}", decomp);
28
29    Ok(())
30}
Source

pub fn define_function( &mut self, address: u64, name: &str, ) -> Result<(), DecompError>

Examples found in repository?
examples/decompile.rs (line 25)
14fn main() -> Result<(), DecompError> {
15    let ghidra_dir = env::var("GHIDRA_INSTALL_DIR").expect(
16        "Please provide an environment variable \
17        GHIDRA_INSTALL_DIR with the path to the Ghidra root directory. \
18        This is needed to find the SLEIGH specification files",
19    );
20
21    initialize_decompiler(Path::new(&ghidra_dir), true)?;
22    let mut ctx = RawFileContext::from_bytes("x86:LE:64:default", &PROGRAM)?;
23
24    let addr = 0x0;
25    ctx.define_function(addr, "fib")?;
26    let decomp = ctx.decompile_function(addr)?;
27    println!("{}", decomp);
28
29    Ok(())
30}
Source

pub fn decompile_function( &mut self, address: u64, ) -> Result<String, DecompError>

Examples found in repository?
examples/decompile.rs (line 26)
14fn main() -> Result<(), DecompError> {
15    let ghidra_dir = env::var("GHIDRA_INSTALL_DIR").expect(
16        "Please provide an environment variable \
17        GHIDRA_INSTALL_DIR with the path to the Ghidra root directory. \
18        This is needed to find the SLEIGH specification files",
19    );
20
21    initialize_decompiler(Path::new(&ghidra_dir), true)?;
22    let mut ctx = RawFileContext::from_bytes("x86:LE:64:default", &PROGRAM)?;
23
24    let addr = 0x0;
25    ctx.define_function(addr, "fib")?;
26    let decomp = ctx.decompile_function(addr)?;
27    println!("{}", decomp);
28
29    Ok(())
30}

Trait Implementations§

Source§

impl<'data> Drop for RawFileContext<'data>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'data> !Send for RawFileContext<'data>

§

impl<'data> !Sync for RawFileContext<'data>

§

impl<'data> Freeze for RawFileContext<'data>

§

impl<'data> RefUnwindSafe for RawFileContext<'data>

§

impl<'data> Unpin for RawFileContext<'data>

§

impl<'data> UnsafeUnpin for RawFileContext<'data>

§

impl<'data> UnwindSafe for RawFileContext<'data>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.