forked from OSchip/llvm-project
Add SWIG Python interface files for SBProcess, SBThread, and SBFrame.
llvm-svn: 135419
This commit is contained in:
parent
338879a7f4
commit
357033b337
|
@ -17,18 +17,8 @@ namespace lldb {
|
|||
|
||||
class SBValue;
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring",
|
||||
"Represents one of the stack frames associated with a thread."
|
||||
" SBThread contains SBFrame(s)."
|
||||
) SBFrame;
|
||||
#endif
|
||||
class SBFrame
|
||||
{
|
||||
#ifdef SWIG
|
||||
%feature("autodoc", "1");
|
||||
#endif
|
||||
|
||||
public:
|
||||
SBFrame ();
|
||||
|
||||
|
@ -77,21 +67,12 @@ public:
|
|||
lldb::SBSymbol
|
||||
GetSymbol () const;
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring", "
|
||||
#endif
|
||||
/// Gets the deepest block that contains the frame PC.
|
||||
///
|
||||
/// See also GetFrameBlock().
|
||||
#ifdef SWIG
|
||||
") GetBlock;
|
||||
#endif
|
||||
lldb::SBBlock
|
||||
GetBlock () const;
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring", "
|
||||
#endif
|
||||
/// Get the appropriate function name for this frame. Inlined functions in
|
||||
/// LLDB are represented by Blocks that have inlined function information, so
|
||||
/// just looking at the SBFunction or SBSymbol for a frame isn't enough.
|
||||
|
@ -105,41 +86,23 @@ public:
|
|||
/// - NULL
|
||||
///
|
||||
/// See also IsInlined().
|
||||
#ifdef SWIG
|
||||
") GetFunctionName;
|
||||
#endif
|
||||
const char *
|
||||
GetFunctionName();
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring", "
|
||||
#endif
|
||||
/// Return true if this frame represents an inlined function.
|
||||
///
|
||||
/// See also GetFunctionName().
|
||||
#ifdef SWIG
|
||||
") IsInlined;
|
||||
#endif
|
||||
bool
|
||||
IsInlined();
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring", "
|
||||
#endif
|
||||
/// The version that doesn't supply a 'use_dynamic' value will use the
|
||||
/// target's default.
|
||||
#ifdef SWIG
|
||||
") EvaluateExpression;
|
||||
#endif
|
||||
lldb::SBValue
|
||||
EvaluateExpression (const char *expr);
|
||||
|
||||
lldb::SBValue
|
||||
EvaluateExpression (const char *expr, lldb::DynamicValueType use_dynamic);
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring", "
|
||||
#endif
|
||||
/// Gets the lexical block that defines the stack frame. Another way to think
|
||||
/// of this is it will return the block that contains all of the variables
|
||||
/// for a stack frame. Inlined functions are represented as SBBlock objects
|
||||
|
@ -152,9 +115,6 @@ public:
|
|||
/// in one of those inlined functions, this method will return the inlined
|
||||
/// block that defines this frame. If the PC isn't currently in an inlined
|
||||
/// function, the lexical block that defines the function is returned.
|
||||
#ifdef SWIG
|
||||
") GetFrameBlock;
|
||||
#endif
|
||||
lldb::SBBlock
|
||||
GetFrameBlock () const;
|
||||
|
||||
|
@ -179,14 +139,8 @@ public:
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring", "
|
||||
#endif
|
||||
/// The version that doesn't supply a 'use_dynamic' value will use the
|
||||
/// target's default.
|
||||
#ifdef SWIG
|
||||
") GetVariables;
|
||||
#endif
|
||||
lldb::SBValueList
|
||||
GetVariables (bool arguments,
|
||||
bool locals,
|
||||
|
@ -203,31 +157,19 @@ public:
|
|||
lldb::SBValueList
|
||||
GetRegisters ();
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring", "
|
||||
#endif
|
||||
/// The version that doesn't supply a 'use_dynamic' value will use the
|
||||
/// target's default.
|
||||
#ifdef SWIG
|
||||
") FindVariable;
|
||||
#endif
|
||||
lldb::SBValue
|
||||
FindVariable (const char *var_name);
|
||||
|
||||
lldb::SBValue
|
||||
FindVariable (const char *var_name, lldb::DynamicValueType use_dynamic);
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring", "
|
||||
#endif
|
||||
/// Find variables, register sets, registers, or persistent variables using
|
||||
/// the frame as the scope.
|
||||
///
|
||||
/// The version that doesn't supply a 'use_dynamic' value will use the
|
||||
/// target's default.
|
||||
#ifdef SWIG
|
||||
") FindValue;
|
||||
#endif
|
||||
lldb::SBValue
|
||||
FindValue (const char *name, ValueType value_type);
|
||||
|
||||
|
|
|
@ -19,37 +19,8 @@ namespace lldb {
|
|||
|
||||
class SBEvent;
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring",
|
||||
"Represents the process associated with the target program.
|
||||
|
||||
SBProcess supports thread iteration. For example (from test/lldbutil.py),
|
||||
|
||||
# ==================================================
|
||||
# Utility functions related to Threads and Processes
|
||||
# ==================================================
|
||||
|
||||
def get_stopped_threads(process, reason):
|
||||
'''Returns the thread(s) with the specified stop reason in a list.
|
||||
|
||||
The list can be empty if no such thread exists.
|
||||
'''
|
||||
threads = []
|
||||
for t in process:
|
||||
if t.GetStopReason() == reason:
|
||||
threads.append(t)
|
||||
return threads
|
||||
|
||||
...
|
||||
"
|
||||
) SBProcess;
|
||||
#endif
|
||||
class SBProcess
|
||||
{
|
||||
#ifdef SWIG
|
||||
%feature("autodoc", "1");
|
||||
#endif
|
||||
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
/// Broadcaster event bits definitions.
|
||||
|
@ -100,26 +71,15 @@ public:
|
|||
void
|
||||
AppendEventStateReport (const lldb::SBEvent &event, lldb::SBCommandReturnObject &result);
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring", "
|
||||
#endif
|
||||
//------------------------------------------------------------------
|
||||
/// Remote connection related functions. These will fail if the
|
||||
/// process is not in eStateConnected. They are intended for use
|
||||
/// when connecting to an externally managed debugserver instance.
|
||||
//------------------------------------------------------------------
|
||||
#ifdef SWIG
|
||||
") RemoteAttachToProcessWithID;
|
||||
#endif
|
||||
bool
|
||||
RemoteAttachToProcessWithID (lldb::pid_t pid,
|
||||
lldb::SBError& error);
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring",
|
||||
"See SBTarget.Launch for argument description and usage."
|
||||
) RemoteLaunch;
|
||||
#endif
|
||||
bool
|
||||
RemoteLaunch (char const **argv,
|
||||
char const **envp,
|
||||
|
@ -171,12 +131,6 @@ public:
|
|||
uint32_t
|
||||
GetAddressByteSize() const;
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring",
|
||||
"Kills the process and shuts down all threads that were spawned to"
|
||||
" track and monitor process."
|
||||
) Destroy;
|
||||
#endif
|
||||
lldb::SBError
|
||||
Destroy ();
|
||||
|
||||
|
@ -186,48 +140,18 @@ public:
|
|||
lldb::SBError
|
||||
Stop ();
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring", "Same as Destroy(self).") Destroy;
|
||||
#endif
|
||||
lldb::SBError
|
||||
Kill ();
|
||||
|
||||
lldb::SBError
|
||||
Detach ();
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring", "Sends the process a unix signal.") Signal;
|
||||
#endif
|
||||
lldb::SBError
|
||||
Signal (int signal);
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("autodoc",
|
||||
"Reads memory from the current process's address space and removes any
|
||||
traps that may have been inserted into the memory. It returns the byte
|
||||
buffer in a Python string. Example:
|
||||
|
||||
# Read 4 bytes from address 'addr' and assume error.Success() is True.
|
||||
content = process.ReadMemory(addr, 4, error)
|
||||
# Use 'ascii' encoding as each byte of 'content' is within [0..255].
|
||||
new_bytes = bytearray(content, 'ascii')"
|
||||
) ReadMemory;
|
||||
#endif
|
||||
size_t
|
||||
ReadMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("autodoc",
|
||||
"Writes memory to the current process's address space and maintains any
|
||||
traps that might be present due to software breakpoints. Example:
|
||||
|
||||
# Create a Python string from the byte array.
|
||||
new_value = str(bytes)
|
||||
result = process.WriteMemory(addr, new_value, error)
|
||||
if not error.Success() or result != len(bytes):
|
||||
print 'SBProcess.WriteMemory() failed!'"
|
||||
) WriteMemory;
|
||||
#endif
|
||||
size_t
|
||||
WriteMemory (addr_t addr, const void *buf, size_t size, lldb::SBError &error);
|
||||
|
||||
|
|
|
@ -18,38 +18,8 @@ namespace lldb {
|
|||
|
||||
class SBFrame;
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring",
|
||||
"Represents a thread of execution. SBProcess contains SBThread(s).
|
||||
|
||||
SBThread supports frame iteration. For example (from test/python_api/
|
||||
lldbutil/iter/TestLLDBIterator.py),
|
||||
|
||||
from lldbutil import print_stacktrace
|
||||
stopped_due_to_breakpoint = False
|
||||
for thread in process:
|
||||
if self.TraceOn():
|
||||
print_stacktrace(thread)
|
||||
ID = thread.GetThreadID()
|
||||
if thread.GetStopReason() == lldb.eStopReasonBreakpoint:
|
||||
stopped_due_to_breakpoint = True
|
||||
for frame in thread:
|
||||
self.assertTrue(frame.GetThread().GetThreadID() == ID)
|
||||
if self.TraceOn():
|
||||
print frame
|
||||
|
||||
self.assertTrue(stopped_due_to_breakpoint)
|
||||
|
||||
See also SBProcess and SBFrame.
|
||||
"
|
||||
) SBThread;
|
||||
#endif
|
||||
class SBThread
|
||||
{
|
||||
#ifdef SWIG
|
||||
%feature("autodoc", "1");
|
||||
#endif
|
||||
|
||||
public:
|
||||
SBThread ();
|
||||
|
||||
|
@ -66,20 +36,11 @@ public:
|
|||
lldb::StopReason
|
||||
GetStopReason();
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring", "
|
||||
#endif
|
||||
/// Get the number of words associated with the stop reason.
|
||||
/// See also GetStopReasonDataAtIndex().
|
||||
#ifdef SWIG
|
||||
") GetStopReasonDataCount;
|
||||
#endif
|
||||
size_t
|
||||
GetStopReasonDataCount();
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring", "
|
||||
#endif
|
||||
//--------------------------------------------------------------------------
|
||||
/// Get information associated with a stop reason.
|
||||
///
|
||||
|
@ -97,9 +58,6 @@ public:
|
|||
/// eStopReasonException N exception data
|
||||
/// eStopReasonPlanComplete 0
|
||||
//--------------------------------------------------------------------------
|
||||
#ifdef SWIG
|
||||
") GetStopReasonDataAtIndex;
|
||||
#endif
|
||||
uint64_t
|
||||
GetStopReasonDataAtIndex(uint32_t idx);
|
||||
|
||||
|
@ -141,9 +99,6 @@ public:
|
|||
void
|
||||
RunToAddress (lldb::addr_t addr);
|
||||
|
||||
#ifdef SWIG
|
||||
%feature("docstring", "
|
||||
#endif
|
||||
//--------------------------------------------------------------------------
|
||||
/// LLDB currently supports process centric debugging which means when any
|
||||
/// thread in a process stops, all other threads are stopped. The Suspend()
|
||||
|
@ -165,9 +120,6 @@ public:
|
|||
/// anyone has the need for them to be reference counted, please let us
|
||||
/// know.
|
||||
//--------------------------------------------------------------------------
|
||||
#ifdef SWIG
|
||||
") Suspend;
|
||||
#endif
|
||||
bool
|
||||
Suspend();
|
||||
|
||||
|
|
|
@ -0,0 +1,191 @@
|
|||
//===-- SWIG Interface for SBFrame ------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents one of the stack frames associated with a thread.
|
||||
SBThread contains SBFrame(s)."
|
||||
) SBFrame;
|
||||
class SBFrame
|
||||
{
|
||||
public:
|
||||
SBFrame ();
|
||||
|
||||
SBFrame (const lldb::SBFrame &rhs);
|
||||
|
||||
~SBFrame();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
uint32_t
|
||||
GetFrameID () const;
|
||||
|
||||
lldb::addr_t
|
||||
GetPC () const;
|
||||
|
||||
bool
|
||||
SetPC (lldb::addr_t new_pc);
|
||||
|
||||
lldb::addr_t
|
||||
GetSP () const;
|
||||
|
||||
lldb::addr_t
|
||||
GetFP () const;
|
||||
|
||||
lldb::SBAddress
|
||||
GetPCAddress () const;
|
||||
|
||||
lldb::SBSymbolContext
|
||||
GetSymbolContext (uint32_t resolve_scope) const;
|
||||
|
||||
lldb::SBModule
|
||||
GetModule () const;
|
||||
|
||||
lldb::SBCompileUnit
|
||||
GetCompileUnit () const;
|
||||
|
||||
lldb::SBFunction
|
||||
GetFunction () const;
|
||||
|
||||
lldb::SBSymbol
|
||||
GetSymbol () const;
|
||||
|
||||
%feature("docstring", "
|
||||
/// Gets the deepest block that contains the frame PC.
|
||||
///
|
||||
/// See also GetFrameBlock().
|
||||
") GetBlock;
|
||||
lldb::SBBlock
|
||||
GetBlock () const;
|
||||
|
||||
%feature("docstring", "
|
||||
/// Get the appropriate function name for this frame. Inlined functions in
|
||||
/// LLDB are represented by Blocks that have inlined function information, so
|
||||
/// just looking at the SBFunction or SBSymbol for a frame isn't enough.
|
||||
/// This function will return the appriopriate function, symbol or inlined
|
||||
/// function name for the frame.
|
||||
///
|
||||
/// This function returns:
|
||||
/// - the name of the inlined function (if there is one)
|
||||
/// - the name of the concrete function (if there is one)
|
||||
/// - the name of the symbol (if there is one)
|
||||
/// - NULL
|
||||
///
|
||||
/// See also IsInlined().
|
||||
") GetFunctionName;
|
||||
const char *
|
||||
GetFunctionName();
|
||||
|
||||
%feature("docstring", "
|
||||
/// Return true if this frame represents an inlined function.
|
||||
///
|
||||
/// See also GetFunctionName().
|
||||
") IsInlined;
|
||||
bool
|
||||
IsInlined();
|
||||
|
||||
%feature("docstring", "
|
||||
/// The version that doesn't supply a 'use_dynamic' value will use the
|
||||
/// target's default.
|
||||
") EvaluateExpression;
|
||||
lldb::SBValue
|
||||
EvaluateExpression (const char *expr);
|
||||
|
||||
lldb::SBValue
|
||||
EvaluateExpression (const char *expr, lldb::DynamicValueType use_dynamic);
|
||||
|
||||
%feature("docstring", "
|
||||
/// Gets the lexical block that defines the stack frame. Another way to think
|
||||
/// of this is it will return the block that contains all of the variables
|
||||
/// for a stack frame. Inlined functions are represented as SBBlock objects
|
||||
/// that have inlined function information: the name of the inlined function,
|
||||
/// where it was called from. The block that is returned will be the first
|
||||
/// block at or above the block for the PC (SBFrame::GetBlock()) that defines
|
||||
/// the scope of the frame. When a function contains no inlined functions,
|
||||
/// this will be the top most lexical block that defines the function.
|
||||
/// When a function has inlined functions and the PC is currently
|
||||
/// in one of those inlined functions, this method will return the inlined
|
||||
/// block that defines this frame. If the PC isn't currently in an inlined
|
||||
/// function, the lexical block that defines the function is returned.
|
||||
") GetFrameBlock;
|
||||
lldb::SBBlock
|
||||
GetFrameBlock () const;
|
||||
|
||||
lldb::SBLineEntry
|
||||
GetLineEntry () const;
|
||||
|
||||
lldb::SBThread
|
||||
GetThread () const;
|
||||
|
||||
const char *
|
||||
Disassemble () const;
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
#ifndef SWIG
|
||||
bool
|
||||
operator == (const lldb::SBFrame &rhs) const;
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBFrame &rhs) const;
|
||||
|
||||
#endif
|
||||
|
||||
%feature("docstring", "
|
||||
/// The version that doesn't supply a 'use_dynamic' value will use the
|
||||
/// target's default.
|
||||
") GetVariables;
|
||||
lldb::SBValueList
|
||||
GetVariables (bool arguments,
|
||||
bool locals,
|
||||
bool statics,
|
||||
bool in_scope_only);
|
||||
|
||||
lldb::SBValueList
|
||||
GetVariables (bool arguments,
|
||||
bool locals,
|
||||
bool statics,
|
||||
bool in_scope_only,
|
||||
lldb::DynamicValueType use_dynamic);
|
||||
|
||||
lldb::SBValueList
|
||||
GetRegisters ();
|
||||
|
||||
%feature("docstring", "
|
||||
/// The version that doesn't supply a 'use_dynamic' value will use the
|
||||
/// target's default.
|
||||
") FindVariable;
|
||||
lldb::SBValue
|
||||
FindVariable (const char *var_name);
|
||||
|
||||
lldb::SBValue
|
||||
FindVariable (const char *var_name, lldb::DynamicValueType use_dynamic);
|
||||
|
||||
%feature("docstring", "
|
||||
/// Find variables, register sets, registers, or persistent variables using
|
||||
/// the frame as the scope.
|
||||
///
|
||||
/// The version that doesn't supply a 'use_dynamic' value will use the
|
||||
/// target's default.
|
||||
") FindValue;
|
||||
lldb::SBValue
|
||||
FindValue (const char *name, ValueType value_type);
|
||||
|
||||
lldb::SBValue
|
||||
FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
|
@ -0,0 +1,220 @@
|
|||
//===-- SWIG Interface for SBProcess ----------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents the process associated with the target program.
|
||||
|
||||
SBProcess supports thread iteration. For example (from test/lldbutil.py),
|
||||
|
||||
# ==================================================
|
||||
# Utility functions related to Threads and Processes
|
||||
# ==================================================
|
||||
|
||||
def get_stopped_threads(process, reason):
|
||||
'''Returns the thread(s) with the specified stop reason in a list.
|
||||
|
||||
The list can be empty if no such thread exists.
|
||||
'''
|
||||
threads = []
|
||||
for t in process:
|
||||
if t.GetStopReason() == reason:
|
||||
threads.append(t)
|
||||
return threads
|
||||
|
||||
...
|
||||
"
|
||||
) SBProcess;
|
||||
class SBProcess
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
/// Broadcaster event bits definitions.
|
||||
//------------------------------------------------------------------
|
||||
enum
|
||||
{
|
||||
eBroadcastBitStateChanged = (1 << 0),
|
||||
eBroadcastBitInterrupt = (1 << 1),
|
||||
eBroadcastBitSTDOUT = (1 << 2),
|
||||
eBroadcastBitSTDERR = (1 << 3)
|
||||
};
|
||||
|
||||
SBProcess ();
|
||||
|
||||
SBProcess (const lldb::SBProcess& rhs);
|
||||
|
||||
~SBProcess();
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
lldb::SBTarget
|
||||
GetTarget() const;
|
||||
|
||||
lldb::ByteOrder
|
||||
GetByteOrder() const;
|
||||
|
||||
size_t
|
||||
PutSTDIN (const char *src, size_t src_len);
|
||||
|
||||
size_t
|
||||
GetSTDOUT (char *dst, size_t dst_len) const;
|
||||
|
||||
size_t
|
||||
GetSTDERR (char *dst, size_t dst_len) const;
|
||||
|
||||
void
|
||||
ReportEventState (const lldb::SBEvent &event, FILE *out) const;
|
||||
|
||||
void
|
||||
AppendEventStateReport (const lldb::SBEvent &event, lldb::SBCommandReturnObject &result);
|
||||
|
||||
%feature("docstring", "
|
||||
//------------------------------------------------------------------
|
||||
/// Remote connection related functions. These will fail if the
|
||||
/// process is not in eStateConnected. They are intended for use
|
||||
/// when connecting to an externally managed debugserver instance.
|
||||
//------------------------------------------------------------------
|
||||
") RemoteAttachToProcessWithID;
|
||||
bool
|
||||
RemoteAttachToProcessWithID (lldb::pid_t pid,
|
||||
lldb::SBError& error);
|
||||
|
||||
%feature("docstring",
|
||||
"See SBTarget.Launch for argument description and usage."
|
||||
) RemoteLaunch;
|
||||
bool
|
||||
RemoteLaunch (char const **argv,
|
||||
char const **envp,
|
||||
const char *stdin_path,
|
||||
const char *stdout_path,
|
||||
const char *stderr_path,
|
||||
const char *working_directory,
|
||||
uint32_t launch_flags,
|
||||
bool stop_at_entry,
|
||||
lldb::SBError& error);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Thread related functions
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
GetNumThreads ();
|
||||
|
||||
lldb::SBThread
|
||||
GetThreadAtIndex (size_t index);
|
||||
|
||||
lldb::SBThread
|
||||
GetThreadByID (lldb::tid_t sb_thread_id);
|
||||
|
||||
lldb::SBThread
|
||||
GetSelectedThread () const;
|
||||
|
||||
bool
|
||||
SetSelectedThread (const lldb::SBThread &thread);
|
||||
|
||||
bool
|
||||
SetSelectedThreadByID (uint32_t tid);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Stepping related functions
|
||||
//------------------------------------------------------------------
|
||||
|
||||
lldb::StateType
|
||||
GetState ();
|
||||
|
||||
int
|
||||
GetExitStatus ();
|
||||
|
||||
const char *
|
||||
GetExitDescription ();
|
||||
|
||||
lldb::pid_t
|
||||
GetProcessID ();
|
||||
|
||||
uint32_t
|
||||
GetAddressByteSize() const;
|
||||
|
||||
%feature("docstring", "
|
||||
Kills the process and shuts down all threads that were spawned to
|
||||
track and monitor process.
|
||||
") Destroy;
|
||||
lldb::SBError
|
||||
Destroy ();
|
||||
|
||||
lldb::SBError
|
||||
Continue ();
|
||||
|
||||
lldb::SBError
|
||||
Stop ();
|
||||
|
||||
%feature("docstring", "Same as Destroy(self).") Destroy;
|
||||
lldb::SBError
|
||||
Kill ();
|
||||
|
||||
lldb::SBError
|
||||
Detach ();
|
||||
|
||||
%feature("docstring", "Sends the process a unix signal.") Signal;
|
||||
lldb::SBError
|
||||
Signal (int signal);
|
||||
|
||||
%feature("autodoc", "
|
||||
Reads memory from the current process's address space and removes any
|
||||
traps that may have been inserted into the memory. It returns the byte
|
||||
buffer in a Python string. Example:
|
||||
|
||||
# Read 4 bytes from address 'addr' and assume error.Success() is True.
|
||||
content = process.ReadMemory(addr, 4, error)
|
||||
# Use 'ascii' encoding as each byte of 'content' is within [0..255].
|
||||
new_bytes = bytearray(content, 'ascii')
|
||||
") ReadMemory;
|
||||
size_t
|
||||
ReadMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);
|
||||
|
||||
%feature("autodoc", "
|
||||
Writes memory to the current process's address space and maintains any
|
||||
traps that might be present due to software breakpoints. Example:
|
||||
|
||||
# Create a Python string from the byte array.
|
||||
new_value = str(bytes)
|
||||
result = process.WriteMemory(addr, new_value, error)
|
||||
if not error.Success() or result != len(bytes):
|
||||
print 'SBProcess.WriteMemory() failed!'
|
||||
") WriteMemory;
|
||||
size_t
|
||||
WriteMemory (addr_t addr, const void *buf, size_t size, lldb::SBError &error);
|
||||
|
||||
// Events
|
||||
static lldb::StateType
|
||||
GetStateFromEvent (const lldb::SBEvent &event);
|
||||
|
||||
static bool
|
||||
GetRestartedFromEvent (const lldb::SBEvent &event);
|
||||
|
||||
static lldb::SBProcess
|
||||
GetProcessFromEvent (const lldb::SBEvent &event);
|
||||
|
||||
lldb::SBBroadcaster
|
||||
GetBroadcaster () const;
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
uint32_t
|
||||
LoadImage (lldb::SBFileSpec &image_spec, lldb::SBError &error);
|
||||
|
||||
lldb::SBError
|
||||
UnloadImage (uint32_t image_token);
|
||||
};
|
||||
|
||||
} // namespace lldb
|
|
@ -34,9 +34,8 @@ and,
|
|||
produces:
|
||||
|
||||
SBBreakpoint: id = 1, file ='main.cpp', line = 66, locations = 1
|
||||
SBBreakpoint: id = 2, file ='main.cpp', line = 85, locations = 1
|
||||
"
|
||||
) SBTarget;
|
||||
SBBreakpoint: id = 2, file ='main.cpp', line = 85, locations = 1"
|
||||
) SBTarget;
|
||||
class SBTarget
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -0,0 +1,171 @@
|
|||
//===-- SWIG Interface for SBThread -----------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a thread of execution. SBProcess contains SBThread(s).
|
||||
|
||||
SBThread supports frame iteration. For example (from test/python_api/
|
||||
lldbutil/iter/TestLLDBIterator.py),
|
||||
|
||||
from lldbutil import print_stacktrace
|
||||
stopped_due_to_breakpoint = False
|
||||
for thread in process:
|
||||
if self.TraceOn():
|
||||
print_stacktrace(thread)
|
||||
ID = thread.GetThreadID()
|
||||
if thread.GetStopReason() == lldb.eStopReasonBreakpoint:
|
||||
stopped_due_to_breakpoint = True
|
||||
for frame in thread:
|
||||
self.assertTrue(frame.GetThread().GetThreadID() == ID)
|
||||
if self.TraceOn():
|
||||
print frame
|
||||
|
||||
self.assertTrue(stopped_due_to_breakpoint)
|
||||
|
||||
See also SBProcess and SBFrame."
|
||||
) SBThread;
|
||||
class SBThread
|
||||
{
|
||||
public:
|
||||
SBThread ();
|
||||
|
||||
SBThread (const lldb::SBThread &thread);
|
||||
|
||||
~SBThread();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
lldb::StopReason
|
||||
GetStopReason();
|
||||
|
||||
%feature("docstring", "
|
||||
/// Get the number of words associated with the stop reason.
|
||||
/// See also GetStopReasonDataAtIndex().
|
||||
") GetStopReasonDataCount;
|
||||
size_t
|
||||
GetStopReasonDataCount();
|
||||
|
||||
%feature("docstring", "
|
||||
//--------------------------------------------------------------------------
|
||||
/// Get information associated with a stop reason.
|
||||
///
|
||||
/// Breakpoint stop reasons will have data that consists of pairs of
|
||||
/// breakpoint IDs followed by the breakpoint location IDs (they always come
|
||||
/// in pairs).
|
||||
///
|
||||
/// Stop Reason Count Data Type
|
||||
/// ======================== ===== =========================================
|
||||
/// eStopReasonNone 0
|
||||
/// eStopReasonTrace 0
|
||||
/// eStopReasonBreakpoint N duple: {breakpoint id, location id}
|
||||
/// eStopReasonWatchpoint N duple: {watchpoint id, location id}
|
||||
/// eStopReasonSignal 1 unix signal number
|
||||
/// eStopReasonException N exception data
|
||||
/// eStopReasonPlanComplete 0
|
||||
//--------------------------------------------------------------------------
|
||||
") GetStopReasonDataAtIndex;
|
||||
uint64_t
|
||||
GetStopReasonDataAtIndex(uint32_t idx);
|
||||
|
||||
size_t
|
||||
GetStopDescription (char *dst, size_t dst_len);
|
||||
|
||||
lldb::tid_t
|
||||
GetThreadID () const;
|
||||
|
||||
uint32_t
|
||||
GetIndexID () const;
|
||||
|
||||
const char *
|
||||
GetName () const;
|
||||
|
||||
const char *
|
||||
GetQueueName() const;
|
||||
|
||||
void
|
||||
StepOver (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
|
||||
|
||||
void
|
||||
StepInto (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
|
||||
|
||||
void
|
||||
StepOut ();
|
||||
|
||||
void
|
||||
StepOutOfFrame (lldb::SBFrame &frame);
|
||||
|
||||
void
|
||||
StepInstruction(bool step_over);
|
||||
|
||||
SBError
|
||||
StepOverUntil (lldb::SBFrame &frame,
|
||||
lldb::SBFileSpec &file_spec,
|
||||
uint32_t line);
|
||||
|
||||
void
|
||||
RunToAddress (lldb::addr_t addr);
|
||||
|
||||
%feature("docstring", "
|
||||
//--------------------------------------------------------------------------
|
||||
/// LLDB currently supports process centric debugging which means when any
|
||||
/// thread in a process stops, all other threads are stopped. The Suspend()
|
||||
/// call here tells our process to suspend a thread and not let it run when
|
||||
/// the other threads in a process are allowed to run. So when
|
||||
/// SBProcess::Continue() is called, any threads that aren't suspended will
|
||||
/// be allowed to run. If any of the SBThread functions for stepping are
|
||||
/// called (StepOver, StepInto, StepOut, StepInstruction, RunToAddres), the
|
||||
/// thread will now be allowed to run and these funtions will simply return.
|
||||
///
|
||||
/// Eventually we plan to add support for thread centric debugging where
|
||||
/// each thread is controlled individually and each thread would broadcast
|
||||
/// its state, but we haven't implemented this yet.
|
||||
///
|
||||
/// Likewise the SBThread::Resume() call will again allow the thread to run
|
||||
/// when the process is continued.
|
||||
///
|
||||
/// Suspend() and Resume() functions are not currently reference counted, if
|
||||
/// anyone has the need for them to be reference counted, please let us
|
||||
/// know.
|
||||
//--------------------------------------------------------------------------
|
||||
") Suspend;
|
||||
bool
|
||||
Suspend();
|
||||
|
||||
bool
|
||||
Resume ();
|
||||
|
||||
bool
|
||||
IsSuspended();
|
||||
|
||||
uint32_t
|
||||
GetNumFrames ();
|
||||
|
||||
lldb::SBFrame
|
||||
GetFrameAtIndex (uint32_t idx);
|
||||
|
||||
lldb::SBFrame
|
||||
GetSelectedFrame ();
|
||||
|
||||
lldb::SBFrame
|
||||
SetSelectedFrame (uint32_t frame_idx);
|
||||
|
||||
lldb::SBProcess
|
||||
GetProcess ();
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description) const;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
|
@ -49,9 +49,8 @@ Name: rip Value: 0x0000000100000dae
|
|||
Name: rflags Value: 0x0000000000000206
|
||||
Name: cs Value: 0x0000000000000027
|
||||
Name: fs Value: 0x0000000000000010
|
||||
Name: gs Value: 0x0000000000000048
|
||||
"
|
||||
) SBValue;
|
||||
Name: gs Value: 0x0000000000000048"
|
||||
) SBValue;
|
||||
class SBValue
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -64,9 +64,8 @@ def get_ESRs(frame):
|
|||
print '%s => %s' % (reg.GetName(), reg.GetValue())
|
||||
...
|
||||
'''
|
||||
return get_registers(frame, 'exception state')
|
||||
"
|
||||
) SBValueList;
|
||||
return get_registers(frame, 'exception state')"
|
||||
) SBValueList;
|
||||
class SBValueList
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -209,7 +209,7 @@ o SBLineEntry: Specifies an association with a contiguous range of instructions
|
|||
%include "lldb/API/SBError.h"
|
||||
%include "lldb/API/SBEvent.h"
|
||||
%include "lldb/API/SBFileSpec.h"
|
||||
%include "lldb/API/SBFrame.h"
|
||||
%include "./Python/interface/SBFrame.i"
|
||||
%include "lldb/API/SBFunction.h"
|
||||
%include "lldb/API/SBHostOS.h"
|
||||
%include "lldb/API/SBInputReader.h"
|
||||
|
@ -218,7 +218,7 @@ o SBLineEntry: Specifies an association with a contiguous range of instructions
|
|||
%include "lldb/API/SBLineEntry.h"
|
||||
%include "lldb/API/SBListener.h"
|
||||
%include "lldb/API/SBModule.h"
|
||||
%include "lldb/API/SBProcess.h"
|
||||
%include "./Python/interface/SBProcess.i"
|
||||
%include "lldb/API/SBSourceManager.h"
|
||||
%include "lldb/API/SBStream.h"
|
||||
%include "lldb/API/SBStringList.h"
|
||||
|
@ -226,7 +226,7 @@ o SBLineEntry: Specifies an association with a contiguous range of instructions
|
|||
%include "lldb/API/SBSymbolContext.h"
|
||||
%include "lldb/API/SBSymbolContextList.h"
|
||||
%include "./Python/interface/SBTarget.i"
|
||||
%include "lldb/API/SBThread.h"
|
||||
%include "./Python/interface/SBThread.i"
|
||||
%include "lldb/API/SBType.h"
|
||||
%include "./Python/interface/SBValue.i"
|
||||
%include "./Python/interface/SBValueList.i"
|
||||
|
|
Loading…
Reference in New Issue