Struct lldb::SBDebugger [] [src]

pub struct SBDebugger {
    pub raw: SBDebuggerRef,
}

Creates SBTargets, 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

The underlying raw SBDebuggerRef.

Methods

impl SBDebugger
[src]

[src]

Initialize LLDB.

This should be called before LLDB functionality is used.

[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.

[src]

Create a new instance of SBDebugger.

If source_init_files is true, then ~/.lldbinit will be processed.

[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.

[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.

[src]

Get the LLDB version string.

[src]

Create a target.

The executable name may be an empty string to create an empty target.

[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.

[src]

Get an iterator over the targets known to this debugger instance.

[src]

Get the currently selected [SBTarget].

[src]

Set the selected [SBTarget].

[src]

Get the currently selected SBPlatform.

[src]

Set the selected SBPlatform.

Trait Implementations

impl Debug for SBDebugger
[src]

[src]

Formats the value using the given formatter.

impl Drop for SBDebugger
[src]

[src]

Executes the destructor for this type. Read more