Skip to main content

Db

Struct Db 

Source
pub struct Db {
    pub notes: NoteDb,
    /* private fields */
}

Fields§

§notes: NoteDb

Implementations§

Source§

impl Db

Source

pub fn new() -> Self

A database with no CPU selected. A set_cpu command must run before any disassembly.

Source

pub fn with_platform(platform: PlatformRef) -> Self

A database with platform already selected.

Source

pub fn platform(&self) -> Option<&dyn Platform>

The selected processor driver, or None if no CPU is set.

Source

pub fn set_platform( &mut self, platform: Option<PlatformRef>, ) -> Option<PlatformRef>

Select the CPU (or clear it with None), propagating it to every region so their code re-derives. Returns the previous selection.

Source

pub fn spaces(&self) -> Vec<AddressSpace>

The address spaces to render, in order: the driver’s regions when a CPU is set, otherwise whatever spaces already hold mapped bytes.

Source

pub fn resolve_space(&self, name: &str) -> Result<AddressSpace, Error>

Space names are driver-defined.

Source

pub fn region(&self, space: AddressSpace) -> Option<&Region>

Source

pub fn region_mut(&mut self, space: AddressSpace) -> &mut Region

Source

pub fn xrefs_to(&self, target: &PhysicalAddr) -> Vec<Xref>

Source

pub fn undecided_operands( &self, ) -> Vec<(SpaceAddressValue, AddressValue, Vec<AddressSpace>)>

Instructions with ambiguous operands, as (instruction, value, candidate spaces).

Source

pub fn xrefs_from(&self, source: &PhysicalAddr) -> Vec<Xref>

Source

pub fn basic_blocks( &self, space: AddressSpace, entry: AddressValue, ) -> Vec<Block>

The control-flow graph of the routine rooted at entry in space.

Source

pub fn peek( &self, space: AddressSpace, start: AddressValue, max_lines: usize, ) -> ScratchDecode

Decode bytes as code from start without committing, for a caller to judge whether a run is really code (see Region::scratch_decode).

Source

pub fn peek_linear( &self, space: AddressSpace, start: AddressValue, end: AddressValue, ) -> ScratchDecode

Test-decode start..end as one straight run without committing, for a caller about to commit the whole range as code (see Region::scratch_decode_linear).

Source

pub fn undecoded_entry_points(&self) -> Vec<EntryPoint>

Source

pub fn resolve_thunk( &self, space: AddressSpace, addr: AddressValue, ) -> AddressValue

Follow pure jump thunks from addr to the ultimate target. Rendering stays faithful to the bytes, so this is how a consumer asks where a call or jump really ends up. Returns addr when it is not a thunk.

Source

pub fn render(&self, space: AddressSpace) -> Vec<Line>

Source

pub fn render_range( &self, space: AddressSpace, start: AddressValue, end: AddressValue, ) -> Vec<Line>

Source

pub fn to_sdas(&self) -> String

Source

pub fn to_commands(&self) -> Vec<Box<dyn Command>>

Source

pub fn apply( &mut self, command: Box<dyn Command>, env: Option<&dyn Environment>, ) -> Result<Vec<Box<dyn Command>>, Error>

Source

pub fn space_usage(&self, space: AddressSpace) -> SpaceUsage

Byte counts for mapped content classified by equivalent kind.

Source

pub fn clear_note( &mut self, id: &NoteId, ) -> Option<(AddressSpace, AddressRange, Note)>

Source

pub fn note_tip(&self) -> Option<NoteId>

Source

pub fn create_note(&mut self, content: impl Into<String>) -> Note

Source

pub fn get_notes_overlapping( &self, space: AddressSpace, range: impl RangeBounds<AddressValue>, ) -> Vec<&Note>

Source

pub fn get_notes_inside( &self, space: AddressSpace, range: impl RangeBounds<AddressValue>, ) -> Vec<&Note>

Source

pub fn notes_near( &self, space: AddressSpace, addr: AddressValue, window: AddressValue, ) -> Vec<ProximateNote<'_>>

Notes within window bytes of addr, nearest first.

Source

pub fn search_notes(&self, query: &str) -> Vec<&Note>

Notes matching query (case-insensitive over content, tags, fields).

Source

pub fn note_location(&self, id: &NoteId) -> Option<(AddressSpace, AddressRange)>

Where a note is attached, if anywhere.

Source§

impl Db

Source

pub fn diff_from(&self, base: &Db) -> Vec<Box<dyn Command>>

The commands that transform base’s state into this DB’s state: a clear for every base fact this DB changed or dropped, then a set for every fact this DB has that base does not. Both sides are taken from the canonical to_commands form, so identical facts cancel out.

Applying the result on top of base reproduces this DB exactly. Clears come first so a shrunk range is wiped before the survivor is re-set.

Trait Implementations§

Source§

impl Default for Db

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Db

§

impl !UnwindSafe for Db

§

impl Forget for Db

§

impl Freeze for Db

§

impl Move for Db

§

impl Send for Db

§

impl Sync for Db

§

impl Unpin for Db

§

impl UnsafeUnpin for Db

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more