Removed all of the "#ifndef SWIG" from the SB header files since we are using

interface (.i) files for each class.

Changed the FindFunction class from:

uint32_t
SBTarget::FindFunctions (const char *name, 
                         uint32_t name_type_mask, 
                         bool append, 
                         lldb::SBSymbolContextList& sc_list)

uint32_t
SBModule::FindFunctions (const char *name, 
                         uint32_t name_type_mask, 
                         bool append, 
                         lldb::SBSymbolContextList& sc_list)

To:

lldb::SBSymbolContextList
SBTarget::FindFunctions (const char *name, 
                         uint32_t name_type_mask = lldb::eFunctionNameTypeAny);

lldb::SBSymbolContextList
SBModule::FindFunctions (const char *name,
                         uint32_t name_type_mask = lldb::eFunctionNameTypeAny);

This makes the API easier to use from python. Also added the ability to
append a SBSymbolContext or a SBSymbolContextList to a SBSymbolContextList.

Exposed properties for lldb.SBSymbolContextList in python:

lldb.SBSymbolContextList.modules => list() or all lldb.SBModule objects in the list
lldb.SBSymbolContextList.compile_units => list() or all lldb.SBCompileUnits objects in the list
lldb.SBSymbolContextList.functions => list() or all lldb.SBFunction objects in the list
lldb.SBSymbolContextList.blocks => list() or all lldb.SBBlock objects in the list
lldb.SBSymbolContextList.line_entries => list() or all lldb.SBLineEntry objects in the list
lldb.SBSymbolContextList.symbols => list() or all lldb.SBSymbol objects in the list

This allows a call to the SBTarget::FindFunctions(...) and SBModule::FindFunctions(...)
and then the result can be used to extract the desired information:

sc_list = lldb.target.FindFunctions("erase")

for function in sc_list.functions:
    print function
for symbol in sc_list.symbols:
    print symbol

Exposed properties for the lldb.SBSymbolContext objects in python:

lldb.SBSymbolContext.module => lldb.SBModule
lldb.SBSymbolContext.compile_unit => lldb.SBCompileUnit
lldb.SBSymbolContext.function => lldb.SBFunction
lldb.SBSymbolContext.block => lldb.SBBlock
lldb.SBSymbolContext.line_entry => lldb.SBLineEntry
lldb.SBSymbolContext.symbol => lldb.SBSymbol


Exposed properties for the lldb.SBBlock objects in python:

lldb.SBBlock.parent => lldb.SBBlock for the parent block that contains
lldb.SBBlock.sibling => lldb.SBBlock for the sibling block to the current block
lldb.SBBlock.first_child => lldb.SBBlock for the first child block to the current block
lldb.SBBlock.call_site => for inline functions, return a lldb.declaration object that gives the call site file, line and column
lldb.SBBlock.name => for inline functions this is the name of the inline function that this block represents
lldb.SBBlock.inlined_block => returns the inlined function block that contains this block (might return itself if the current block is an inlined block)
lldb.SBBlock.range[int] => access the address ranges for a block by index, a list() with start and end address is returned
lldb.SBBlock.ranges => an array or all address ranges for this block
lldb.SBBlock.num_ranges => the number of address ranges for this blcok

SBFunction objects can now get the SBType and the SBBlock that represents the
top scope of the function.

SBBlock objects can now get the variable list from the current block. The value
list returned allows varaibles to be viewed prior with no process if code
wants to check the variables in a function. There are two ways to get a variable
list from a SBBlock:

lldb::SBValueList
SBBlock::GetVariables (lldb::SBFrame& frame,
                       bool arguments,
                       bool locals,
                       bool statics,
                       lldb::DynamicValueType use_dynamic);

lldb::SBValueList
SBBlock::GetVariables (lldb::SBTarget& target,
                       bool arguments,
                       bool locals,
                       bool statics);

When a SBFrame is used, the values returned will be locked down to the frame
and the values will be evaluated in the context of that frame.

When a SBTarget is used, global an static variables can be viewed without a
running process.

llvm-svn: 149853
This commit is contained in:
Greg Clayton 2012-02-06 01:44:54 +00:00
parent 746c62bf88
commit 5569e64ea7
63 changed files with 595 additions and 342 deletions

View File

@ -30,10 +30,8 @@ public:
~SBAddress ();
#ifndef SWIG
const lldb::SBAddress &
operator = (const lldb::SBAddress &rhs);
#endif
bool
IsValid () const;
@ -119,8 +117,6 @@ protected:
friend class SBThread;
friend class SBValue;
#ifndef SWIG
lldb_private::Address *
operator->();
@ -136,9 +132,6 @@ protected:
const lldb_private::Address &
ref() const;
#endif
SBAddress (const lldb_private::Address *lldb_object_ptr);
void

View File

@ -11,6 +11,9 @@
#define LLDB_SBBlock_h_
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBFrame.h"
#include "lldb/API/SBTarget.h"
#include "lldb/API/SBValueList.h"
namespace lldb {
@ -24,10 +27,8 @@ public:
~SBBlock ();
#ifndef SWIG
const lldb::SBBlock &
operator = (const lldb::SBBlock &rhs);
#endif
bool
IsInlined () const;
@ -67,7 +68,19 @@ public:
uint32_t
GetRangeIndexForBlockAddress (lldb::SBAddress block_addr);
lldb::SBValueList
GetVariables (lldb::SBFrame& frame,
bool arguments,
bool locals,
bool statics,
lldb::DynamicValueType use_dynamic);
lldb::SBValueList
GetVariables (lldb::SBTarget& target,
bool arguments,
bool locals,
bool statics);
//------------------------------------------------------------------
/// Get the inlined block that contains this block.
///
@ -87,23 +100,20 @@ public:
private:
friend class SBAddress;
friend class SBFrame;
friend class SBFunction;
friend class SBSymbolContext;
#ifndef SWIG
lldb_private::Block *
get ();
GetPtr ();
void
reset (lldb_private::Block *lldb_object_ptr);
SetPtr (lldb_private::Block *lldb_object_ptr);
SBBlock (lldb_private::Block *lldb_object_ptr);
void
AppendVariables (bool can_create, bool get_parent_variables, lldb_private::VariableList *var_list);
#endif
lldb_private::Block *m_opaque_ptr;
};

View File

@ -29,7 +29,6 @@ public:
~SBBreakpoint();
#ifndef SWIG
const lldb::SBBreakpoint &
operator = (const lldb::SBBreakpoint& rhs);
@ -38,8 +37,6 @@ public:
bool
operator == (const lldb::SBBreakpoint& rhs);
#endif
break_id_t
GetID () const;
@ -133,8 +130,6 @@ private:
SBBreakpoint (const lldb::BreakpointSP &bp_sp);
#ifndef SWIG
lldb_private::Breakpoint *
operator->() const;
@ -147,8 +142,6 @@ private:
const lldb::BreakpointSP &
operator *() const;
#endif
static bool
PrivateBreakpointHitCallback (void *baton,
lldb_private::StoppointCallbackContext *context,

View File

@ -25,10 +25,8 @@ public:
~SBBreakpointLocation ();
#ifndef SWIG
const lldb::SBBreakpointLocation &
operator = (const lldb::SBBreakpointLocation &rhs);
#endif
bool
IsValid() const;
@ -90,9 +88,7 @@ public:
SBBreakpoint
GetBreakpoint ();
#ifndef SWIG
SBBreakpointLocation (const lldb::BreakpointLocationSP &break_loc_sp);
#endif
private:
friend class SBBreakpoint;

View File

@ -23,10 +23,8 @@ public:
SBBroadcaster (const SBBroadcaster &rhs);
#ifndef SWIG
const SBBroadcaster &
operator = (const SBBroadcaster &rhs);
#endif
~SBBroadcaster();
@ -57,7 +55,6 @@ public:
bool
RemoveListener (const lldb::SBListener &listener, uint32_t event_mask = UINT32_MAX);
#ifndef SWIG
// This comparison is checking if the internal opaque pointer value
// is equal to that in "rhs".
bool
@ -74,8 +71,6 @@ public:
bool
operator < (const lldb::SBBroadcaster &rhs) const;
#endif
protected:
friend class SBCommandInterpreter;
friend class SBCommunication;
@ -86,16 +81,12 @@ protected:
SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns);
#ifndef SWIG
lldb_private::Broadcaster *
get () const;
void
reset (lldb_private::Broadcaster *broadcaster, bool owns);
#endif
private:
lldb::BroadcasterSP m_opaque_sp;
lldb_private::Broadcaster *m_opaque_ptr;

View File

@ -28,10 +28,8 @@ public:
SBCommandInterpreter (const lldb::SBCommandInterpreter &rhs);
#ifndef SWIG
const lldb::SBCommandInterpreter &
operator = (const lldb::SBCommandInterpreter &rhs);
#endif
~SBCommandInterpreter ();
@ -74,7 +72,6 @@ public:
lldb::ReturnStatus
HandleCommand (const char *command_line, lldb::SBCommandReturnObject &result, bool add_to_history = false);
#ifndef SWIG
// This interface is not useful in SWIG, since the cursor & last_char arguments are string pointers INTO current_line
// and you can't do that in a scripting language interface in general...
int
@ -84,7 +81,7 @@ public:
int match_start_point,
int max_return_elements,
lldb::SBStringList &matches);
#endif
int
HandleCompletion (const char *current_line,
uint32_t cursor_pos,

View File

@ -24,8 +24,6 @@ public:
SBCommandReturnObject (const lldb::SBCommandReturnObject &rhs);
#ifndef SWIG
const lldb::SBCommandReturnObject &
operator = (const lldb::SBCommandReturnObject &rhs);
@ -34,7 +32,6 @@ public:
lldb_private::CommandReturnObject *
Release ();
#endif
~SBCommandReturnObject ();
@ -93,9 +90,6 @@ protected:
friend class SBCommandInterpreter;
friend class SBOptions;
#ifndef SWIG
lldb_private::CommandReturnObject *
operator->() const;
@ -108,7 +102,6 @@ protected:
lldb_private::CommandReturnObject &
ref() const;
#endif
void
SetLLDBObjectPtr (lldb_private::CommandReturnObject *ptr);

View File

@ -25,10 +25,8 @@ public:
~SBCompileUnit ();
#ifndef SWIG
const lldb::SBCompileUnit &
operator = (const lldb::SBCompileUnit &rhs);
#endif
bool
IsValid () const;
@ -53,16 +51,12 @@ public:
lldb::SBFileSpec *inline_file_spec,
bool exact) const;
#ifndef SWIG
bool
operator == (const lldb::SBCompileUnit &rhs) const;
bool
operator != (const lldb::SBCompileUnit &rhs) const;
#endif
bool
GetDescription (lldb::SBStream &description);
@ -73,8 +67,6 @@ private:
SBCompileUnit (lldb_private::CompileUnit *lldb_object_ptr);
#ifndef SWIG
const lldb_private::CompileUnit *
operator->() const;
@ -87,8 +79,6 @@ private:
void
reset (lldb_private::CompileUnit *lldb_object_ptr);
#endif
lldb_private::CompileUnit *m_opaque_ptr;
};

View File

@ -22,10 +22,8 @@ public:
SBData (const SBData &rhs);
#ifndef SWIG
const SBData &
operator = (const SBData &rhs);
#endif
~SBData ();
@ -149,7 +147,6 @@ public:
protected:
#ifndef SWIG
// Mimic shared pointer...
lldb_private::DataExtractor *
get() const;
@ -162,7 +159,6 @@ protected:
const lldb::DataExtractorSP &
operator*() const;
#endif
SBData (const lldb::DataExtractorSP &data_sp);

View File

@ -42,12 +42,10 @@ public:
SBDebugger(const lldb::SBDebugger &rhs);
#ifndef SWIG
SBDebugger(const lldb::DebuggerSP &debugger_sp);
lldb::SBDebugger &
operator = (const lldb::SBDebugger &rhs);
#endif
~SBDebugger();
@ -245,8 +243,6 @@ public:
private:
#ifndef SWIG
friend class SBInputReader;
friend class SBProcess;
friend class SBSourceManager;
@ -266,7 +262,6 @@ private:
const lldb::DebuggerSP &
get_sp () const;
#endif
lldb::DebuggerSP m_opaque_sp;

View File

@ -22,13 +22,9 @@ public:
~SBError();
#ifndef SWIG
const SBError &
operator =(const lldb::SBError &rhs);
#endif
const char *
GetCString () const;
@ -70,7 +66,6 @@ public:
protected:
#ifndef SWIG
friend class SBArguments;
friend class SBData;
friend class SBDebugger;
@ -95,9 +90,6 @@ protected:
lldb_private::Error &
ref();
#endif
void
SetError (const lldb_private::Error &lldb_error);

View File

@ -32,10 +32,8 @@ public:
~SBEvent();
#ifndef SWIG
const SBEvent &
operator = (const lldb::SBEvent &rhs);
#endif
bool
IsValid() const;
@ -49,10 +47,8 @@ public:
lldb::SBBroadcaster
GetBroadcaster () const;
#ifndef SWIG
bool
BroadcasterMatchesPtr (const lldb::SBBroadcaster *broadcaster);
#endif
bool
BroadcasterMatchesRef (const lldb::SBBroadcaster &broadcaster);
@ -63,10 +59,8 @@ public:
static const char *
GetCStringFromEvent (const lldb::SBEvent &event);
#ifndef SWIG
bool
GetDescription (lldb::SBStream &description);
#endif
bool
GetDescription (lldb::SBStream &description) const;
@ -80,8 +74,6 @@ protected:
SBEvent (lldb::EventSP &event_sp);
#ifndef SWIG
lldb::EventSP &
GetSP () const;
@ -94,8 +86,6 @@ protected:
lldb_private::Event *
get () const;
#endif
private:
mutable lldb::EventSP m_event_sp;

View File

@ -27,10 +27,8 @@ public:
~SBFileSpec ();
#ifndef SWIG
const SBFileSpec &
operator = (const lldb::SBFileSpec &rhs);
#endif
bool
IsValid() const;
@ -70,7 +68,6 @@ private:
void
SetFileSpec (const lldb_private::FileSpec& fs);
#ifndef SWIG
const lldb_private::FileSpec *
operator->() const;
@ -84,8 +81,6 @@ private:
const lldb_private::FileSpec &
ref() const;
#endif
std::auto_ptr <lldb_private::FileSpec> m_opaque_ap;
};

View File

@ -23,10 +23,8 @@ public:
~SBFileSpecList ();
#ifndef SWIG
const SBFileSpecList &
operator = (const lldb::SBFileSpecList &rhs);
#endif
uint32_t
GetSize () const;
@ -53,8 +51,6 @@ private:
friend class SBTarget;
#ifndef SWIG
const lldb_private::FileSpecList *
operator->() const;
@ -67,8 +63,6 @@ friend class SBTarget;
const lldb_private::FileSpecList &
ref() const;
#endif
std::auto_ptr <lldb_private::FileSpecList> m_opaque_ap;
};

View File

@ -24,10 +24,8 @@ public:
SBFrame (const lldb::SBFrame &rhs);
#ifndef SWIG
const lldb::SBFrame &
operator =(const lldb::SBFrame &rhs);
#endif
~SBFrame();
@ -130,15 +128,12 @@ public:
void
Clear();
#ifndef SWIG
bool
operator == (const lldb::SBFrame &rhs) const;
bool
operator != (const lldb::SBFrame &rhs) const;
#endif
/// The version that doesn't supply a 'use_dynamic' value will use the
/// target's default.
lldb::SBValueList
@ -208,16 +203,14 @@ public:
bool
GetDescription (lldb::SBStream &description);
#ifndef SWIG
SBFrame (const lldb::StackFrameSP &lldb_object_sp);
#endif
protected:
friend class SBValue;
private:
friend class SBThread;
friend class SBBlock;
friend class SBInstruction;
friend class SBThread;
friend class SBValue;
#ifndef LLDB_DISABLE_PYTHON
friend class lldb_private::ScriptInterpreterPython;
#endif

View File

@ -24,11 +24,8 @@ public:
SBFunction (const lldb::SBFunction &rhs);
#ifndef SWIG
const lldb::SBFunction &
operator = (const lldb::SBFunction &rhs);
#endif
~SBFunction ();
@ -44,38 +41,38 @@ public:
lldb::SBInstructionList
GetInstructions (lldb::SBTarget target);
SBAddress
lldb::SBAddress
GetStartAddress ();
SBAddress
lldb::SBAddress
GetEndAddress ();
uint32_t
GetPrologueByteSize ();
#ifndef SWIG
lldb::SBType
GetType ();
lldb::SBBlock
GetBlock ();
bool
operator == (const lldb::SBFunction &rhs) const;
bool
operator != (const lldb::SBFunction &rhs) const;
#endif
bool
GetDescription (lldb::SBStream &description);
protected:
#ifndef SWIG
lldb_private::Function *
get ();
void
reset (lldb_private::Function *lldb_object_ptr);
#endif
private:
friend class SBAddress;
friend class SBFrame;

View File

@ -45,10 +45,8 @@ public:
bool
IsValid () const;
#ifndef SWIG
const lldb::SBInputReader &
operator = (const lldb::SBInputReader &rhs);
#endif
bool
IsActive () const;
@ -65,8 +63,6 @@ public:
protected:
friend class SBDebugger;
#ifndef SWIG
lldb_private::InputReader *
operator->() const;
@ -82,9 +78,6 @@ protected:
lldb_private::InputReader &
ref() const;
#endif
private:
static size_t

View File

@ -28,10 +28,8 @@ public:
SBInstruction (const SBInstruction &rhs);
#ifndef SWIG
const SBInstruction &
operator = (const SBInstruction &rhs);
#endif
~SBInstruction ();

View File

@ -24,10 +24,8 @@ public:
SBInstructionList (const SBInstructionList &rhs);
#ifndef SWIG
const SBInstructionList &
operator = (const SBInstructionList &rhs);
#endif
~SBInstructionList ();

View File

@ -26,10 +26,8 @@ public:
~SBLineEntry ();
#ifndef SWIG
const lldb::SBLineEntry &
operator = (const lldb::SBLineEntry &rhs);
#endif
lldb::SBAddress
GetStartAddress () const;
@ -58,15 +56,12 @@ public:
void
SetColumn (uint32_t column);
#ifndef SWIG
bool
operator == (const lldb::SBLineEntry &rhs) const;
bool
operator != (const lldb::SBLineEntry &rhs) const;
#endif
bool
GetDescription (lldb::SBStream &description);
@ -81,8 +76,6 @@ private:
friend class SBFrame;
friend class SBSymbolContext;
#ifndef SWIG
const lldb_private::LineEntry *
operator->() const;
@ -92,9 +85,6 @@ private:
const lldb_private::LineEntry &
ref() const;
#endif
SBLineEntry (const lldb_private::LineEntry *lldb_object_ptr);
void

View File

@ -25,10 +25,8 @@ public:
~SBListener ();
#ifndef SWIG
const lldb::SBListener &
operator = (const lldb::SBListener &rhs);
#endif
void
AddEvent (const lldb::SBEvent &event);
@ -100,8 +98,6 @@ protected:
private:
#ifndef SWIG
lldb_private::Listener *
operator->() const;
@ -120,8 +116,6 @@ private:
void
reset(lldb_private::Listener *listener, bool transfer_ownership);
#endif
lldb::ListenerSP m_opaque_sp;
lldb_private::Listener *m_opaque_ptr;
};

View File

@ -25,11 +25,9 @@ public:
SBModule ();
SBModule (const SBModule &rhs);
#ifndef SWIG
const SBModule &
operator = (const SBModule &rhs);
#endif
SBModule (lldb::SBProcess &process,
lldb::addr_t header_addr);
@ -85,22 +83,18 @@ public:
const char *
GetTriple ();
#ifndef SWIG
const uint8_t *
GetUUIDBytes () const;
#endif
const char *
GetUUIDString () const;
#ifndef SWIG
bool
operator == (const lldb::SBModule &rhs) const;
bool
operator != (const lldb::SBModule &rhs) const;
#endif
lldb::SBSection
FindSection (const char *sect_name);
@ -138,22 +132,13 @@ public:
/// C++ methods, or ObjC selectors.
/// See FunctionNameType for more details.
///
/// @param[in] append
/// If true, any matches will be appended to \a sc_list, else
/// matches replace the contents of \a sc_list.
///
/// @param[out] sc_list
/// A symbol context list that gets filled in with all of the
/// matches.
///
/// @return
/// The number of matches added to \a sc_list.
/// A lldb::SBSymbolContextList that gets filled in with all of
/// the symbol contexts for all the matches.
//------------------------------------------------------------------
uint32_t
lldb::SBSymbolContextList
FindFunctions (const char *name,
uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
bool append,
lldb::SBSymbolContextList& sc_list);
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
//------------------------------------------------------------------
/// Find global and static variables by name.

View File

@ -37,10 +37,8 @@ public:
SBProcess (const lldb::SBProcess& rhs);
#ifndef SWIG
const lldb::SBProcess&
operator = (const lldb::SBProcess& rhs);
#endif
~SBProcess();

View File

@ -25,10 +25,9 @@ public:
~SBSection ();
#ifndef SWIG
const lldb::SBSection &
operator = (const lldb::SBSection &rhs);
#endif
bool
IsValid () const;
@ -66,21 +65,17 @@ public:
SectionType
GetSectionType ();
#ifndef SWIG
bool
operator == (const lldb::SBSection &rhs);
bool
operator != (const lldb::SBSection &rhs);
#endif
bool
GetDescription (lldb::SBStream &description);
private:
#ifndef SWIG
friend class SBAddress;
friend class SBModule;
friend class SBTarget;
@ -92,7 +87,6 @@ private:
void
SetSection (const lldb_private::Section *section);
#endif
std::auto_ptr<lldb_private::SectionImpl> m_opaque_ap;
};

View File

@ -25,10 +25,8 @@ public:
~SBSourceManager();
#ifndef SWIG
const lldb::SBSourceManager &
operator = (const lldb::SBSourceManager &rhs);
#endif
size_t
DisplaySourceLinesWithLineNumbers (const lldb::SBFileSpec &file,

View File

@ -79,6 +79,7 @@ protected:
friend class SBSourceManager;
friend class SBSymbol;
friend class SBSymbolContext;
friend class SBSymbolContextList;
friend class SBTarget;
friend class SBThread;
friend class SBType;
@ -86,8 +87,6 @@ protected:
friend class SBValue;
friend class SBWatchpoint;
#ifndef SWIG
lldb_private::Stream *
operator->();
@ -97,8 +96,6 @@ protected:
lldb_private::Stream &
ref();
#endif
private:
DISALLOW_COPY_AND_ASSIGN (SBStream);

View File

@ -22,10 +22,8 @@ public:
SBStringList (const lldb::SBStringList &rhs);
#ifndef SWIG
const SBStringList &
operator = (const SBStringList &rhs);
#endif
~SBStringList ();
@ -55,16 +53,12 @@ protected:
SBStringList (const lldb_private::StringList *lldb_strings);
#ifndef SWIG
const lldb_private::StringList *
operator->() const;
const lldb_private::StringList &
operator*() const;
#endif
private:
std::auto_ptr<lldb_private::StringList> m_opaque_ap;

View File

@ -27,10 +27,8 @@ public:
SBSymbol (const lldb::SBSymbol &rhs);
#ifndef SWIG
const lldb::SBSymbol &
operator = (const lldb::SBSymbol &rhs);
#endif
bool
IsValid () const;
@ -57,26 +55,22 @@ public:
SymbolType
GetType ();
#ifndef SWIG
bool
operator == (const lldb::SBSymbol &rhs) const;
bool
operator != (const lldb::SBSymbol &rhs) const;
#endif
bool
GetDescription (lldb::SBStream &description);
protected:
#ifndef SWIG
lldb_private::Symbol *
get ();
void
reset (lldb_private::Symbol *);
#endif
private:
friend class SBAddress;

View File

@ -32,10 +32,8 @@ public:
bool
IsValid () const;
#ifndef SWIG
const lldb::SBSymbolContext &
operator = (const lldb::SBSymbolContext &rhs);
#endif
lldb::SBModule GetModule ();
lldb::SBCompileUnit GetCompileUnit ();
@ -66,8 +64,6 @@ protected:
friend class SBTarget;
friend class SBSymbolContextList;
#ifndef SWIG
lldb_private::SymbolContext*
operator->() const;
@ -80,8 +76,6 @@ protected:
const lldb_private::SymbolContext&
operator*() const;
#endif
lldb_private::SymbolContext *
get() const;

View File

@ -24,10 +24,8 @@ public:
~SBSymbolContextList ();
#ifndef SWIG
const lldb::SBSymbolContextList &
operator = (const lldb::SBSymbolContextList &rhs);
#endif
bool
IsValid () const;
@ -35,9 +33,18 @@ public:
uint32_t
GetSize() const;
SBSymbolContext
lldb::SBSymbolContext
GetContextAtIndex (uint32_t idx);
bool
GetDescription (lldb::SBStream &description);
void
Append (lldb::SBSymbolContext &sc);
void
Append (lldb::SBSymbolContextList &sc_list);
void
Clear();
@ -46,16 +53,12 @@ protected:
friend class SBModule;
friend class SBTarget;
#ifndef SWIG
lldb_private::SymbolContextList*
operator->() const;
lldb_private::SymbolContextList&
operator*() const;
#endif
private:
std::auto_ptr<lldb_private::SymbolContextList> m_opaque_ap;
};

View File

@ -42,10 +42,8 @@ public:
SBTarget (const lldb::SBTarget& rhs);
#ifndef SWIG
const lldb::SBTarget&
operator = (const lldb::SBTarget& rhs);
#endif
//------------------------------------------------------------------
// Destructor
@ -361,22 +359,13 @@ public:
/// C++ methods, or ObjC selectors.
/// See FunctionNameType for more details.
///
/// @param[in] append
/// If true, any matches will be appended to \a sc_list, else
/// matches replace the contents of \a sc_list.
///
/// @param[out] sc_list
/// A symbol context list that gets filled in with all of the
/// matches.
///
/// @return
/// The number of matches added to \a sc_list.
/// A lldb::SBSymbolContextList that gets filled in with all of
/// the symbol contexts for all the matches.
//------------------------------------------------------------------
uint32_t
lldb::SBSymbolContextList
FindFunctions (const char *name,
uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
bool append,
lldb::SBSymbolContextList& sc_list);
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
//------------------------------------------------------------------
/// Find global and static variables by name.
@ -510,20 +499,18 @@ public:
lldb::SBInstructionList
GetInstructions (lldb::addr_t base_addr, const void *buf, size_t size);
#ifndef SWIG
bool
operator == (const lldb::SBTarget &rhs) const;
bool
operator != (const lldb::SBTarget &rhs) const;
#endif
bool
GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
protected:
friend class SBAddress;
friend class SBBlock;
friend class SBDebugger;
friend class SBFunction;
friend class SBInstruction;

View File

@ -147,8 +147,6 @@ public:
lldb::SBProcess
GetProcess ();
#ifndef SWIG
const lldb::SBThread &
operator = (const lldb::SBThread &rhs);
@ -158,8 +156,6 @@ public:
bool
operator != (const lldb::SBThread &rhs) const;
#endif
bool
GetDescription (lldb::SBStream &description) const;

View File

@ -24,11 +24,9 @@ public:
SBTypeMember (const lldb::SBTypeMember& rhs);
~SBTypeMember();
#ifndef SWIG
lldb::SBTypeMember&
operator = (const lldb::SBTypeMember& rhs);
#endif
bool
IsValid() const;
@ -52,7 +50,6 @@ public:
protected:
friend class SBType;
#ifndef SWIG
void
reset (lldb_private::TypeMemberImpl *);
@ -61,7 +58,6 @@ protected:
const lldb_private::TypeMemberImpl &
ref () const;
#endif
std::auto_ptr<lldb_private::TypeMemberImpl> m_opaque_ap;
};
@ -147,7 +143,6 @@ public:
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
#ifndef SWIG
lldb::SBType &
operator = (const lldb::SBType &rhs);
@ -156,11 +151,9 @@ public:
bool
operator != (lldb::SBType &rhs);
#endif
protected:
#ifndef SWIG
lldb_private::TypeImpl &
ref ();
@ -171,17 +164,16 @@ protected:
GetSP ();
void
SetSP (const lldb::TypeImplSP &type_impl_sp);
#endif
SetSP (const lldb::TypeImplSP &type_impl_sp);
lldb::TypeImplSP m_opaque_sp;
friend class SBFunction;
friend class SBModule;
friend class SBTarget;
friend class SBValue;
friend class SBTypeMember;
friend class SBTypeList;
friend class SBValue;
SBType (const lldb_private::ClangASTType &);
SBType (const lldb::TypeSP &);

View File

@ -24,10 +24,8 @@ public:
SBValue (const lldb::SBValue &rhs);
#ifndef SWIG
lldb::SBValue &
operator =(const lldb::SBValue &rhs);
#endif
~SBValue ();
@ -339,7 +337,6 @@ public:
lldb::SBWatchpoint
WatchPointee (bool resolve_location, bool read, bool write);
#ifndef SWIG
// this must be defined in the .h file because synthetic children as implemented in the core
// currently rely on being able to extract the SharedPointer out of an SBValue. if the implementation
// is deferred to the .cpp file instead of being inlined here, the platform will fail to link
@ -349,7 +346,6 @@ public:
{
return m_opaque_sp;
}
#endif
protected:
friend class SBValueList;

View File

@ -45,8 +45,6 @@ public:
lldb::SBValue
FindValueObjectByUID (lldb::user_id_t uid);
#ifndef SWIG
const lldb::SBValueList &
operator = (const lldb::SBValueList &rhs);
@ -68,8 +66,6 @@ public:
lldb_private::ValueObjectList &
ref ();
#endif
private:
friend class SBFrame;

View File

@ -132,7 +132,7 @@ public:
/// be false and no module updated notification will need to
/// be sent out.
///
/// @returns
/// @return
/// /b True if any sections were successfully loaded in \a target,
/// /b false otherwise.
//------------------------------------------------------------------

View File

@ -310,6 +310,13 @@ public:
static lldb::clang_type_t
RemoveFastQualifiers (lldb::clang_type_t);
void
Clear()
{
m_type = NULL;
m_ast = NULL;
}
private:
lldb::clang_type_t m_type;
clang::ASTContext *m_ast;

View File

@ -463,7 +463,7 @@ public:
/// @param[out] line_no
/// The line number.
//------------------------------------------------------------------
void
void
GetEndLineSourceInfo (FileSpec &source_file, uint32_t &line_no);
//------------------------------------------------------------------

View File

@ -361,9 +361,16 @@ public:
void
Append (const SymbolContext& sc);
bool
AppendIfUnique (const SymbolContext& sc, bool merge_symbol_into_function);
void
Append (const SymbolContextList& sc_list);
bool
AppendIfUnique (const SymbolContext& sc,
bool merge_symbol_into_function);
uint32_t
AppendIfUnique (const SymbolContextList& sc_list,
bool merge_symbol_into_function);
//------------------------------------------------------------------
/// Clear the object's state.
///
@ -418,6 +425,11 @@ public:
uint32_t
NumLineEntriesWithLine (uint32_t line) const;
void
GetDescription(Stream *s,
lldb::DescriptionLevel level,
Target *target) const;
protected:
typedef std::vector<SymbolContext> collection; ///< The collection type for the list.

View File

@ -390,6 +390,8 @@ public:
GetDescription (lldb_private::Stream &strm,
lldb::DescriptionLevel description_level);
void
SetType (const lldb::TypeSP &type_sp);
private:
ClangASTType m_clang_ast_type;

View File

@ -512,7 +512,11 @@ namespace lldb {
eFunctionNameTypeBase = (1u << 3), // The function name only, no namespaces or arguments and no class
// methods or selectors will be searched.
eFunctionNameTypeMethod = (1u << 4), // Find function by method name (C++) with no namespace or arguments
eFunctionNameTypeSelector = (1u << 5) // Find function by selector name (ObjC) names
eFunctionNameTypeSelector = (1u << 5), // Find function by selector name (ObjC) names
eFunctionNameTypeAny = (eFunctionNameTypeFull |
eFunctionNameTypeBase |
eFunctionNameTypeMethod |
eFunctionNameTypeSelector )
} FunctionNameType;

View File

@ -89,6 +89,87 @@ public:
bool
GetDescription (lldb::SBStream &description);
lldb::SBValueList
GetVariables (lldb::SBFrame& frame,
bool arguments,
bool locals,
bool statics,
lldb::DynamicValueType use_dynamic);
lldb::SBValueList
GetVariables (lldb::SBTarget& target,
bool arguments,
bool locals,
bool statics);
%pythoncode %{
def get_range_at_index(self, idx):
if idx < self.GetNumRanges():
return [self.sbblock.GetRangeStartAddress(key), self.sbblock.GetRangeEndAddress(key)]
return []
class ranges_access(object):
'''A helper object that will lazily hand out an array of lldb.SBAddress that represent address ranges for a block.'''
def __init__(self, sbblock):
self.sbblock = sbblock
def __len__(self):
if self.sbblock:
return self.sbblock.GetNumRanges()
return 0
def __getitem__(self, key):
count = len(self)
if type(key) is int:
return self.sbblock.get_range_at_index (key);
else:
print "error: unsupported item type: %s" % type(key)
return None
def get_ranges_access_object(self):
'''An accessor function that returns a ranges_access() object which allows lazy block address ranges access.'''
return self.ranges_access (self)
def get_ranges_array(self):
'''An accessor function that returns an array object that contains all ranges in this block object.'''
if not hasattr(self, 'ranges'):
self.ranges = []
for idx in range(self.num_ranges):
self.ranges.append (self.get_range_at_index (idx))
return self.ranges
def get_call_site(self):
return declaration(self.GetInlinedCallSiteFile(), self.GetInlinedCallSiteLine(), self.GetInlinedCallSiteColumn())
__swig_getmethods__["parent"] = GetParent
if _newclass: x = property(GetParent, None)
__swig_getmethods__["first_child"] = GetFirstChild
if _newclass: x = property(GetFirstChild, None)
__swig_getmethods__["call_site"] = get_call_site
if _newclass: x = property(get_call_site, None)
__swig_getmethods__["sibling"] = GetSibling
if _newclass: x = property(GetSibling, None)
__swig_getmethods__["name"] = GetInlinedName
if _newclass: x = property(GetInlinedName, None)
__swig_getmethods__["inlined_block"] = GetContainingInlinedBlock
if _newclass: x = property(GetContainingInlinedBlock, None)
__swig_getmethods__["range"] = get_ranges_access_object
if _newclass: x = property(get_ranges_access_object, None)
__swig_getmethods__["ranges"] = get_ranges_array
if _newclass: x = property(get_ranges_array, None)
__swig_getmethods__["num_ranges"] = GetNumRanges
if _newclass: x = property(GetNumRanges, None)
%}
};
} // namespace lldb

View File

@ -65,15 +65,21 @@ public:
lldb::SBInstructionList
GetInstructions (lldb::SBTarget target);
SBAddress
lldb::SBAddress
GetStartAddress ();
SBAddress
lldb::SBAddress
GetEndAddress ();
uint32_t
GetPrologueByteSize ();
lldb::SBType
GetType ();
lldb::SBBlock
GetBlock ();
bool
GetDescription (lldb::SBStream &description);
@ -81,24 +87,29 @@ public:
def get_instructions_from_current_target (self):
return self.GetInstructions (target)
__swig_getmethods__["name"] = GetName
if _newclass: x = property(GetName, None)
__swig_getmethods__["mangled"] = GetMangledName
if _newclass: x = property(GetMangledName, None)
__swig_getmethods__["addr"] = GetStartAddress
if _newclass: x = property(GetStartAddress, None)
__swig_getmethods__["block"] = GetBlock
if _newclass: x = property(GetBlock, None)
__swig_getmethods__["end_addr"] = GetEndAddress
if _newclass: x = property(GetEndAddress, None)
__swig_getmethods__["prologue_size"] = GetPrologueByteSize
if _newclass: x = property(GetPrologueByteSize, None)
__swig_getmethods__["instructions"] = get_instructions_from_current_target
if _newclass: x = property(get_instructions_from_current_target, None)
__swig_getmethods__["mangled"] = GetMangledName
if _newclass: x = property(GetMangledName, None)
__swig_getmethods__["name"] = GetName
if _newclass: x = property(GetName, None)
__swig_getmethods__["prologue_size"] = GetPrologueByteSize
if _newclass: x = property(GetPrologueByteSize, None)
__swig_getmethods__["type"] = GetType
if _newclass: x = property(GetType, None)
%}
};

View File

@ -192,23 +192,14 @@ public:
/// C++ methods, or ObjC selectors.
/// See FunctionNameType for more details.
///
/// @param[in] append
/// If true, any matches will be appended to \a sc_list, else
/// matches replace the contents of \a sc_list.
///
/// @param[out] sc_list
/// @return
/// A symbol context list that gets filled in with all of the
/// matches.
///
/// @return
/// The number of matches added to \a sc_list.
//------------------------------------------------------------------
") FindFunctions;
uint32_t
lldb::SBSymbolContextList
FindFunctions (const char *name,
uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
bool append,
lldb::SBSymbolContextList& sc_list);
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
lldb::SBType
FindFirstType (const char* name);

View File

@ -79,6 +79,34 @@ public:
bool
GetDescription (lldb::SBStream &description);
%pythoncode %{
__swig_getmethods__["module"] = GetModule
__swig_setmethods__["module"] = SetModule
if _newclass: x = property(GetModule, SetModule)
__swig_getmethods__["compile_unit"] = GetCompileUnit
__swig_setmethods__["compile_unit"] = SetCompileUnit
if _newclass: x = property(GetCompileUnit, SetCompileUnit)
__swig_getmethods__["function"] = GetFunction
__swig_setmethods__["function"] = SetFunction
if _newclass: x = property(GetFunction, SetFunction)
__swig_getmethods__["block"] = GetBlock
__swig_setmethods__["block"] = SetBlock
if _newclass: x = property(GetBlock, SetBlock)
__swig_getmethods__["symbol"] = GetSymbol
__swig_setmethods__["symbol"] = SetSymbol
if _newclass: x = property(GetSymbol, SetSymbol)
__swig_getmethods__["line_entry"] = GetLineEntry
__swig_setmethods__["line_entry"] = SetLineEntry
if _newclass: x = property(GetLineEntry, SetLineEntry)
%}
};
} // namespace lldb

View File

@ -48,8 +48,93 @@ public:
SBSymbolContext
GetContextAtIndex (uint32_t idx);
void
Append (lldb::SBSymbolContext &sc);
void
Append (lldb::SBSymbolContextList &sc_list);
bool
GetDescription (lldb::SBStream &description);
void
Clear();
%pythoncode %{
def __len__(self):
return self.GetSize()
def __getitem__(self, key):
count = len(self)
if type(key) is int:
if key < count:
return self.GetContextAtIndex(key)
else:
raise IndexError
raise TypeError
def get_module_array(self):
a = []
for i in range(len(self)):
obj = self.GetContextAtIndex(i).module
if obj:
a.append(obj)
return a
def get_compile_unit_array(self):
a = []
for i in range(len(self)):
obj = self.GetContextAtIndex(i).compile_unit
if obj:
a.append(obj)
return a
def get_function_array(self):
a = []
for i in range(len(self)):
obj = self.GetContextAtIndex(i).function
if obj:
a.append(obj)
return a
def get_block_array(self):
a = []
for i in range(len(self)):
obj = self.GetContextAtIndex(i).block
if obj:
a.append(obj)
return a
def get_symbol_array(self):
a = []
for i in range(len(self)):
obj = self.GetContextAtIndex(i).symbol
if obj:
a.append(obj)
return a
def get_line_entry_array(self):
a = []
for i in range(len(self)):
obj = self.GetContextAtIndex(i).line_entry
if obj:
a.append(obj)
return a
__swig_getmethods__["modules"] = get_module_array
if _newclass: x = property(get_module_array, None)
__swig_getmethods__["compile_units"] = get_compile_unit_array
if _newclass: x = property(get_compile_unit_array, None)
__swig_getmethods__["functions"] = get_function_array
if _newclass: x = property(get_function_array, None)
__swig_getmethods__["blocks"] = get_block_array
if _newclass: x = property(get_block_array, None)
__swig_getmethods__["line_entries"] = get_line_entry_array
if _newclass: x = property(get_line_entry_array, None)
__swig_getmethods__["symbols"] = get_symbol_array
if _newclass: x = property(get_symbol_array, None)
%}
};
} // namespace lldb

View File

@ -348,23 +348,14 @@ public:
/// C++ methods, or ObjC selectors.
/// See FunctionNameType for more details.
///
/// @param[in] append
/// If true, any matches will be appended to \a sc_list, else
/// matches replace the contents of \a sc_list.
///
/// @param[out] sc_list
/// A symbol context list that gets filled in with all of the
/// matches.
///
/// @return
/// The number of matches added to \a sc_list.
/// A lldb::SBSymbolContextList that gets filled in with all of
/// the symbol contexts for all the matches.
//------------------------------------------------------------------
") FindFunctions;
uint32_t
lldb::SBSymbolContextList
FindFunctions (const char *name,
uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
bool append,
lldb::SBSymbolContextList& sc_list);
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
lldb::SBType
FindFirstType (const char* type);

View File

@ -280,6 +280,20 @@
return PyString_FromString("");
}
}
%extend lldb::SBSymbolContextList {
PyObject *lldb::SBSymbolContextList::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
size_t desc_len = description.GetSize();
if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r'))
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
else
return PyString_FromString("");
}
}
%extend lldb::SBTarget {
PyObject *lldb::SBTarget::__str__ (){
lldb::SBStream description;
@ -389,6 +403,13 @@
%pythoncode %{
class declaration(object):
'''A class that represents a source declaration location with file, line and column.'''
def __init__(self, file, line, col):
self.file = file
self.line = line
self.col = col
class value(object):
'''A class designed to wrap lldb.SBValue() objects so the resulting object
can be used as a variable would be in code. So if you have a Point structure

View File

@ -352,7 +352,7 @@ SBAddress::GetBlock ()
{
SBBlock sb_block;
if (m_opaque_ap.get())
sb_block.reset(m_opaque_ap->GetAddress().CalculateSymbolContextBlock());
sb_block.SetPtr(m_opaque_ap->GetAddress().CalculateSymbolContextBlock());
return sb_block;
}

View File

@ -10,11 +10,18 @@
#include "lldb/API/SBBlock.h"
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBFrame.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBValue.h"
#include "lldb/Core/AddressRange.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
using namespace lldb;
using namespace lldb_private;
@ -157,13 +164,13 @@ SBBlock::GetFirstChild ()
}
lldb_private::Block *
SBBlock::get ()
SBBlock::GetPtr ()
{
return m_opaque_ptr;
}
void
SBBlock::reset (lldb_private::Block *block)
SBBlock::SetPtr (lldb_private::Block *block)
{
m_opaque_ptr = block;
}
@ -245,3 +252,117 @@ SBBlock::GetRangeIndexForBlockAddress (lldb::SBAddress block_addr)
return UINT32_MAX;
}
lldb::SBValueList
SBBlock::GetVariables (lldb::SBFrame& frame,
bool arguments,
bool locals,
bool statics,
lldb::DynamicValueType use_dynamic)
{
Block *block = GetPtr();
SBValueList value_list;
if (block)
{
StackFrameSP frame_sp(frame.GetFrameSP());
VariableListSP variable_list_sp (block->GetBlockVariableList (true));
if (variable_list_sp)
{
const size_t num_variables = variable_list_sp->GetSize();
if (num_variables)
{
for (size_t i = 0; i < num_variables; ++i)
{
VariableSP variable_sp (variable_list_sp->GetVariableAtIndex(i));
if (variable_sp)
{
bool add_variable = false;
switch (variable_sp->GetScope())
{
case eValueTypeVariableGlobal:
case eValueTypeVariableStatic:
add_variable = statics;
break;
case eValueTypeVariableArgument:
add_variable = arguments;
break;
case eValueTypeVariableLocal:
add_variable = locals;
break;
default:
break;
}
if (add_variable)
{
if (frame_sp)
value_list.Append (frame_sp->GetValueObjectForFrameVariable (variable_sp, use_dynamic));
}
}
}
}
}
}
return value_list;
}
lldb::SBValueList
SBBlock::GetVariables (lldb::SBTarget& target,
bool arguments,
bool locals,
bool statics)
{
Block *block = GetPtr();
SBValueList value_list;
if (block)
{
TargetSP target_sp(target.GetSP());
VariableListSP variable_list_sp (block->GetBlockVariableList (true));
if (variable_list_sp)
{
const size_t num_variables = variable_list_sp->GetSize();
if (num_variables)
{
for (size_t i = 0; i < num_variables; ++i)
{
VariableSP variable_sp (variable_list_sp->GetVariableAtIndex(i));
if (variable_sp)
{
bool add_variable = false;
switch (variable_sp->GetScope())
{
case eValueTypeVariableGlobal:
case eValueTypeVariableStatic:
add_variable = statics;
break;
case eValueTypeVariableArgument:
add_variable = arguments;
break;
case eValueTypeVariableLocal:
add_variable = locals;
break;
default:
break;
}
if (add_variable)
{
if (target_sp)
value_list.Append (ValueObjectVariable::Create (target_sp.get(), variable_sp));
}
}
}
}
}
}
return value_list;
}

View File

@ -300,12 +300,12 @@ SBFrame::GetBlock () const
if (frame_sp)
{
Mutex::Locker api_locker (frame_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
sb_block.reset (frame_sp->GetSymbolContext (eSymbolContextBlock).block);
sb_block.SetPtr (frame_sp->GetSymbolContext (eSymbolContextBlock).block);
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetBlock () => SBBlock(%p)",
frame_sp.get(), sb_block.get());
frame_sp.get(), sb_block.GetPtr());
return sb_block;
}
@ -317,12 +317,12 @@ SBFrame::GetFrameBlock () const
if (frame_sp)
{
Mutex::Locker api_locker (frame_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
sb_block.reset(frame_sp->GetFrameBlock ());
sb_block.SetPtr(frame_sp->GetFrameBlock ());
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetFrameBlock () => SBBlock(%p)",
frame_sp.get(), sb_block.get());
frame_sp.get(), sb_block.GetPtr());
return sb_block;
}

View File

@ -192,4 +192,27 @@ SBFunction::GetPrologueByteSize ()
return 0;
}
SBType
SBFunction::GetType ()
{
SBType sb_type;
if (m_opaque_ptr)
{
Type *function_type = m_opaque_ptr->GetType();
if (function_type)
sb_type.ref().SetType (function_type->shared_from_this());
}
return sb_type;
}
SBBlock
SBFunction::GetBlock ()
{
SBBlock sb_block;
if (m_opaque_ptr)
sb_block.SetPtr (&m_opaque_ptr->GetBlock (true));
return sb_block;
}

View File

@ -318,25 +318,23 @@ SBModule::GetSectionAtIndex (size_t idx)
return sb_section;
}
uint32_t
lldb::SBSymbolContextList
SBModule::FindFunctions (const char *name,
uint32_t name_type_mask,
bool append,
lldb::SBSymbolContextList& sc_list)
uint32_t name_type_mask)
{
if (!append)
sc_list.Clear();
lldb::SBSymbolContextList sb_sc_list;
if (name && m_opaque_sp)
{
const bool append = true;
const bool symbols_ok = true;
return m_opaque_sp->FindFunctions (ConstString(name),
NULL,
name_type_mask,
symbols_ok,
append,
*sc_list);
m_opaque_sp->FindFunctions (ConstString(name),
NULL,
name_type_mask,
symbols_ok,
append,
*sb_sc_list);
}
return 0;
return sb_sc_list;
}

View File

@ -199,7 +199,7 @@ SBSymbolContext::SetFunction (lldb::SBFunction function)
void
SBSymbolContext::SetBlock (lldb::SBBlock block)
{
ref().block = block.get();
ref().block = block.GetPtr();
}
void

View File

@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "lldb/API/SBSymbolContextList.h"
#include "lldb/API/SBStream.h"
#include "lldb/Symbol/SymbolContext.h"
using namespace lldb;
@ -67,6 +68,20 @@ SBSymbolContextList::Clear()
m_opaque_ap->Clear();
}
void
SBSymbolContextList::Append(SBSymbolContext &sc)
{
if (sc.IsValid() && m_opaque_ap.get())
m_opaque_ap->Append(*sc);
}
void
SBSymbolContextList::Append(SBSymbolContextList &sc_list)
{
if (sc_list.IsValid() && m_opaque_ap.get())
m_opaque_ap->Append(*sc_list);
}
bool
SBSymbolContextList::IsValid () const
@ -90,6 +105,13 @@ SBSymbolContextList::operator*() const
return *m_opaque_ap.get();
}
bool
SBSymbolContextList::GetDescription (lldb::SBStream &description)
{
Stream &strm = description.ref();
if (m_opaque_ap.get())
m_opaque_ap->GetDescription (&strm, lldb::eDescriptionLevelFull, NULL);
return true;
}

View File

@ -1252,28 +1252,25 @@ SBTarget::GetDescription (SBStream &description, lldb::DescriptionLevel descript
return true;
}
uint32_t
SBTarget::FindFunctions (const char *name,
uint32_t name_type_mask,
bool append,
lldb::SBSymbolContextList& sc_list)
lldb::SBSymbolContextList
SBTarget::FindFunctions (const char *name, uint32_t name_type_mask)
{
if (!append)
sc_list.Clear();
lldb::SBSymbolContextList sb_sc_list;
if (name && name[0])
{
TargetSP target_sp(GetSP());
if (target_sp)
{
const bool symbols_ok = true;
return target_sp->GetImages().FindFunctions (ConstString(name),
name_type_mask,
symbols_ok,
append,
*sc_list);
const bool append = true;
target_sp->GetImages().FindFunctions (ConstString(name),
name_type_mask,
symbols_ok,
append,
*sb_sc_list);
}
}
return 0;
return sb_sc_list;
}
lldb::SBType

View File

@ -4158,21 +4158,21 @@ SymbolFileDWARF::DIEDeclContextsMatch (DWARFCompileUnit* cu1, const DWARFDebugIn
const char *name2 = decl_ctx_die2->GetName(this, cu2);
// If the string was from a DW_FORM_strp, then the pointer will often
// be the same!
if (name1 != name2)
if (name1 == name2)
continue;
// Name pointers are not equal, so only compare the strings
// if both are not NULL.
if (name1 && name2)
{
// Name pointers are not equal, so only compare the strings
// if both are not NULL.
if (name1 && name2)
{
// If the strings don't compare, we are done...
if (strcmp(name1, name2) != 0)
return false;
}
else if (name1 || name2)
{
// One name was NULL while the other wasn't
// If the strings don't compare, we are done...
if (strcmp(name1, name2) != 0)
return false;
}
}
else
{
// One name was NULL while the other wasn't
return false;
}
}
// We made it through all of the checks and the declaration contexts

View File

@ -905,6 +905,28 @@ SymbolContextList::Append(const SymbolContext& sc)
m_symbol_contexts.push_back(sc);
}
void
SymbolContextList::Append (const SymbolContextList& sc_list)
{
collection::const_iterator pos, end = sc_list.m_symbol_contexts.end();
for (pos = sc_list.m_symbol_contexts.begin(); pos != end; ++pos)
m_symbol_contexts.push_back (*pos);
}
uint32_t
SymbolContextList::AppendIfUnique (const SymbolContextList& sc_list, bool merge_symbol_into_function)
{
uint32_t unique_sc_add_count = 0;
collection::const_iterator pos, end = sc_list.m_symbol_contexts.end();
for (pos = sc_list.m_symbol_contexts.begin(); pos != end; ++pos)
{
if (AppendIfUnique (*pos, merge_symbol_into_function))
++unique_sc_add_count;
}
return unique_sc_add_count;
}
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc, bool merge_symbol_into_function)
{
@ -1013,6 +1035,16 @@ SymbolContextList::NumLineEntriesWithLine (uint32_t line) const
return match_count;
}
void
SymbolContextList::GetDescription(Stream *s,
lldb::DescriptionLevel level,
Target *target) const
{
const uint32_t size = m_symbol_contexts.size();
for (uint32_t idx = 0; idx<size; ++idx)
m_symbol_contexts[idx].GetDescription (s, level, target);
}
bool
lldb_private::operator== (const SymbolContextList& lhs, const SymbolContextList& rhs)
{

View File

@ -770,6 +770,21 @@ TypeImpl::TypeImpl(const lldb::TypeSP& type) :
{
}
void
TypeImpl::SetType (const lldb::TypeSP &type_sp)
{
if (type_sp)
{
m_clang_ast_type.SetClangType (type_sp->GetClangAST(), type_sp->GetClangFullType());
m_type_sp = type_sp;
}
else
{
m_clang_ast_type.Clear();
m_type_sp.reset();
}
}
TypeImpl&
TypeImpl::operator = (const TypeImpl& rhs)
{

View File

@ -15,7 +15,8 @@ def fuzz_obj(obj):
obj.GetDescription(lldb.SBStream())
obj.GetNumSymbols()
obj.GetSymbolAtIndex(sys.maxint)
obj.FindFunctions("my_func", 0xffffffff, True, lldb.SBSymbolContextList())
sc_list = obj.FindFunctions("my_func")
sc_list = obj.FindFunctions("my_func", lldb.eFunctionNameTypeAny)
obj.FindGlobalVariables(lldb.SBTarget(), "my_global_var", 1)
for section in obj.section_iter():
print section

View File

@ -20,8 +20,8 @@ def fuzz_obj(obj):
obj.GetDebugger()
filespec = lldb.SBFileSpec()
obj.FindModule(filespec)
contextlist = lldb.SBSymbolContextList()
obj.FindFunctions("the_func", 0xff, True, contextlist)
sc_list = obj.FindFunctions("the_func")
sc_list = obj.FindFunctions("the_func", lldb.eFunctionNameTypeAny)
obj.FindFirstType("dont_care")
obj.FindTypes("dont_care")
obj.FindFirstType(None)

View File

@ -87,7 +87,7 @@ class ModuleAndSectionAPIsTestCase(TestBase):
exe_module.FindFirstType(None)
exe_module.FindTypes(None)
exe_module.FindGlobalVariables(target, None, 1)
exe_module.FindFunctions(None, 0, True, lldb.SBSymbolContextList())
exe_module.FindFunctions(None, 0)
exe_module.FindSection(None)
# Get the section at index 1.

View File

@ -152,9 +152,8 @@ class TargetAPITestCase(TestBase):
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)
list = target.FindFunctions('c', lldb.eFunctionNameTypeAuto)
self.assertTrue(list.GetSize() == 1)
for sc in list:
self.assertTrue(sc.GetModule().GetFileSpec().GetFilename() == exe_name)