Struct GdbCommand

Source
pub struct GdbCommand<'a> { /* private fields */ }
Expand description

Struct contains information about arguments for gdb to run.

Implementations§

Source§

impl<'a> GdbCommand<'a>

Source

pub fn new(exec_type: &'a ExecType<'_>) -> GdbCommand<'a>

Construct GdbCommand from given ExecType.

§Arguments
  • type - execution type to run gdb.
Source

pub fn stdin<T: Into<Option<&'a PathBuf>>>( &mut self, file: T, ) -> &'a mut GdbCommand<'_>

Add stdin for executable. You should call this method before using r method.

§Arguments
  • file - path to stdin file
Source

pub fn ex<T: Into<String>>(&mut self, cmd: T) -> &'a mut GdbCommand<'_>

Add new gdb command to execute.

§Arguments
  • cmd - gdb command parameter (-ex).
Source

pub fn raw(&self) -> Result<Vec<u8>>

Run gdb with provided commands and return raw stdout.

Source

pub fn r(&mut self) -> &'a mut GdbCommand<'_>

Add command to run program

§Arguments
  • file - path to stdin file
Source

pub fn c(&mut self) -> &'a mut GdbCommand<'_>

Add command to continue execution

Source

pub fn bt(&mut self) -> &'a mut GdbCommand<'_>

Add command to get backtrace (-ex bt)

Source

pub fn disassembly(&mut self) -> &'a mut GdbCommand<'_>

Add command to get disassembly (-ex ‘x/16i $pc’)

Source

pub fn regs(&mut self) -> &'a mut GdbCommand<'_>

Add command to get registers (-ex ‘i r’)

Source

pub fn mappings(&mut self) -> &'a mut GdbCommand<'_>

Add command to get mappings (-ex ‘info proc mappings’)

Source

pub fn cmdline(&mut self) -> &'a mut GdbCommand<'_>

Add command to get cmd line.

Source

pub fn env(&mut self) -> &'a mut GdbCommand<'_>

Add command to get environment variables

Source

pub fn status(&mut self) -> &'a mut GdbCommand<'_>

Add command to get process status

Source

pub fn sources(&mut self) -> &'a mut GdbCommand<'_>

Add command to get info

Source

pub fn bmain(&mut self) -> &'a mut GdbCommand<'_>

Break at main

Source

pub fn timeout(&mut self, timeout: u64) -> &'a mut GdbCommand<'_>

Add timeout [sec]

Source

pub fn list<T: Into<Option<&'a str>>>( &mut self, location: T, ) -> &'a mut GdbCommand<'_>

Print lines from source file

§Arguments
  • location - lines centered around the line specified by location. If None then location is current line.
Source

pub fn mem<T: AsRef<str>>( &mut self, expr: T, size: usize, ) -> &'a mut GdbCommand<'_>

Get memory contents (string of hex bytes)

§Arguments
  • expr - expression that represents the start memory address.

  • size - size of memory in bytes to get.

Source

pub fn siginfo(&mut self) -> &'a mut GdbCommand<'_>

Add command to get siginfo

Source

pub fn launch(&self) -> Result<Vec<String>>

Execute gdb and get result for each command.

§Return value.

The return value is a vector of strings for each command executed.

Source

pub fn parse<T: AsRef<str>>(&self, output: T) -> Result<Vec<String>>

Parse raw gdb output.

§Return value.

The return value is a vector of strings for each command executed.

Trait Implementations§

Source§

impl<'a> Debug for GdbCommand<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for GdbCommand<'a>

§

impl<'a> RefUnwindSafe for GdbCommand<'a>

§

impl<'a> Send for GdbCommand<'a>

§

impl<'a> Sync for GdbCommand<'a>

§

impl<'a> Unpin for GdbCommand<'a>

§

impl<'a> UnwindSafe for GdbCommand<'a>

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.