diff options
63 files changed, 594 insertions, 341 deletions
diff --git a/lldb/include/lldb/API/SBAddress.h b/lldb/include/lldb/API/SBAddress.h index b512ed66b52..dde7a0b05dc 100644 --- a/lldb/include/lldb/API/SBAddress.h +++ b/lldb/include/lldb/API/SBAddress.h @@ -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 diff --git a/lldb/include/lldb/API/SBBlock.h b/lldb/include/lldb/API/SBBlock.h index ec1e0b5ba8a..b8e61fc6eb2 100644 --- a/lldb/include/lldb/API/SBBlock.h +++ b/lldb/include/lldb/API/SBBlock.h @@ -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; }; diff --git a/lldb/include/lldb/API/SBBreakpoint.h b/lldb/include/lldb/API/SBBreakpoint.h index aae0446b31d..8c49126a131 100644 --- a/lldb/include/lldb/API/SBBreakpoint.h +++ b/lldb/include/lldb/API/SBBreakpoint.h @@ -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, diff --git a/lldb/include/lldb/API/SBBreakpointLocation.h b/lldb/include/lldb/API/SBBreakpointLocation.h index ab8e56b0ddc..3a6755237fc 100644 --- a/lldb/include/lldb/API/SBBreakpointLocation.h +++ b/lldb/include/lldb/API/SBBreakpointLocation.h @@ -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; diff --git a/lldb/include/lldb/API/SBBroadcaster.h b/lldb/include/lldb/API/SBBroadcaster.h index 92c1bba05ea..7b32d85faa0 100644 --- a/lldb/include/lldb/API/SBBroadcaster.h +++ b/lldb/include/lldb/API/SBBroadcaster.h @@ -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; diff --git a/lldb/include/lldb/API/SBCommandInterpreter.h b/lldb/include/lldb/API/SBCommandInterpreter.h index a33ff2dc8a9..3ad4abe4e7f 100644 --- a/lldb/include/lldb/API/SBCommandInterpreter.h +++ b/lldb/include/lldb/API/SBCommandInterpreter.h @@ -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, diff --git a/lldb/include/lldb/API/SBCommandReturnObject.h b/lldb/include/lldb/API/SBCommandReturnObject.h index 7136cf9e25e..39c78fdde3b 100644 --- a/lldb/include/lldb/API/SBCommandReturnObject.h +++ b/lldb/include/lldb/API/SBCommandReturnObject.h @@ -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); diff --git a/lldb/include/lldb/API/SBCompileUnit.h b/lldb/include/lldb/API/SBCompileUnit.h index bf56436ed51..3c8f00a41d8 100644 --- a/lldb/include/lldb/API/SBCompileUnit.h +++ b/lldb/include/lldb/API/SBCompileUnit.h @@ -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; }; diff --git a/lldb/include/lldb/API/SBData.h b/lldb/include/lldb/API/SBData.h index 0716c338254..b2824a49018 100644 --- a/lldb/include/lldb/API/SBData.h +++ b/lldb/include/lldb/API/SBData.h @@ -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); diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index 0f019086de3..3c80faa6169 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -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; diff --git a/lldb/include/lldb/API/SBError.h b/lldb/include/lldb/API/SBError.h index 3b6b90f74d9..a4aa56e82ea 100644 --- a/lldb/include/lldb/API/SBError.h +++ b/lldb/include/lldb/API/SBError.h @@ -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); diff --git a/lldb/include/lldb/API/SBEvent.h b/lldb/include/lldb/API/SBEvent.h index 7982b9995d6..6a3faaa1307 100644 --- a/lldb/include/lldb/API/SBEvent.h +++ b/lldb/include/lldb/API/SBEvent.h @@ -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; diff --git a/lldb/include/lldb/API/SBFileSpec.h b/lldb/include/lldb/API/SBFileSpec.h index bacc3d9879c..22a3915cdb7 100644 --- a/lldb/include/lldb/API/SBFileSpec.h +++ b/lldb/include/lldb/API/SBFileSpec.h @@ -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; }; diff --git a/lldb/include/lldb/API/SBFileSpecList.h b/lldb/include/lldb/API/SBFileSpecList.h index 90b6798fb56..08635bcd00d 100644 --- a/lldb/include/lldb/API/SBFileSpecList.h +++ b/lldb/include/lldb/API/SBFileSpecList.h @@ -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; }; diff --git a/lldb/include/lldb/API/SBFrame.h b/lldb/include/lldb/API/SBFrame.h index c78a1f91982..4501f774e97 100644 --- a/lldb/include/lldb/API/SBFrame.h +++ b/lldb/include/lldb/API/SBFrame.h @@ -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 diff --git a/lldb/include/lldb/API/SBFunction.h b/lldb/include/lldb/API/SBFunction.h index 264ad6ba700..e061d1d1bcd 100644 --- a/lldb/include/lldb/API/SBFunction.h +++ b/lldb/include/lldb/API/SBFunction.h @@ -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; diff --git a/lldb/include/lldb/API/SBInputReader.h b/lldb/include/lldb/API/SBInputReader.h index 9c1659dc240..61f7de4fde4 100644 --- a/lldb/include/lldb/API/SBInputReader.h +++ b/lldb/include/lldb/API/SBInputReader.h @@ -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 diff --git a/lldb/include/lldb/API/SBInstruction.h b/lldb/include/lldb/API/SBInstruction.h index 420e869a959..e23144869ca 100644 --- a/lldb/include/lldb/API/SBInstruction.h +++ b/lldb/include/lldb/API/SBInstruction.h @@ -28,10 +28,8 @@ public: SBInstruction (const SBInstruction &rhs); -#ifndef SWIG const SBInstruction & operator = (const SBInstruction &rhs); -#endif ~SBInstruction (); diff --git a/lldb/include/lldb/API/SBInstructionList.h b/lldb/include/lldb/API/SBInstructionList.h index 0d336d4005a..944e144a148 100644 --- a/lldb/include/lldb/API/SBInstructionList.h +++ b/lldb/include/lldb/API/SBInstructionList.h @@ -24,10 +24,8 @@ public: SBInstructionList (const SBInstructionList &rhs); -#ifndef SWIG const SBInstructionList & operator = (const SBInstructionList &rhs); -#endif ~SBInstructionList (); diff --git a/lldb/include/lldb/API/SBLineEntry.h b/lldb/include/lldb/API/SBLineEntry.h index 35b31c6981d..58dada07bea 100644 --- a/lldb/include/lldb/API/SBLineEntry.h +++ b/lldb/include/lldb/API/SBLineEntry.h @@ -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 diff --git a/lldb/include/lldb/API/SBListener.h b/lldb/include/lldb/API/SBListener.h index 0c7ebe5d7fd..e43506e6ab6 100644 --- a/lldb/include/lldb/API/SBListener.h +++ b/lldb/include/lldb/API/SBListener.h @@ -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; }; diff --git a/lldb/include/lldb/API/SBModule.h b/lldb/include/lldb/API/SBModule.h index 58420c97231..23e1ed4d94b 100644 --- a/lldb/include/lldb/API/SBModule.h +++ b/lldb/include/lldb/API/SBModule.h @@ -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. diff --git a/lldb/include/lldb/API/SBProcess.h b/lldb/include/lldb/API/SBProcess.h index db636a9727e..be169f0ba09 100644 --- a/lldb/include/lldb/API/SBProcess.h +++ b/lldb/include/lldb/API/SBProcess.h @@ -37,10 +37,8 @@ public: SBProcess (const lldb::SBProcess& rhs); -#ifndef SWIG const lldb::SBProcess& operator = (const lldb::SBProcess& rhs); -#endif ~SBProcess(); diff --git a/lldb/include/lldb/API/SBSection.h b/lldb/include/lldb/API/SBSection.h index 84bb3b81694..c951cc13e06 100644 --- a/lldb/include/lldb/API/SBSection.h +++ b/lldb/include/lldb/API/SBSection.h @@ -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; }; diff --git a/lldb/include/lldb/API/SBSourceManager.h b/lldb/include/lldb/API/SBSourceManager.h index 9e8f7d1edd8..b353b71b117 100644 --- a/lldb/include/lldb/API/SBSourceManager.h +++ b/lldb/include/lldb/API/SBSourceManager.h @@ -25,10 +25,8 @@ public: ~SBSourceManager(); -#ifndef SWIG const lldb::SBSourceManager & operator = (const lldb::SBSourceManager &rhs); -#endif size_t DisplaySourceLinesWithLineNumbers (const lldb::SBFileSpec &file, diff --git a/lldb/include/lldb/API/SBStream.h b/lldb/include/lldb/API/SBStream.h index a3b112e5b88..19b6be448ea 100644 --- a/lldb/include/lldb/API/SBStream.h +++ b/lldb/include/lldb/API/SBStream.h @@ -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); diff --git a/lldb/include/lldb/API/SBStringList.h b/lldb/include/lldb/API/SBStringList.h index 7328b42b6e5..ef189759867 100644 --- a/lldb/include/lldb/API/SBStringList.h +++ b/lldb/include/lldb/API/SBStringList.h @@ -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; diff --git a/lldb/include/lldb/API/SBSymbol.h b/lldb/include/lldb/API/SBSymbol.h index 37d78285031..6315794fab3 100644 --- a/lldb/include/lldb/API/SBSymbol.h +++ b/lldb/include/lldb/API/SBSymbol.h @@ -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; diff --git a/lldb/include/lldb/API/SBSymbolContext.h b/lldb/include/lldb/API/SBSymbolContext.h index a678b6733ed..4ffd0ff1361 100644 --- a/lldb/include/lldb/API/SBSymbolContext.h +++ b/lldb/include/lldb/API/SBSymbolContext.h @@ -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; diff --git a/lldb/include/lldb/API/SBSymbolContextList.h b/lldb/include/lldb/API/SBSymbolContextList.h index b07f32ebf56..352522d43ab 100644 --- a/lldb/include/lldb/API/SBSymbolContextList.h +++ b/lldb/include/lldb/API/SBSymbolContextList.h @@ -24,10 +24,8 @@ public: ~SBSymbolContextList (); -#ifndef SWIG const lldb::SBSymbolContextList & operator = (const lldb::SBSymbolContextList &rhs); -#endif bool IsValid () const; @@ -35,10 +33,19 @@ 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(); protected: @@ -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; }; diff --git a/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h index d75035d6553..8029c2b8c5b 100644 --- a/lldb/include/lldb/API/SBTarget.h +++ b/lldb/include/lldb/API/SBTarget.h @@ -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; diff --git a/lldb/include/lldb/API/SBThread.h b/lldb/include/lldb/API/SBThread.h index 66b510f7a06..dc502ac922b 100644 --- a/lldb/include/lldb/API/SBThread.h +++ b/lldb/include/lldb/API/SBThread.h @@ -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; diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h index 4517e702b86..6cfaca6ee6a 100644 --- a/lldb/include/lldb/API/SBType.h +++ b/lldb/include/lldb/API/SBType.h @@ -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 &); diff --git a/lldb/include/lldb/API/SBValue.h b/lldb/include/lldb/API/SBValue.h index 6c01a544ffa..87e002040fc 100644 --- a/lldb/include/lldb/API/SBValue.h +++ b/lldb/include/lldb/API/SBValue.h @@ -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; diff --git a/lldb/include/lldb/API/SBValueList.h b/lldb/include/lldb/API/SBValueList.h index 470bae16f04..a1874145aac 100644 --- a/lldb/include/lldb/API/SBValueList.h +++ b/lldb/include/lldb/API/SBValueList.h @@ -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; diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index 0df8ca5aec8..0d04a36e741 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -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. //------------------------------------------------------------------ diff --git a/lldb/include/lldb/Symbol/ClangASTType.h b/lldb/include/lldb/Symbol/ClangASTType.h index dd6e3657155..75f71d16a86 100644 --- a/lldb/include/lldb/Symbol/ClangASTType.h +++ b/lldb/include/lldb/Symbol/ClangASTType.h @@ -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; diff --git a/lldb/include/lldb/Symbol/Function.h b/lldb/include/lldb/Symbol/Function.h index 80f9d098170..9e1fd6bb270 100644 --- a/lldb/include/lldb/Symbol/Function.h +++ b/lldb/include/lldb/Symbol/Function.h @@ -463,7 +463,7 @@ public: /// @param[out] line_no /// The line number. //------------------------------------------------------------------ - void + void GetEndLineSourceInfo (FileSpec &source_file, uint32_t &line_no); //------------------------------------------------------------------ diff --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h index 055a4f04a14..5d2181d87fb 100644 --- a/lldb/include/lldb/Symbol/SymbolContext.h +++ b/lldb/include/lldb/Symbol/SymbolContext.h @@ -361,9 +361,16 @@ public: void Append (const SymbolContext& sc); + void + Append (const SymbolContextList& sc_list); + bool - AppendIfUnique (const SymbolContext& sc, bool merge_symbol_into_function); + 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. diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h index 35fcd23d2c2..0a8e51d2acb 100644 --- a/lldb/include/lldb/Symbol/Type.h +++ b/lldb/include/lldb/Symbol/Type.h @@ -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; diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 4f3cf6a9937..8b901b144c4 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -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; diff --git a/lldb/scripts/Python/interface/SBBlock.i b/lldb/scripts/Python/interface/SBBlock.i index 83895edcc06..cdaf62cbeca 100644 --- a/lldb/scripts/Python/interface/SBBlock.i +++ b/lldb/scripts/Python/interface/SBBlock.i @@ -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 diff --git a/lldb/scripts/Python/interface/SBFunction.i b/lldb/scripts/Python/interface/SBFunction.i index 37b957fd5cf..e259490310b 100644 --- a/lldb/scripts/Python/interface/SBFunction.i +++ b/lldb/scripts/Python/interface/SBFunction.i @@ -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) %} }; diff --git a/lldb/scripts/Python/interface/SBModule.i b/lldb/scripts/Python/interface/SBModule.i index dc8f674722b..44d3a86d667 100644 --- a/lldb/scripts/Python/interface/SBModule.i +++ b/lldb/scripts/Python/interface/SBModule.i @@ -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); diff --git a/lldb/scripts/Python/interface/SBSymbolContext.i b/lldb/scripts/Python/interface/SBSymbolContext.i index 5f29e8e2c3b..4bf7fe34788 100644 --- a/lldb/scripts/Python/interface/SBSymbolContext.i +++ b/lldb/scripts/Python/interface/SBSymbolContext.i @@ -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 diff --git a/lldb/scripts/Python/interface/SBSymbolContextList.i b/lldb/scripts/Python/interface/SBSymbolContextList.i index 6ea5978baed..0a03a22d4ab 100644 --- a/lldb/scripts/Python/interface/SBSymbolContextList.i +++ b/lldb/scripts/Python/interface/SBSymbolContextList.i @@ -49,7 +49,92 @@ public: 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 diff --git a/lldb/scripts/Python/interface/SBTarget.i b/lldb/scripts/Python/interface/SBTarget.i index d917530ad0d..58a546b54c7 100644 --- a/lldb/scripts/Python/interface/SBTarget.i +++ b/lldb/scripts/Python/interface/SBTarget.i @@ -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); diff --git a/lldb/scripts/Python/python-extensions.swig b/lldb/scripts/Python/python-extensions.swig index c6c12fc0efc..29e39e54e57 100644 --- a/lldb/scripts/Python/python-extensions.swig +++ b/lldb/scripts/Python/python-extensions.swig @@ -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 diff --git a/lldb/source/API/SBAddress.cpp b/lldb/source/API/SBAddress.cpp index 7397588eaf4..7d7d1d7789e 100644 --- a/lldb/source/API/SBAddress.cpp +++ b/lldb/source/API/SBAddress.cpp @@ -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; } diff --git a/lldb/source/API/SBBlock.cpp b/lldb/source/API/SBBlock.cpp index eeae1d3b02b..8f325f472bc 100644 --- a/lldb/source/API/SBBlock.cpp +++ b/lldb/source/API/SBBlock.cpp @@ -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; +} + diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp index ce57c83520d..fb9957106a1 100644 --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/source/API/SBFrame.cpp @@ -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; } diff --git a/lldb/source/API/SBFunction.cpp b/lldb/source/API/SBFunction.cpp index e3e56a53011..cf80cbf333d 100644 --- a/lldb/source/API/SBFunction.cpp +++ b/lldb/source/API/SBFunction.cpp @@ -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; +} + + diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp index d2ef05fde31..1fe51222ac9 100644 --- a/lldb/source/API/SBModule.cpp +++ b/lldb/source/API/SBModule.cpp @@ -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; } diff --git a/lldb/source/API/SBSymbolContext.cpp b/lldb/source/API/SBSymbolContext.cpp index 0f7ce8cf0ac..a310d25565c 100644 --- a/lldb/source/API/SBSymbolContext.cpp +++ b/lldb/source/API/SBSymbolContext.cpp @@ -199,7 +199,7 @@ SBSymbolContext::SetFunction (lldb::SBFunction function) void SBSymbolContext::SetBlock (lldb::SBBlock block) { - ref().block = block.get(); + ref().block = block.GetPtr(); } void diff --git a/lldb/source/API/SBSymbolContextList.cpp b/lldb/source/API/SBSymbolContextList.cpp index ca6c80ca999..0730096c5f3 100644 --- a/lldb/source/API/SBSymbolContextList.cpp +++ b/lldb/source/API/SBSymbolContextList.cpp @@ -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; +} diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index ed667cc52ea..5988887c551 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -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 diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 9c709bebd6b..55d90aae68a 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -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 diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp index 141ad680690..6be75a27b36 100644 --- a/lldb/source/Symbol/SymbolContext.cpp +++ b/lldb/source/Symbol/SymbolContext.cpp @@ -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) { diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp index 66a13e2f38a..0844a9ecc6c 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -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) { diff --git a/lldb/test/python_api/default-constructor/sb_module.py b/lldb/test/python_api/default-constructor/sb_module.py index d026be15506..771d326efee 100644 --- a/lldb/test/python_api/default-constructor/sb_module.py +++ b/lldb/test/python_api/default-constructor/sb_module.py @@ -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 diff --git a/lldb/test/python_api/default-constructor/sb_target.py b/lldb/test/python_api/default-constructor/sb_target.py index 19f453768b2..3e6c6f63056 100644 --- a/lldb/test/python_api/default-constructor/sb_target.py +++ b/lldb/test/python_api/default-constructor/sb_target.py @@ -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) diff --git a/lldb/test/python_api/module_section/TestModuleAndSection.py b/lldb/test/python_api/module_section/TestModuleAndSection.py index f9562cbf490..ebd0ea04909 100644 --- a/lldb/test/python_api/module_section/TestModuleAndSection.py +++ b/lldb/test/python_api/module_section/TestModuleAndSection.py @@ -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. diff --git a/lldb/test/python_api/target/TestTargetAPI.py b/lldb/test/python_api/target/TestTargetAPI.py index e0cfa477238..de845cc5580 100644 --- a/lldb/test/python_api/target/TestTargetAPI.py +++ b/lldb/test/python_api/target/TestTargetAPI.py @@ -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) |