forked from OSchip/llvm-project
Add SWIG interface files for SBSymbol, SBSymbolContext, and SBSymbolContextList.
llvm-svn: 135459
This commit is contained in:
parent
7ca23dde4e
commit
349f076330
|
@ -17,16 +17,8 @@
|
||||||
|
|
||||||
namespace lldb {
|
namespace lldb {
|
||||||
|
|
||||||
#ifdef SWIG
|
|
||||||
%feature("docstring",
|
|
||||||
"Represents the symbol possibly associated with a stack frame."
|
|
||||||
) SBSymbol;
|
|
||||||
#endif
|
|
||||||
class SBSymbol
|
class SBSymbol
|
||||||
{
|
{
|
||||||
#ifdef SWIG
|
|
||||||
%feature("autodoc", "1");
|
|
||||||
#endif
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SBSymbol ();
|
SBSymbol ();
|
||||||
|
|
|
@ -20,50 +20,8 @@
|
||||||
|
|
||||||
namespace lldb {
|
namespace lldb {
|
||||||
|
|
||||||
#ifdef SWIG
|
|
||||||
%feature("docstring",
|
|
||||||
"A context object that provides access to core debugger entities.
|
|
||||||
|
|
||||||
Manay debugger functions require a context when doing lookups. This class
|
|
||||||
provides a common structure that can be used as the result of a query that
|
|
||||||
can contain a single result.
|
|
||||||
|
|
||||||
For example,
|
|
||||||
|
|
||||||
exe = os.path.join(os.getcwd(), 'a.out')
|
|
||||||
|
|
||||||
# Create a target for the debugger.
|
|
||||||
target = self.dbg.CreateTarget(exe)
|
|
||||||
|
|
||||||
# Now create a breakpoint on main.c by name 'c'.
|
|
||||||
breakpoint = target.BreakpointCreateByName('c', 'a.out')
|
|
||||||
|
|
||||||
# Now launch the process, and do not stop at entry point.
|
|
||||||
process = target.LaunchSimple(None, None, os.getcwd())
|
|
||||||
|
|
||||||
# The inferior should stop on 'c'.
|
|
||||||
from lldbutil import get_stopped_thread
|
|
||||||
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
|
||||||
frame0 = thread.GetFrameAtIndex(0)
|
|
||||||
|
|
||||||
# Now get the SBSymbolContext from this frame. We want everything. :-)
|
|
||||||
context = frame0.GetSymbolContext(lldb.eSymbolContextEverything)
|
|
||||||
|
|
||||||
# Get the module.
|
|
||||||
module = context.GetModule()
|
|
||||||
...
|
|
||||||
|
|
||||||
# And the compile unit associated with the frame.
|
|
||||||
compileUnit = context.GetCompileUnit()
|
|
||||||
...
|
|
||||||
"
|
|
||||||
) SBSymbolContext;
|
|
||||||
#endif
|
|
||||||
class SBSymbolContext
|
class SBSymbolContext
|
||||||
{
|
{
|
||||||
#ifdef SWIG
|
|
||||||
%feature("autodoc", "1");
|
|
||||||
#endif
|
|
||||||
public:
|
public:
|
||||||
SBSymbolContext ();
|
SBSymbolContext ();
|
||||||
|
|
||||||
|
|
|
@ -15,35 +15,8 @@
|
||||||
|
|
||||||
namespace lldb {
|
namespace lldb {
|
||||||
|
|
||||||
#ifdef SWIG
|
|
||||||
%feature("docstring",
|
|
||||||
"Represents a list of symbol context object. See also SBSymbolContext.
|
|
||||||
|
|
||||||
For example (from test/python_api/target/TestTargetAPI.py),
|
|
||||||
|
|
||||||
def find_functions(self, exe_name):
|
|
||||||
'''Exercise SBTaget.FindFunctions() API.'''
|
|
||||||
exe = os.path.join(os.getcwd(), exe_name)
|
|
||||||
|
|
||||||
# Create a target by the debugger.
|
|
||||||
target = self.dbg.CreateTarget(exe)
|
|
||||||
self.assertTrue(target, VALID_TARGET)
|
|
||||||
|
|
||||||
list = lldb.SBSymbolContextList()
|
|
||||||
num = target.FindFunctions('c', lldb.eFunctionNameTypeAuto, False, list)
|
|
||||||
self.assertTrue(num == 1 and list.GetSize() == 1)
|
|
||||||
|
|
||||||
for sc in list:
|
|
||||||
self.assertTrue(sc.GetModule().GetFileSpec().GetFilename() == exe_name)
|
|
||||||
self.assertTrue(sc.GetSymbol().GetName() == 'c')
|
|
||||||
"
|
|
||||||
) SBSymbolContextList;
|
|
||||||
#endif
|
|
||||||
class SBSymbolContextList
|
class SBSymbolContextList
|
||||||
{
|
{
|
||||||
#ifdef SWIG
|
|
||||||
%feature("autodoc", "1");
|
|
||||||
#endif
|
|
||||||
public:
|
public:
|
||||||
SBSymbolContextList ();
|
SBSymbolContextList ();
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,33 @@ namespace lldb {
|
||||||
|
|
||||||
%feature("docstring",
|
%feature("docstring",
|
||||||
"Represents one of the stack frames associated with a thread.
|
"Represents one of the stack frames associated with a thread.
|
||||||
SBThread contains SBFrame(s)."
|
SBThread contains SBFrame(s). For example (from test/lldbutil.py),
|
||||||
|
|
||||||
|
def print_stacktrace(thread, string_buffer = False):
|
||||||
|
'''Prints a simple stack trace of this thread.'''
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
for i in range(depth):
|
||||||
|
frame = thread.GetFrameAtIndex(i)
|
||||||
|
function = frame.GetFunction()
|
||||||
|
|
||||||
|
load_addr = addrs[i].GetLoadAddress(target)
|
||||||
|
if not function:
|
||||||
|
file_addr = addrs[i].GetFileAddress()
|
||||||
|
start_addr = frame.GetSymbol().GetStartAddress().GetFileAddress()
|
||||||
|
symbol_offset = file_addr - start_addr
|
||||||
|
print >> output, ' frame #{num}: {addr:#016x} {mod}`{symbol} + {offset}'.format(
|
||||||
|
num=i, addr=load_addr, mod=mods[i], symbol=symbols[i], offset=symbol_offset)
|
||||||
|
else:
|
||||||
|
print >> output, ' frame #{num}: {addr:#016x} {mod}`{func} at {file}:{line} {args}'.format(
|
||||||
|
num=i, addr=load_addr, mod=mods[i],
|
||||||
|
func='%s [inlined]' % funcs[i] if frame.IsInlined() else funcs[i],
|
||||||
|
file=files[i], line=lines[i],
|
||||||
|
args=get_args_as_string(frame, showFuncName=False) if not frame.IsInlined() else '()')
|
||||||
|
|
||||||
|
...
|
||||||
|
"
|
||||||
) SBFrame;
|
) SBFrame;
|
||||||
class SBFrame
|
class SBFrame
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
//===-- SWIG Interface for SBSymbol -----------------------------*- 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 symbol possibly associated with a stack frame.
|
||||||
|
SBModule contains SBSymbol(s). SBSymbol can also be retrived from SBFrame.
|
||||||
|
|
||||||
|
See also SBModule and SBFrame."
|
||||||
|
) SBSymbol;
|
||||||
|
class SBSymbol
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
SBSymbol ();
|
||||||
|
|
||||||
|
~SBSymbol ();
|
||||||
|
|
||||||
|
SBSymbol (const lldb::SBSymbol &rhs);
|
||||||
|
|
||||||
|
bool
|
||||||
|
IsValid () const;
|
||||||
|
|
||||||
|
|
||||||
|
const char *
|
||||||
|
GetName() const;
|
||||||
|
|
||||||
|
const char *
|
||||||
|
GetMangledName () const;
|
||||||
|
|
||||||
|
lldb::SBInstructionList
|
||||||
|
GetInstructions (lldb::SBTarget target);
|
||||||
|
|
||||||
|
SBAddress
|
||||||
|
GetStartAddress ();
|
||||||
|
|
||||||
|
SBAddress
|
||||||
|
GetEndAddress ();
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
GetPrologueByteSize ();
|
||||||
|
|
||||||
|
SymbolType
|
||||||
|
GetType ();
|
||||||
|
|
||||||
|
bool
|
||||||
|
GetDescription (lldb::SBStream &description);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace lldb
|
|
@ -0,0 +1,72 @@
|
||||||
|
//===-- SWIG Interface for SBSymbolContext ----------------------*- 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",
|
||||||
|
"A context object that provides access to core debugger entities.
|
||||||
|
|
||||||
|
Manay debugger functions require a context when doing lookups. This class
|
||||||
|
provides a common structure that can be used as the result of a query that
|
||||||
|
can contain a single result.
|
||||||
|
|
||||||
|
For example,
|
||||||
|
|
||||||
|
exe = os.path.join(os.getcwd(), 'a.out')
|
||||||
|
|
||||||
|
# Create a target for the debugger.
|
||||||
|
target = self.dbg.CreateTarget(exe)
|
||||||
|
|
||||||
|
# Now create a breakpoint on main.c by name 'c'.
|
||||||
|
breakpoint = target.BreakpointCreateByName('c', 'a.out')
|
||||||
|
|
||||||
|
# Now launch the process, and do not stop at entry point.
|
||||||
|
process = target.LaunchSimple(None, None, os.getcwd())
|
||||||
|
|
||||||
|
# The inferior should stop on 'c'.
|
||||||
|
from lldbutil import get_stopped_thread
|
||||||
|
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||||
|
frame0 = thread.GetFrameAtIndex(0)
|
||||||
|
|
||||||
|
# Now get the SBSymbolContext from this frame. We want everything. :-)
|
||||||
|
context = frame0.GetSymbolContext(lldb.eSymbolContextEverything)
|
||||||
|
|
||||||
|
# Get the module.
|
||||||
|
module = context.GetModule()
|
||||||
|
...
|
||||||
|
|
||||||
|
# And the compile unit associated with the frame.
|
||||||
|
compileUnit = context.GetCompileUnit()
|
||||||
|
...
|
||||||
|
"
|
||||||
|
) SBSymbolContext;
|
||||||
|
class SBSymbolContext
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SBSymbolContext ();
|
||||||
|
|
||||||
|
SBSymbolContext (const lldb::SBSymbolContext& rhs);
|
||||||
|
|
||||||
|
~SBSymbolContext ();
|
||||||
|
|
||||||
|
bool
|
||||||
|
IsValid () const;
|
||||||
|
|
||||||
|
SBModule GetModule ();
|
||||||
|
SBCompileUnit GetCompileUnit ();
|
||||||
|
SBFunction GetFunction ();
|
||||||
|
SBBlock GetBlock ();
|
||||||
|
SBLineEntry GetLineEntry ();
|
||||||
|
SBSymbol GetSymbol ();
|
||||||
|
|
||||||
|
bool
|
||||||
|
GetDescription (lldb::SBStream &description);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace lldb
|
|
@ -0,0 +1,55 @@
|
||||||
|
//===-- SWIG Interface for SBSymbolContextList ------------------*- 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 list of symbol context object. See also SBSymbolContext.
|
||||||
|
|
||||||
|
For example (from test/python_api/target/TestTargetAPI.py),
|
||||||
|
|
||||||
|
def find_functions(self, exe_name):
|
||||||
|
'''Exercise SBTaget.FindFunctions() API.'''
|
||||||
|
exe = os.path.join(os.getcwd(), exe_name)
|
||||||
|
|
||||||
|
# Create a target by the debugger.
|
||||||
|
target = self.dbg.CreateTarget(exe)
|
||||||
|
self.assertTrue(target, VALID_TARGET)
|
||||||
|
|
||||||
|
list = lldb.SBSymbolContextList()
|
||||||
|
num = target.FindFunctions('c', lldb.eFunctionNameTypeAuto, False, list)
|
||||||
|
self.assertTrue(num == 1 and list.GetSize() == 1)
|
||||||
|
|
||||||
|
for sc in list:
|
||||||
|
self.assertTrue(sc.GetModule().GetFileSpec().GetFilename() == exe_name)
|
||||||
|
self.assertTrue(sc.GetSymbol().GetName() == 'c')
|
||||||
|
") SBSymbolContextList;
|
||||||
|
class SBSymbolContextList
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SBSymbolContextList ();
|
||||||
|
|
||||||
|
SBSymbolContextList (const lldb::SBSymbolContextList& rhs);
|
||||||
|
|
||||||
|
~SBSymbolContextList ();
|
||||||
|
|
||||||
|
bool
|
||||||
|
IsValid () const;
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
GetSize() const;
|
||||||
|
|
||||||
|
SBSymbolContext
|
||||||
|
GetContextAtIndex (uint32_t idx);
|
||||||
|
|
||||||
|
void
|
||||||
|
Clear();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace lldb
|
|
@ -196,6 +196,7 @@ o SBLineEntry: Specifies an association with a contiguous range of instructions
|
||||||
%include "lldb/lldb-forward.h"
|
%include "lldb/lldb-forward.h"
|
||||||
%include "lldb/lldb-forward-rtti.h"
|
%include "lldb/lldb-forward-rtti.h"
|
||||||
%include "lldb/lldb-types.h"
|
%include "lldb/lldb-types.h"
|
||||||
|
|
||||||
%include "./Python/interface/SBAddress.i"
|
%include "./Python/interface/SBAddress.i"
|
||||||
%include "./Python/interface/SBBlock.i"
|
%include "./Python/interface/SBBlock.i"
|
||||||
%include "./Python/interface/SBBreakpoint.i"
|
%include "./Python/interface/SBBreakpoint.i"
|
||||||
|
@ -222,9 +223,9 @@ o SBLineEntry: Specifies an association with a contiguous range of instructions
|
||||||
%include "lldb/API/SBSourceManager.h"
|
%include "lldb/API/SBSourceManager.h"
|
||||||
%include "lldb/API/SBStream.h"
|
%include "lldb/API/SBStream.h"
|
||||||
%include "lldb/API/SBStringList.h"
|
%include "lldb/API/SBStringList.h"
|
||||||
%include "lldb/API/SBSymbol.h"
|
%include "./Python/interface/SBSymbol.i"
|
||||||
%include "lldb/API/SBSymbolContext.h"
|
%include "./Python/interface/SBSymbolContext.i"
|
||||||
%include "lldb/API/SBSymbolContextList.h"
|
%include "./Python/interface/SBSymbolContextList.i"
|
||||||
%include "./Python/interface/SBTarget.i"
|
%include "./Python/interface/SBTarget.i"
|
||||||
%include "./Python/interface/SBThread.i"
|
%include "./Python/interface/SBThread.i"
|
||||||
%include "lldb/API/SBType.h"
|
%include "lldb/API/SBType.h"
|
||||||
|
|
Loading…
Reference in New Issue