Struct lldb::SBDebugger
[−]
[src]
pub struct SBDebugger { pub raw: SBDebuggerRef, }
Creates SBTarget
s, provides access to them and manages
the overall debugging experience.
Initialization and Teardown
LLDB must be initialized before the functionality is used. This
is done with SBDebugger::initialize()
:
use lldb::SBDebugger; SBDebugger::initialize();
Similarly, it must be terminated after you are done using it:
use lldb::SBDebugger; SBDebugger::initialize(); // Use LLDB functionality ... SBDebugger::terminate();
Once you've initialized LLDB, you're ready to create an instance
of SBDebugger
:
use lldb::SBDebugger; SBDebugger::initialize(); let debugger = SBDebugger::create(false); // ... configure the debugger if needed ... // ... create a target and do stuff ... SBDebugger::terminate();
Configuration
Async Mode
While it is best to use LLDB in asynchronous mode, it does offer a synchronous mode, which can be easier to use for quick experiments or scripts.
In synchronous mode, calls to the LLDB API do not return until the underlying action has been completed. This means that the thread from which you call LLDB will be blocked during that time, so this is not an ideal way to use LLDB for building interactive tools or a new user interface.
In asynchronous mode, calls to the LLDB API will return immediately without waiting for the action to complete. This means that actions like launching a target, continuing the execution of a process and so on won't be completed immediately and you must process events to see what the results of an action are.
Synchronous mode can be enabled by using set_async
and passing it
a false
value. You can see if you're in asynchronous mode or not
by calling async
.
Target Management
The SBDebugger
instance tracks the various targets that are
currently known to the debugger.
Typically, you create a target with create_target
,
create_target_simple
or one of the related methods.
Sometimes, you'll want to create a target without an associated executable. A common use case for this is to attach to a process by name or process ID where you don't know the executable in advance. The most convenient way to do this is:
let debugger = SBDebugger::create(false); if let Some(target) = debugger.create_target_simple("") { println!("Got a target: {:?}", target); // Now, maybe we'd like to attach to something. }
You can iterate over these targets which have been created by
using targets
:
// Iterate over the targets... for target in debugger.targets() { println!("Hello {:?}!", target); } // Or collect them into a vector! let targets = debugger.targets().collect::<Vec<SBTarget>>();
Platform Management
...
Fields
raw: SBDebuggerRef
The underlying raw SBDebuggerRef
.
Methods
impl SBDebugger
[src]
fn initialize()
[src]
Initialize LLDB.
This should be called before LLDB functionality is used.
fn terminate()
[src]
Tear down LLDB.
This should be called once the application no longer needs to use LLDB functionality. Typically, this is called as the application exits.
fn create(source_init_files: bool) -> SBDebugger
[src]
Create a new instance of SBDebugger
.
If source_init_files
is true
, then ~/.lldbinit
will
be processed.
fn async(&self) -> bool
[src]
Get whether or not the debugger is in async mode.
When in async mode, the debugger returns immediately when stepping or continuing without waiting for the process to change state.
fn set_async(&self, async: bool)
[src]
Set the debugger to be in async mode or not.
When in async mode, the debugger returns immediately when stepping or continuing without waiting for the process to change state.
fn version() -> String
[src]
Get the LLDB version string.
fn create_target(
&self,
executable: &str,
target_triple: Option<&str>,
platform_name: Option<&str>,
add_dependent_modules: bool
) -> Result<SBTarget, SBError>
[src]
&self,
executable: &str,
target_triple: Option<&str>,
platform_name: Option<&str>,
add_dependent_modules: bool
) -> Result<SBTarget, SBError>
Create a target.
The executable name may be an empty string to create an empty target.
fn create_target_simple(&self, executable: &str) -> Option<SBTarget>
[src]
Create a target from just an executable name.
The executable name may be an empty string to create an empty target.
Using [create_target
] is preferred in most cases as
that provides access to an SBError
to inform the caller
about what might have gone wrong.
fn targets(&self) -> SBDebuggerTargetIter
[src]
Get an iterator over the targets known to this debugger instance.
fn selected_target(&self) -> Option<SBTarget>
[src]
Get the currently selected [SBTarget
].
fn set_selected_target(&self, target: &SBTarget)
[src]
Set the selected [SBTarget
].
fn selected_platform(&self) -> SBPlatform
[src]
Get the currently selected SBPlatform
.
fn set_selected_platform(&self, platform: &SBPlatform)
[src]
Set the selected SBPlatform
.