pub struct SBTarget {
pub raw: SBTargetRef,
}
Expand description
The target program running under the debugger.
Process Management
Starting a debug session is done by launching the target, attaching to a running process, or loading a core file.
Launching
Launching a process can be done by creating and filling
out an SBLaunchInfo
and calling SBTarget::launch()
.
use lldb::*;
fn launch_target(target: &SBTarget) -> Result<SBProcess, SBError> {
let launch_info = SBLaunchInfo::new();
launch_info.set_launch_flags(LaunchFlags::STOP_AT_ENTRY);
// Probably want to set up a listener here.
target.launch(launch_info)
}
Attaching
Attaching to a process can be done by creating and filling
out an SBAttachInfo
and calling SBTarget::attach()
.
use lldb::{lldb_pid_t, SBAttachInfo, SBError, SBProcess, SBTarget};
fn attach_to_pid(target: &SBTarget, pid: lldb_pid_t) -> Result<SBProcess, SBError> {
let attach_info = SBAttachInfo::new_with_pid(pid);
// Probably want to set up a listener here.
target.attach(attach_info)
}
Core Files
…
Breakpoints and Watchpoints
…
Modules
…
Events
…
Fields
raw: SBTargetRef
The underlying raw SBTargetRef
.
Implementations
sourceimpl SBTarget
impl SBTarget
pub fn broadcaster_class_name() -> &'static str
sourcepub fn platform(&self) -> SBPlatform
pub fn platform(&self) -> SBPlatform
Get the SBPlatform
associated with this target.
After return, the platform object should be checked for validity.
sourcepub fn launch(&self, launch_info: SBLaunchInfo) -> Result<SBProcess, SBError>
pub fn launch(&self, launch_info: SBLaunchInfo) -> Result<SBProcess, SBError>
Launch a target for debugging.
pub fn load_core(&self, core_file: &str) -> Result<SBProcess, SBError>
pub fn attach(&self, attach_info: SBAttachInfo) -> Result<SBProcess, SBError>
sourcepub fn executable(&self) -> Option<SBFileSpec>
pub fn executable(&self) -> Option<SBFileSpec>
Get a filespec for the executable.
sourcepub fn add_module(&self, module: &SBModule) -> bool
pub fn add_module(&self, module: &SBModule) -> bool
Add a module to the target.
sourcepub fn add_module_spec(&self, module_spec: &SBModuleSpec) -> Option<SBModule>
pub fn add_module_spec(&self, module_spec: &SBModuleSpec) -> Option<SBModule>
Add a module to the target using an SBModuleSpec
.
sourcepub fn remove_module(&self, module: &SBModule) -> bool
pub fn remove_module(&self, module: &SBModule) -> bool
Remove a module from the target.
sourcepub fn debugger(&self) -> SBDebugger
pub fn debugger(&self) -> SBDebugger
Get the debugger controlling this target.
sourcepub fn modules(&self) -> SBTargetModuleIter<'_>ⓘNotable traits for SBTargetModuleIter<'d>impl<'d> Iterator for SBTargetModuleIter<'d> type Item = SBModule;
pub fn modules(&self) -> SBTargetModuleIter<'_>ⓘNotable traits for SBTargetModuleIter<'d>impl<'d> Iterator for SBTargetModuleIter<'d> type Item = SBModule;
Get an iterator over the modules known to this target instance.
sourcepub fn find_module(&self, file_spec: &SBFileSpec) -> Option<SBModule>
pub fn find_module(&self, file_spec: &SBFileSpec) -> Option<SBModule>
Find the module for the given SBFileSpec
.
sourcepub fn resolve_file_address(&self, file_addr: lldb_addr_t) -> Option<SBAddress>
pub fn resolve_file_address(&self, file_addr: lldb_addr_t) -> Option<SBAddress>
Resolve a current file address into a section offset address.
sourcepub fn resolve_load_address(&self, vm_addr: lldb_addr_t) -> Option<SBAddress>
pub fn resolve_load_address(&self, vm_addr: lldb_addr_t) -> Option<SBAddress>
Resolve a current load address into a section offset address.
The return value will be None
if the vm_addr
doesn’t resolve to
a section within a module.
pub fn delete_breakpoint(&self, break_id: i32)
pub fn find_breakpoint_by_id(&self, break_id: i32) -> Option<SBBreakpoint>
pub fn enable_all_breakpoints(&self)
pub fn disable_all_breakpoints(&self)
pub fn delete_all_breakpoints(&self)
pub fn breakpoints(&self) -> SBTargetBreakpointIter<'_>ⓘNotable traits for SBTargetBreakpointIter<'d>impl<'d> Iterator for SBTargetBreakpointIter<'d> type Item = SBBreakpoint;
pub fn delete_watchpoint(&self, watch_id: i32)
pub fn find_watchpoint_by_id(&self, watch_id: i32) -> Option<SBWatchpoint>
pub fn enable_all_watchpoints(&self)
pub fn disable_all_watchpoints(&self)
pub fn delete_all_watchpoints(&self)
pub fn watch_address(
&self,
addr: lldb_addr_t,
size: usize,
read: bool,
write: bool
) -> Result<SBWatchpoint, SBError>
pub fn watchpoints(&self) -> SBTargetWatchpointIter<'_>ⓘNotable traits for SBTargetWatchpointIter<'d>impl<'d> Iterator for SBTargetWatchpointIter<'d> type Item = SBWatchpoint;
pub fn broadcaster(&self) -> SBBroadcaster
pub fn find_functions(
&self,
name: &str,
name_type_mask: u32
) -> SBSymbolContextList
pub fn find_global_functions(
&self,
name: &str,
max_matches: u32,
matchtype: MatchType
) -> SBSymbolContextList
pub fn find_symbols(
&self,
name: &str,
symbol_type: SymbolType
) -> SBSymbolContextList
sourcepub fn evaluate_expression(
&self,
expression: &str,
options: &SBExpressionOptions
) -> SBValue
pub fn evaluate_expression(
&self,
expression: &str,
options: &SBExpressionOptions
) -> SBValue
Evaluate an expression.