Package lldb :: Class SBDebugger
[hide private]
[frames] | no frames]

Class SBDebugger

source code



SBDebugger is the primordial object that creates SBTargets and provides
access to them.  It also manages the overall debugging experiences.

For example (from example/disasm.py),

import lldb
import os
import sys

def disassemble_instructions (insts):
    for i in insts:
        print i

...

# Create a new debugger instance
debugger = lldb.SBDebugger.Create()

# When we step or continue, don't return from the function until the process 
# stops. We do this by setting the async mode to false.
debugger.SetAsync (False)

# Create a target from a file and arch
print 'Creating a target for '%s'' % exe

target = debugger.CreateTargetWithFileAndArch (exe, lldb.LLDB_ARCH_DEFAULT)

if target:
    # If the target is valid set a breakpoint at main
    main_bp = target.BreakpointCreateByName (fname, target.GetExecutable().GetFilename());

    print main_bp

    # Launch the process. Since we specified synchronous mode, we won't return
    # from this function until we hit the breakpoint at main
    process = target.LaunchSimple (None, None, os.getcwd())
    
    # Make sure the launch went ok
    if process:
        # Print some simple process info
        state = process.GetState ()
        print process
        if state == lldb.eStateStopped:
            # Get the first thread
            thread = process.GetThreadAtIndex (0)
            if thread:
                # Print some simple thread info
                print thread
                # Get the first frame
                frame = thread.GetFrameAtIndex (0)
                if frame:
                    # Print some simple frame info
                    print frame
                    function = frame.GetFunction()
                    # See if we have debug info (a function)
                    if function:
                        # We do have a function, print some info for the function
                        print function
                        # Now get all instructions for this function and print them
                        insts = function.GetInstructions(target)
                        disassemble_instructions (insts)
                    else:
                        # See if we have a symbol in the symbol table for where we stopped
                        symbol = frame.GetSymbol();
                        if symbol:
                            # We do have a symbol, print some info for the symbol
                            print symbol
                            # Now get all instructions for this symbol and print them
                            insts = symbol.GetInstructions(target)
                            disassemble_instructions (insts)

                    registerList = frame.GetRegisters()
                    print 'Frame registers (size of register set = %d):' % registerList.GetSize()
                    for value in registerList:
                        #print value
                        print '%s (number of children = %d):' % (value.GetName(), value.GetNumChildren())
                        for child in value:
                            print 'Name: ', child.GetName(), ' Value: ', child.GetValue()

            print 'Hit the breakpoint at main, enter to continue and wait for program to exit or 'Ctrl-D'/'quit' to terminate the program'
            next = sys.stdin.readline()
            if not next or next.rstrip('
') == 'quit':
                print 'Terminating the inferior process...'
                process.Kill()
            else:
                # Now continue to the program exit
                process.Continue()
                # When we return from the above function we will hopefully be at the
                # program exit. Print out some process info
                print process
        elif state == lldb.eStateExited:
            print 'Didn't hit the breakpoint at main, program has exited...'
        else:
            print 'Unexpected process state: %s, killing process...' % debugger.StateAsCString (state)
            process.Kill()

Instance Methods [hide private]
 
__setattr__(self, name, value)
x.__setattr__('name', value) <==> x.name = value
source code
 
__getattr__(self, name) source code
 
__repr__(self)
repr(x)
source code
 
__iter__(self) source code
 
__len__(self) source code
 
__init__(self, *args)
__init__(lldb::SBDebugger self) -> SBDebugger __init__(lldb::SBDebugger self, SBDebugger rhs) -> SBDebugger
source code
 
__swig_destroy__(...)
delete_SBDebugger(SBDebugger self)
 
__del__(self) source code
 
__nonzero__(self) source code
 
IsValid(self)
IsValid(SBDebugger self) -> bool
source code
 
Clear(self)
Clear(SBDebugger self)
source code
 
SetAsync(self, *args)
SetAsync(SBDebugger self, bool b)
source code
 
GetAsync(self)
GetAsync(SBDebugger self) -> bool
source code
 
SkipLLDBInitFiles(self, *args)
SkipLLDBInitFiles(SBDebugger self, bool b)
source code
 
SetInputFileHandle(self, *args)
SetInputFileHandle(SBDebugger self, FILE * f, bool transfer_ownership)
source code
 
SetOutputFileHandle(self, *args)
SetOutputFileHandle(SBDebugger self, FILE * f, bool transfer_ownership)
source code
 
SetErrorFileHandle(self, *args)
SetErrorFileHandle(SBDebugger self, FILE * f, bool transfer_ownership)
source code
 
GetInputFileHandle(self)
GetInputFileHandle(SBDebugger self) -> FILE *
source code
 
GetOutputFileHandle(self)
GetOutputFileHandle(SBDebugger self) -> FILE *
source code
 
GetErrorFileHandle(self)
GetErrorFileHandle(SBDebugger self) -> FILE *
source code
 
GetCommandInterpreter(self)
GetCommandInterpreter(SBDebugger self) -> SBCommandInterpreter
source code
 
HandleCommand(self, *args)
HandleCommand(SBDebugger self, str const * command)
source code
 
GetListener(self)
GetListener(SBDebugger self) -> SBListener
source code
 
HandleProcessEvent(self, *args)
HandleProcessEvent(SBDebugger self, SBProcess process, SBEvent event, FILE * out, FILE * err)
source code
 
CreateTargetWithFileAndTargetTriple(self, *args)
CreateTargetWithFileAndTargetTriple(SBDebugger self, str const * filename, str const * target_triple) -> SBTarget
source code
 
CreateTargetWithFileAndArch(self, *args)
CreateTargetWithFileAndArch(SBDebugger self, str const * filename, str const * archname) -> SBTarget
source code
 
CreateTarget(self, *args)
CreateTarget(SBDebugger self, str const * filename, str const * target_triple, str const * platform_name, bool add_dependent_modules, ...
source code
 
DeleteTarget(self, *args)
DeleteTarget(SBDebugger self, SBTarget target) -> bool
source code
 
GetTargetAtIndex(self, *args)
GetTargetAtIndex(SBDebugger self, uint32_t idx) -> SBTarget
source code
 
GetIndexOfTarget(self, *args)
GetIndexOfTarget(SBDebugger self, SBTarget target) -> uint32_t
source code
 
FindTargetWithProcessID(self, *args)
FindTargetWithProcessID(SBDebugger self, lldb::pid_t pid) -> SBTarget
source code
 
FindTargetWithFileAndArch(self, *args)
FindTargetWithFileAndArch(SBDebugger self, str const * filename, str const * arch) -> SBTarget
source code
 
GetNumTargets(self)
GetNumTargets(SBDebugger self) -> uint32_t
source code
 
GetSelectedTarget(self)
GetSelectedTarget(SBDebugger self) -> SBTarget
source code
 
SetSelectedTarget(self, *args)
SetSelectedTarget(SBDebugger self, SBTarget target)
source code
 
GetSourceManager(self)
GetSourceManager(SBDebugger self) -> SBSourceManager
source code
 
SetCurrentPlatform(self, *args)
SetCurrentPlatform(SBDebugger self, str const * platform_name) -> SBError
source code
 
SetCurrentPlatformSDKRoot(self, *args)
SetCurrentPlatformSDKRoot(SBDebugger self, str const * sysroot) -> bool
source code
 
SetUseExternalEditor(self, *args)
SetUseExternalEditor(SBDebugger self, bool input) -> bool
source code
 
GetUseExternalEditor(self)
GetUseExternalEditor(SBDebugger self) -> bool
source code
 
GetScriptingLanguage(self, *args)
GetScriptingLanguage(SBDebugger self, str const * script_language_name) -> lldb::ScriptLanguage
source code
 
EnableLog(self, *args)
EnableLog(SBDebugger self, str const * channel, str const ** types) -> bool
source code
 
SetLoggingCallback(self, *args)
SetLoggingCallback(SBDebugger self, lldb::LogOutputCallback log_callback)
source code
 
DispatchInput(self, *args)
DispatchInput(SBDebugger self, void const * data)
source code
 
DispatchInputInterrupt(self)
DispatchInputInterrupt(SBDebugger self)
source code
 
DispatchInputEndOfFile(self)
DispatchInputEndOfFile(SBDebugger self)
source code
 
PushInputReader(self, *args)
PushInputReader(SBDebugger self, SBInputReader reader)
source code
 
NotifyTopInputReader(self, *args)
NotifyTopInputReader(SBDebugger self, lldb::InputReaderAction notification)
source code
 
InputReaderIsTopReader(self, *args)
InputReaderIsTopReader(SBDebugger self, SBInputReader reader) -> bool
source code
 
GetInstanceName(self)
GetInstanceName(SBDebugger self) -> str const *
source code
 
GetDescription(self, *args)
GetDescription(SBDebugger self, SBStream description) -> bool
source code
 
GetTerminalWidth(self)
GetTerminalWidth(SBDebugger self) -> uint32_t
source code
 
SetTerminalWidth(self, *args)
SetTerminalWidth(SBDebugger self, uint32_t term_width)
source code
 
GetID(self)
GetID(SBDebugger self) -> lldb::user_id_t
source code
 
GetPrompt(self)
GetPrompt(SBDebugger self) -> str const *
source code
 
SetPrompt(self, *args)
SetPrompt(SBDebugger self, str const * prompt)
source code
 
GetScriptLanguage(self)
GetScriptLanguage(SBDebugger self) -> lldb::ScriptLanguage
source code
 
SetScriptLanguage(self, *args)
SetScriptLanguage(SBDebugger self, lldb::ScriptLanguage script_lang)
source code
 
GetCloseInputOnEOF(self)
GetCloseInputOnEOF(SBDebugger self) -> bool
source code
 
SetCloseInputOnEOF(self, *args)
SetCloseInputOnEOF(SBDebugger self, bool b)
source code
 
GetCategory(self, *args)
GetCategory(SBDebugger self, str const * category_name) -> SBTypeCategory
source code
 
CreateCategory(self, *args)
CreateCategory(SBDebugger self, str const * category_name) -> SBTypeCategory
source code
 
DeleteCategory(self, *args)
DeleteCategory(SBDebugger self, str const * category_name) -> bool
source code
 
GetNumCategories(self)
GetNumCategories(SBDebugger self) -> uint32_t
source code
 
GetCategoryAtIndex(self, *args)
GetCategoryAtIndex(SBDebugger self, uint32_t arg2) -> SBTypeCategory
source code
 
GetDefaultCategory(self)
GetDefaultCategory(SBDebugger self) -> SBTypeCategory
source code
 
GetFormatForType(self, *args)
GetFormatForType(SBDebugger self, SBTypeNameSpecifier arg2) -> SBTypeFormat
source code
 
GetSummaryForType(self, *args)
GetSummaryForType(SBDebugger self, SBTypeNameSpecifier arg2) -> SBTypeSummary
source code
 
GetFilterForType(self, *args)
GetFilterForType(SBDebugger self, SBTypeNameSpecifier arg2) -> SBTypeFilter
source code
 
GetSyntheticForType(self, *args)
GetSyntheticForType(SBDebugger self, SBTypeNameSpecifier arg2) -> SBTypeSynthetic
source code
 
__str__(self)
__str__(SBDebugger self) -> PyObject *
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __sizeof__, __subclasshook__

Static Methods [hide private]
 
Initialize() source code
 
Terminate() source code
SBDebugger
Create()
Create(bool source_init_files) -> SBDebugger Create(bool source_init_files, lldb::LogOutputCallback log_callback) -> SBDebugger
source code
 
Destroy(*args)
Destroy(SBDebugger debugger)
source code
 
MemoryPressureDetected() source code
 
GetDefaultArchitecture(*args)
GetDefaultArchitecture(str * arch_name, size_t arch_name_len) -> bool
source code
 
SetDefaultArchitecture(*args)
SetDefaultArchitecture(str const * arch_name) -> bool
source code
str const *
GetVersionString() source code
 
StateAsCString(*args)
StateAsCString(lldb::StateType state) -> str const *
source code
 
StateIsRunningState(*args)
StateIsRunningState(lldb::StateType state) -> bool
source code
 
StateIsStoppedState(*args)
StateIsStoppedState(lldb::StateType state) -> bool
source code
 
FindDebuggerWithID(*args)
FindDebuggerWithID(int id) -> SBDebugger
source code
 
SetInternalVariable(*args)
SetInternalVariable(str const * var_name, str const * value, str const * debugger_instance_name) -> SBError
source code
 
GetInternalVariableValue(*args)
GetInternalVariableValue(str const * var_name, str const * debugger_instance_name) -> SBStringList
source code
Class Variables [hide private]
  __swig_setmethods__ = {}
  __swig_getmethods__ = {}
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__setattr__(self, name, value)

source code 

x.__setattr__('name', value) <==> x.name = value

Overrides: object.__setattr__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__init__(self, *args)
(Constructor)

source code 

__init__(lldb::SBDebugger self) -> SBDebugger __init__(lldb::SBDebugger self, SBDebugger rhs) -> SBDebugger

Overrides: object.__init__

CreateTarget(self, *args)

source code 

CreateTarget(SBDebugger self, str const * filename, str const * target_triple, str const * platform_name, bool add_dependent_modules, 
    SBError sb_error) -> SBTarget
CreateTarget(SBDebugger self, str const * filename) -> SBTarget

DeleteTarget(self, *args)

source code 

DeleteTarget(SBDebugger self, SBTarget target) -> bool

Return true if target is deleted from the target list of the debugger.

__str__(self)
(Informal representation operator)

source code 

__str__(SBDebugger self) -> PyObject *

Overrides: object.__str__