[Lldb-commits] [lldb] r137516 - in /lldb/trunk: include/lldb/ include/lldb/API/ include/lldb/Core/ include/lldb/Symbol/ include/lldb/Target/ include/lldb/Utility/ source/API/ source/Core/ source/Expression/ source/Symbol/ source/Target/

Greg Clayton gclayton at apple.com
Fri Aug 12 14:40:01 PDT 2011


Author: gclayton
Date: Fri Aug 12 16:40:01 2011
New Revision: 137516

URL: http://llvm.org/viewvc/llvm-project?rev=137516&view=rev
Log:
We were leaking a stack frame in StackFrameList in Thread.cpp which could
cause extra shared pointer references to one or more modules to be leaked.
This would cause many object files to stay around the life of LLDB, so after
a recompile and rexecution, we would keep adding more and more memory. After
fixing the leak, we found many cases where leaked stack frames were still
being used and causing crashes in the test suite. These are now all resolved.


Modified:
    lldb/trunk/include/lldb/API/SBAddress.h
    lldb/trunk/include/lldb/API/SBBlock.h
    lldb/trunk/include/lldb/API/SBCompileUnit.h
    lldb/trunk/include/lldb/API/SBFunction.h
    lldb/trunk/include/lldb/API/SBLineEntry.h
    lldb/trunk/include/lldb/API/SBSymbol.h
    lldb/trunk/include/lldb/API/SBSymbolContext.h
    lldb/trunk/include/lldb/Core/Address.h
    lldb/trunk/include/lldb/Core/FormatManager.h
    lldb/trunk/include/lldb/Core/Module.h
    lldb/trunk/include/lldb/Symbol/Block.h
    lldb/trunk/include/lldb/Symbol/CompileUnit.h
    lldb/trunk/include/lldb/Symbol/Function.h
    lldb/trunk/include/lldb/Symbol/Symbol.h
    lldb/trunk/include/lldb/Symbol/SymbolContextScope.h
    lldb/trunk/include/lldb/Target/Thread.h
    lldb/trunk/include/lldb/Target/ThreadPlanTracer.h
    lldb/trunk/include/lldb/Utility/SharingPtr.h
    lldb/trunk/include/lldb/lldb-types.h
    lldb/trunk/source/API/SBAddress.cpp
    lldb/trunk/source/Core/Address.cpp
    lldb/trunk/source/Core/Module.cpp
    lldb/trunk/source/Core/ModuleList.cpp
    lldb/trunk/source/Core/ValueObject.cpp
    lldb/trunk/source/Expression/ClangFunction.cpp
    lldb/trunk/source/Symbol/Block.cpp
    lldb/trunk/source/Symbol/CompileUnit.cpp
    lldb/trunk/source/Symbol/Function.cpp
    lldb/trunk/source/Symbol/Symbol.cpp
    lldb/trunk/source/Target/Thread.cpp
    lldb/trunk/source/Target/ThreadPlanTracer.cpp

Modified: lldb/trunk/include/lldb/API/SBAddress.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBAddress.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBAddress.h (original)
+++ lldb/trunk/include/lldb/API/SBAddress.h Fri Aug 12 16:40:01 2011
@@ -57,8 +57,43 @@
     SectionType
     GetSectionType ();
 
+    // The following queries can lookup symbol information for a given address.
+    // An address might refer to code or data from an existing module, or it
+    // might refer to something on the stack or heap. The following functions
+    // will only return valid values if the address has been resolved to a code
+    // or data address using "void SBAddress::SetLoadAddress(...)" or 
+    // "lldb::SBAddress SBTarget::ResolveLoadAddress (...)". 
+    lldb::SBSymbolContext
+    GetSymbolContext (uint32_t resolve_scope);
+
+    
+    // The following functions grab individual objects for a given address and
+    // are less efficient if you want more than one symbol related objects. 
+    // Use one of the following when you want multiple debug symbol related 
+    // objects for an address:
+    //    lldb::SBSymbolContext SBAddress::GetSymbolContext (uint32_t resolve_scope);
+    //    lldb::SBSymbolContext SBTarget::ResolveSymbolContextForAddress (const SBAddress &addr, uint32_t resolve_scope);
+    // One or more bits from the SymbolContextItem enumerations can be logically
+    // OR'ed together to more efficiently retrieve multiple symbol objects.
+
     lldb::SBModule
     GetModule ();
+    
+    lldb::SBCompileUnit
+    GetCompileUnit ();
+
+    lldb::SBFunction
+    GetFunction ();
+
+    lldb::SBBlock
+    GetBlock ();
+
+    lldb::SBSymbol
+    GetSymbol ();
+
+    lldb::SBLineEntry
+    GetLineEntry ();
+    
 
 protected:
 

Modified: lldb/trunk/include/lldb/API/SBBlock.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBlock.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBBlock.h (original)
+++ lldb/trunk/include/lldb/API/SBBlock.h Fri Aug 12 16:40:01 2011
@@ -60,6 +60,7 @@
     GetDescription (lldb::SBStream &description);
 
 private:
+    friend class SBAddress;
     friend class SBFrame;
     friend class SBSymbolContext;
 

Modified: lldb/trunk/include/lldb/API/SBCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCompileUnit.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBCompileUnit.h (original)
+++ lldb/trunk/include/lldb/API/SBCompileUnit.h Fri Aug 12 16:40:01 2011
@@ -61,6 +61,7 @@
     GetDescription (lldb::SBStream &description);
 
 private:
+    friend class SBAddress;
     friend class SBFrame;
     friend class SBSymbolContext;
 

Modified: lldb/trunk/include/lldb/API/SBFunction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFunction.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBFunction.h (original)
+++ lldb/trunk/include/lldb/API/SBFunction.h Fri Aug 12 16:40:01 2011
@@ -77,6 +77,7 @@
 #endif
 
 private:
+    friend class SBAddress;
     friend class SBFrame;
     friend class SBSymbolContext;
 

Modified: lldb/trunk/include/lldb/API/SBLineEntry.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBLineEntry.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBLineEntry.h (original)
+++ lldb/trunk/include/lldb/API/SBLineEntry.h Fri Aug 12 16:40:01 2011
@@ -67,6 +67,7 @@
     get ();
     
 private:
+    friend class SBAddress;
     friend class SBCompileUnit;
     friend class SBFrame;
     friend class SBSymbolContext;

Modified: lldb/trunk/include/lldb/API/SBSymbol.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSymbol.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBSymbol.h (original)
+++ lldb/trunk/include/lldb/API/SBSymbol.h Fri Aug 12 16:40:01 2011
@@ -79,6 +79,7 @@
 #endif
     
 private:
+    friend class SBAddress;
     friend class SBFrame;
     friend class SBModule;
     friend class SBSymbolContext;

Modified: lldb/trunk/include/lldb/API/SBSymbolContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSymbolContext.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBSymbolContext.h (original)
+++ lldb/trunk/include/lldb/API/SBSymbolContext.h Fri Aug 12 16:40:01 2011
@@ -48,6 +48,7 @@
     GetDescription (lldb::SBStream &description);
 
 protected:
+    friend class SBAddress;
     friend class SBFrame;
     friend class SBModule;
     friend class SBThread;

Modified: lldb/trunk/include/lldb/Core/Address.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Address.h (original)
+++ lldb/trunk/include/lldb/Core/Address.h Fri Aug 12 16:40:01 2011
@@ -496,8 +496,27 @@
     ///
     /// @see SymbolContextScope::CalculateSymbolContext(SymbolContext*)
     //------------------------------------------------------------------
-    void
-    CalculateSymbolContext (SymbolContext *sc);
+    uint32_t
+    CalculateSymbolContext (SymbolContext *sc, 
+                            uint32_t resolve_scope = lldb::eSymbolContextEverything);
+
+    Module *
+    CalculateSymbolContextModule ();
+    
+    CompileUnit *
+    CalculateSymbolContextCompileUnit ();
+    
+    Function *
+    CalculateSymbolContextFunction ();
+    
+    Block *
+    CalculateSymbolContextBlock ();
+
+    Symbol *
+    CalculateSymbolContextSymbol ();
+
+    bool
+    CalculateSymbolContextLineEntry (LineEntry &line_entry);
 
 protected:
     //------------------------------------------------------------------

Modified: lldb/trunk/include/lldb/Core/FormatManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatManager.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatManager.h (original)
+++ lldb/trunk/include/lldb/Core/FormatManager.h Fri Aug 12 16:40:01 2011
@@ -475,12 +475,12 @@
             }
             if (log)
                 log->Printf("stripping ObjC pointer");
-            /*
-             for some reason, C++ can quite easily obtain the type hierarchy for a ValueObject
-             even if the VO represent a pointer-to-class, as long as the typePtr is right
-             Objective-C on the other hand cannot really complete an @interface when
-             the VO refers to a pointer-to- at interface
-             */
+            
+            // For some reason, C++ can quite easily obtain the type hierarchy for a ValueObject
+            // even if the VO represent a pointer-to-class, as long as the typePtr is right
+            // Objective-C on the other hand cannot really complete an @interface when
+            // the VO refers to a pointer-to- at interface
+
             Error error;
             ValueObject* target = vobj.Dereference(error).get();
             if (error.Fail() || !target)

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Fri Aug 12 16:40:01 2011
@@ -116,6 +116,9 @@
     virtual void
     CalculateSymbolContext (SymbolContext* sc);
 
+    virtual Module *
+    CalculateSymbolContextModule ();
+
     void
     GetDescription (Stream *s);
 

Modified: lldb/trunk/include/lldb/Symbol/Block.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Block.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Block.h (original)
+++ lldb/trunk/include/lldb/Symbol/Block.h Fri Aug 12 16:40:01 2011
@@ -107,6 +107,18 @@
     virtual void
     CalculateSymbolContext(SymbolContext* sc);
 
+    virtual Module *
+    CalculateSymbolContextModule ();
+
+    virtual CompileUnit *
+    CalculateSymbolContextCompileUnit ();
+
+    virtual Function *
+    CalculateSymbolContextFunction ();
+
+    virtual Block *
+    CalculateSymbolContextBlock ();
+
     //------------------------------------------------------------------
     /// Check if an offset is in one of the block offset ranges.
     ///

Modified: lldb/trunk/include/lldb/Symbol/CompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompileUnit.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/CompileUnit.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompileUnit.h Fri Aug 12 16:40:01 2011
@@ -127,6 +127,12 @@
     virtual void
     CalculateSymbolContext(SymbolContext* sc);
 
+    virtual Module *
+    CalculateSymbolContextModule ();
+    
+    virtual CompileUnit *
+    CalculateSymbolContextCompileUnit ();
+
     //------------------------------------------------------------------
     /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
     ///

Modified: lldb/trunk/include/lldb/Symbol/Function.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Function.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Function.h (original)
+++ lldb/trunk/include/lldb/Symbol/Function.h Fri Aug 12 16:40:01 2011
@@ -422,6 +422,15 @@
     virtual void
     CalculateSymbolContext(SymbolContext* sc);
 
+    virtual Module *
+    CalculateSymbolContextModule ();
+    
+    virtual CompileUnit *
+    CalculateSymbolContextCompileUnit ();
+    
+    virtual Function *
+    CalculateSymbolContextFunction ();
+
     const AddressRange &
     GetAddressRange()
     {

Modified: lldb/trunk/include/lldb/Symbol/Symbol.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Symbol.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Symbol.h (original)
+++ lldb/trunk/include/lldb/Symbol/Symbol.h Fri Aug 12 16:40:01 2011
@@ -175,6 +175,12 @@
     virtual void
     CalculateSymbolContext (SymbolContext *sc);
 
+    virtual Module *
+    CalculateSymbolContextModule ();
+    
+    virtual Symbol *
+    CalculateSymbolContextSymbol ();
+
     //------------------------------------------------------------------
     /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
     ///

Modified: lldb/trunk/include/lldb/Symbol/SymbolContextScope.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolContextScope.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolContextScope.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolContextScope.h Fri Aug 12 16:40:01 2011
@@ -87,6 +87,37 @@
     virtual void
     CalculateSymbolContext (SymbolContext *sc) = 0;
 
+
+    virtual Module *
+    CalculateSymbolContextModule ()
+    {
+        return NULL;
+    }
+
+    virtual CompileUnit *
+    CalculateSymbolContextCompileUnit ()
+    {
+        return NULL;
+    }
+
+    virtual Function *
+    CalculateSymbolContextFunction ()
+    {
+        return NULL;
+    }
+
+    virtual Block *
+    CalculateSymbolContextBlock ()
+    {
+        return NULL;
+    }
+
+    virtual Symbol *
+    CalculateSymbolContextSymbol ()
+    {
+        return NULL;
+    }
+
     //------------------------------------------------------------------
     /// Dump the object's symbolc context to the stream \a s.
     ///

Modified: lldb/trunk/include/lldb/Target/Thread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Thread.h (original)
+++ lldb/trunk/include/lldb/Target/Thread.h Fri Aug 12 16:40:01 2011
@@ -781,7 +781,7 @@
     plan_stack          m_plan_stack;       ///< The stack of plans this thread is executing.
     plan_stack          m_completed_plan_stack;  ///< Plans that have been completed by this stop.  They get deleted when the thread resumes.
     plan_stack          m_discarded_plan_stack;  ///< Plans that have been discarded by this stop.  They get deleted when the thread resumes.
-    std::auto_ptr<StackFrameList> m_curr_frames_ap; ///< The stack frames that get lazily populated after a thread stops.
+    lldb::StackFrameListSP m_curr_frames_sp; ///< The stack frames that get lazily populated after a thread stops.
     lldb::StackFrameListSP m_prev_frames_sp; ///< The previous stack frames from the last time this thread stopped.
     int                 m_resume_signal;    ///< The signal that should be used when continuing this thread.
     lldb::StateType     m_resume_state;     ///< The state that indicates what this thread should do when the process is resumed.

Modified: lldb/trunk/include/lldb/Target/ThreadPlanTracer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanTracer.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadPlanTracer.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanTracer.h Fri Aug 12 16:40:01 2011
@@ -111,12 +111,14 @@
     virtual void TracingEnded ();
     virtual void Log();
 private:
-    void InitializeTracer();
     
-    Process                &m_process;
-    Target                 &m_target;
-    Disassembler           *m_disassembler;
-    const ABI              *m_abi;
+    Disassembler *
+    GetDisassembler ();
+
+    TypeFromUser
+    GetIntPointerType();
+
+    std::auto_ptr<Disassembler> m_disassembler_ap;
     TypeFromUser            m_intptr_type;
     std::vector<RegisterValue> m_register_values;
     lldb::DataBufferSP      m_buffer_sp;

Modified: lldb/trunk/include/lldb/Utility/SharingPtr.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/SharingPtr.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/SharingPtr.h (original)
+++ lldb/trunk/include/lldb/Utility/SharingPtr.h Fri Aug 12 16:40:01 2011
@@ -441,6 +441,97 @@
     return SharingPtr<T>(r, const_cast<T*>(r.get()));
 }
 
+template <class T>
+class LoggingSharingPtr
+    : public SharingPtr<T>
+{
+    typedef SharingPtr<T> base;
+
+public:
+    typedef void (*Callback)(void*, const LoggingSharingPtr&, bool action);
+    // action:  false means increment just happened
+    //          true  means decrement is about to happen
+
+private:
+    Callback cb_;
+    void* baton_;
+
+public:
+    LoggingSharingPtr() : cb_(0), baton_(0) {}
+    LoggingSharingPtr(Callback cb, void* baton)
+        : cb_(cb), baton_(baton)
+    {
+        if (cb_)
+            cb_(baton_, *this, false);
+    }
+
+    template <class Y>
+    LoggingSharingPtr(Y* p)
+        : base(p), cb_(0), baton_(0) {}
+
+    template <class Y>
+    LoggingSharingPtr(Y* p, Callback cb, void* baton)
+        : base(p), cb_(cb), baton_(baton)
+    {
+        if (cb_)
+            cb_(baton_, *this, false);
+    }
+
+    ~LoggingSharingPtr()
+    {
+        if (cb_)
+            cb_(baton_, *this, true);
+    }
+
+    LoggingSharingPtr(const LoggingSharingPtr& p)
+        : base(p), cb_(p.cb_), baton_(p.baton_)
+    {
+        if (cb_)
+            cb_(baton_, *this, false);
+    }
+
+    LoggingSharingPtr& operator=(const LoggingSharingPtr& p)
+    {
+        if (cb_)
+            cb_(baton_, *this, true);
+        base::operator=(p);
+        cb_ = p.cb_;
+        baton_ = p.baton_;
+        if (cb_)
+            cb_(baton_, *this, false);
+        return *this;
+    }
+
+    void reset()
+    {
+        if (cb_)
+            cb_(baton_, *this, true);
+        base::reset();
+    }
+
+    template <class Y>
+    void reset(Y* p)
+    {
+        if (cb_)
+            cb_(baton_, *this, true);
+        base::reset(p);
+        if (cb_)
+            cb_(baton_, *this, false);
+    }
+
+    void SetCallback(Callback cb, void* baton)
+    {
+        cb_ = cb;
+        baton_ = baton;
+    }
+
+    void ClearCallback()
+    {
+        cb_ = 0;
+        baton_ = 0;
+    }
+};
+
 } // namespace lldb
 
 #endif  // utility_SharingPtr_h_

Modified: lldb/trunk/include/lldb/lldb-types.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-types.h?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-types.h (original)
+++ lldb/trunk/include/lldb/lldb-types.h Fri Aug 12 16:40:01 2011
@@ -64,6 +64,11 @@
         {
             typedef lldb_private::SharingPtr<_Tp> Type;
         };
+        template<typename _Tp>
+        struct LoggingSharedPtr
+        {
+            typedef lldb_private::LoggingSharingPtr<_Tp> Type;
+        };
 
 } // namespace lldb
 

Modified: lldb/trunk/source/API/SBAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAddress.cpp?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/source/API/SBAddress.cpp (original)
+++ lldb/trunk/source/API/SBAddress.cpp Fri Aug 12 16:40:01 2011
@@ -228,4 +228,62 @@
     return sb_module;
 }
 
+SBSymbolContext
+SBAddress::GetSymbolContext (uint32_t resolve_scope)
+{
+    SBSymbolContext sb_sc;
+    if (m_opaque_ap.get())
+        m_opaque_ap->CalculateSymbolContext (&sb_sc.ref(), resolve_scope);
+    return sb_sc;
+}
+
+SBCompileUnit
+SBAddress::GetCompileUnit ()
+{
+    SBCompileUnit sb_comp_unit;
+    if (m_opaque_ap.get())
+        sb_comp_unit.reset(m_opaque_ap->CalculateSymbolContextCompileUnit());
+    return sb_comp_unit;
+}
+
+SBFunction
+SBAddress::GetFunction ()
+{
+    SBFunction sb_function;
+    if (m_opaque_ap.get())
+        sb_function.reset(m_opaque_ap->CalculateSymbolContextFunction());
+    return sb_function;
+}
+
+SBBlock
+SBAddress::GetBlock ()
+{
+    SBBlock sb_block;
+    if (m_opaque_ap.get())
+        sb_block.reset(m_opaque_ap->CalculateSymbolContextBlock());
+    return sb_block;
+}
+
+SBSymbol
+SBAddress::GetSymbol ()
+{
+    SBSymbol sb_symbol;
+    if (m_opaque_ap.get())
+        sb_symbol.reset(m_opaque_ap->CalculateSymbolContextSymbol());
+    return sb_symbol;
+}
+
+SBLineEntry
+SBAddress::GetLineEntry ()
+{
+    SBLineEntry sb_line_entry;
+    if (m_opaque_ap.get())
+    {
+        LineEntry line_entry;
+        if (m_opaque_ap->CalculateSymbolContextLineEntry (line_entry))
+            sb_line_entry.SetLineEntry (line_entry);
+    }
+    return sb_line_entry;
+}
+
 

Modified: lldb/trunk/source/Core/Address.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/source/Core/Address.cpp (original)
+++ lldb/trunk/source/Core/Address.cpp Fri Aug 12 16:40:01 2011
@@ -727,20 +727,115 @@
     return true;
 }
 
-void
-Address::CalculateSymbolContext (SymbolContext *sc)
+uint32_t
+Address::CalculateSymbolContext (SymbolContext *sc, uint32_t resolve_scope)
 {
     sc->Clear();
     // Absolute addresses don't have enough information to reconstruct even their target.
-    if (m_section == NULL)
-        return;
+    if (m_section)
+    {
+        Module *address_module = m_section->GetModule();
+        if (address_module)
+        {
+            sc->module_sp = address_module->GetSP();
+            if (sc->module_sp)
+                return sc->module_sp->ResolveSymbolContextForAddress (*this, resolve_scope, *sc);
+        }
+    }
+    return 0;
+}
+
+Module *
+Address::CalculateSymbolContextModule ()
+{
+    if (m_section)
+        return m_section->GetModule();
+    return NULL;
+}
+
+CompileUnit *
+Address::CalculateSymbolContextCompileUnit ()
+{
+    if (m_section)
+    {
+        SymbolContext sc;
+        sc.module_sp = m_section->GetModule()->GetSP();
+        if (sc.module_sp)
+        {
+            sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextCompUnit, sc);
+            return sc.comp_unit;
+        }
+    }
+    return NULL;
+}
+
+Function *
+Address::CalculateSymbolContextFunction ()
+{
+    if (m_section)
+    {
+        SymbolContext sc;
+        sc.module_sp = m_section->GetModule()->GetSP();
+        if (sc.module_sp)
+        {
+            sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextFunction, sc);
+            return sc.function;
+        }
+    }
+    return NULL;
+}
 
-    if (m_section->GetModule())
+Block *
+Address::CalculateSymbolContextBlock ()
+{
+    if (m_section)
     {
-        sc->module_sp = m_section->GetModule()->GetSP();
-        if (sc->module_sp)
-            sc->module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextEverything, *sc);
+        SymbolContext sc;
+        sc.module_sp = m_section->GetModule()->GetSP();
+        if (sc.module_sp)
+        {
+            sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextBlock, sc);
+            return sc.block;
+        }
     }
+    return NULL;
+}
+
+Symbol *
+Address::CalculateSymbolContextSymbol ()
+{
+    if (m_section)
+    {
+        SymbolContext sc;
+        sc.module_sp = m_section->GetModule()->GetSP();
+        if (sc.module_sp)
+        {
+            sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextSymbol, sc);
+            return sc.symbol;
+        }
+    }
+    return NULL;
+}
+
+bool
+Address::CalculateSymbolContextLineEntry (LineEntry &line_entry)
+{
+    if (m_section)
+    {
+        SymbolContext sc;
+        sc.module_sp = m_section->GetModule()->GetSP();
+        if (sc.module_sp)
+        {
+            sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextLineEntry, sc);
+            if (sc.line_entry.IsValid())
+            {
+                line_entry = sc.line_entry;
+                return true;
+            }
+        }
+    }
+    line_entry.Clear();
+    return false;
 }
 
 int

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Fri Aug 12 16:40:01 2011
@@ -214,6 +214,12 @@
     sc->module_sp = GetSP();
 }
 
+Module *
+Module::CalculateSymbolContextModule ()
+{
+    return this;
+}
+
 void
 Module::DumpSymbolContext(Stream *s)
 {

Modified: lldb/trunk/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/source/Core/ModuleList.cpp (original)
+++ lldb/trunk/source/Core/ModuleList.cpp Fri Aug 12 16:40:01 2011
@@ -707,6 +707,33 @@
 {
     return GetSharedModuleList ().RemoveOrphans();    
 }
+//#define ENABLE_MODULE_SP_LOGGING
+#if defined (ENABLE_MODULE_SP_LOGGING)
+#include "lldb/Core/StreamFile.h"
+#include "lldb/Host/Host.h"
+static void 
+ModuleSharedPtrLogger(void* p, const ModuleSP& sp, bool will_decrement)
+{
+    if (sp.get())
+    {
+        const char *module_basename = sp->GetFileSpec().GetFilename().GetCString();
+        // If "p" is set, then it is the basename of a module to watch for. This
+        // basename MUST be uniqued first by getting it from a ConstString or this
+        // won't work.
+        if (p && p != module_basename)
+        {
+            return;
+        }
+        long use_count = sp.use_count();
+        if (will_decrement)
+            --use_count;
+
+        printf("\nModuleSP(%p): %c %p {%lu} %s/%s\n", &sp, will_decrement ? '-' : '+', sp.get(), use_count, sp->GetFileSpec().GetDirectory().GetCString(), module_basename);
+        StreamFile stdout_strm(stdout, false);
+        Host::Backtrace (stdout_strm, 512);
+    }
+}
+#endif
 
 Error
 ModuleList::GetSharedModule
@@ -783,7 +810,12 @@
             return error;
         else
         {
+#if defined ENABLE_MODULE_SP_LOGGING
+            ModuleSP logging_module_sp (new Module (in_file_spec, arch, object_name_ptr, object_offset), ModuleSharedPtrLogger, (void *)ConstString("a.out").GetCString());
+            module_sp = logging_module_sp;
+#else
             module_sp.reset (new Module (in_file_spec, arch, object_name_ptr, object_offset));
+#endif
             // Make sure there are a module and an object file since we can specify
             // a valid file path with an architecture that might not be in that file.
             // By getting the object file we can guarantee that the architecture matches
@@ -874,7 +906,12 @@
 
         if (module_sp.get() == NULL)
         {
+#if defined ENABLE_MODULE_SP_LOGGING
+            ModuleSP logging_module_sp (new Module (file_spec, arch, object_name_ptr, object_offset), ModuleSharedPtrLogger, 0);
+            module_sp = logging_module_sp;
+#else
             module_sp.reset (new Module (file_spec, arch, object_name_ptr, object_offset));
+#endif
             // Make sure there are a module and an object file since we can specify
             // a valid file path with an architecture that might not be in that file.
             // By getting the object file we can guarantee that the architecture matches

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Fri Aug 12 16:40:01 2011
@@ -3260,31 +3260,35 @@
 bool
 ValueObject::EvaluationPoint::SyncWithProcessState()
 {
-    // If we're already invalid, we don't need to do anything, and nothing has changed:
-    if (!m_mod_id.IsValid())
-    {
-        // Can't update with an invalid state.
-        m_needs_update = false;
-        return false;
-    }
-    
     // If we don't have a process nothing can change.
     if (!m_process_sp)
+    {
+        m_exe_scope = m_target_sp.get();
         return false;
+    }
         
     // If our stop id is the current stop ID, nothing has changed:
     ProcessModID current_mod_id = m_process_sp->GetModID();
     
-    if (m_mod_id == current_mod_id)
-        return false;
-    
     // If the current stop id is 0, either we haven't run yet, or the process state has been cleared.
     // In either case, we aren't going to be able to sync with the process state.
     if (current_mod_id.GetStopID() == 0)
+    {
+        m_exe_scope = m_target_sp.get();
         return false;
+    }
         
-    m_mod_id = current_mod_id;
-    m_needs_update = true;
+    if (m_mod_id.IsValid())
+    {
+        if (m_mod_id == current_mod_id)
+        {
+            // Everything is already up to date in this object, no need do 
+            // update the execution context scope.
+            return false;
+        }
+        m_mod_id = current_mod_id;
+        m_needs_update = true;        
+    }
     m_exe_scope = m_process_sp.get();
     
     // Something has changed, so we will return true.  Now make sure the thread & frame still exist, and if either
@@ -3317,12 +3321,10 @@
 void
 ValueObject::EvaluationPoint::SetUpdated ()
 {
+    // this will update the execution context scope and the m_mod_id
+    SyncWithProcessState();
     m_first_update = false;
     m_needs_update = false;
-    if (m_process_sp)
-    {
-        m_mod_id = m_process_sp->GetModID();
-    }
 }
         
 

Modified: lldb/trunk/source/Expression/ClangFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangFunction.cpp Fri Aug 12 16:40:01 2011
@@ -386,11 +386,9 @@
 {
     // FIXME: Use the errors Stream for better error reporting.
 
-    Process *process = exe_ctx.process;
-
-    if (process == NULL)
+    if (exe_ctx.thread == NULL)
     {
-        errors.Printf("Can't call a function without a process.");
+        errors.Printf("Can't call a function without a valid thread.");
         return NULL;
     }
 

Modified: lldb/trunk/source/Symbol/Block.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Block.cpp?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Block.cpp (original)
+++ lldb/trunk/source/Symbol/Block.cpp Fri Aug 12 16:40:01 2011
@@ -152,6 +152,36 @@
     sc->block = this;
 }
 
+Module *
+Block::CalculateSymbolContextModule ()
+{
+    if (m_parent_scope)
+        return m_parent_scope->CalculateSymbolContextModule ();
+    return NULL;
+}
+
+CompileUnit *
+Block::CalculateSymbolContextCompileUnit ()
+{
+    if (m_parent_scope)
+        return m_parent_scope->CalculateSymbolContextCompileUnit ();
+    return NULL;
+}
+
+Function *
+Block::CalculateSymbolContextFunction ()
+{
+    if (m_parent_scope)
+        return m_parent_scope->CalculateSymbolContextFunction ();
+    return NULL;
+}
+
+Block *
+Block::CalculateSymbolContextBlock ()
+{
+    return this;
+}
+
 void
 Block::DumpStopContext 
 (
@@ -225,12 +255,11 @@
         }
         else if (child_inline_call_site)
         {
-            SymbolContext sc;
-            CalculateSymbolContext(&sc);
-            if (sc.function)
+            Function *function = CalculateSymbolContextFunction();
+            if (function)
             {
                 s->EOL();
-                s->Indent (sc.function->GetMangled().GetName().AsCString());
+                s->Indent (function->GetMangled().GetName().AsCString());
                 if (child_inline_call_site && child_inline_call_site->IsValid())
                 {
                     s->PutCString(" at ");
@@ -245,10 +274,9 @@
 void
 Block::DumpSymbolContext(Stream *s)
 {
-    SymbolContext sc;
-    CalculateSymbolContext(&sc);
-    if (sc.function)
-        sc.function->DumpSymbolContext(s);
+    Function *function = CalculateSymbolContextFunction();
+    if (function)
+        function->DumpSymbolContext(s);
     s->Printf(", Block{0x%8.8x}", GetID());
 }
 
@@ -297,12 +325,7 @@
 Block::GetParent () const
 {
     if (m_parent_scope)
-    {
-        SymbolContext sc;
-        m_parent_scope->CalculateSymbolContext(&sc);
-        if (sc.block)
-            return sc.block;
-    }
+        return m_parent_scope->CalculateSymbolContextBlock();
     return NULL;
 }
 
@@ -346,11 +369,10 @@
 bool
 Block::GetRangeContainingAddress (const Address& addr, AddressRange &range)
 {
-    SymbolContext sc;
-    CalculateSymbolContext(&sc);
-    if (sc.function)
+    Function *function = CalculateSymbolContextFunction();
+    if (function)
     {
-        const AddressRange &func_range = sc.function->GetAddressRange();
+        const AddressRange &func_range = function->GetAddressRange();
         if (addr.GetSection() == func_range.GetBaseAddress().GetSection())
         {
             const addr_t addr_offset = addr.GetOffset();
@@ -379,11 +401,10 @@
 {
     if (range_idx < m_ranges.size())
     {
-        SymbolContext sc;
-        CalculateSymbolContext(&sc);
-        if (sc.function)
+        Function *function = CalculateSymbolContextFunction();
+        if (function)
         {
-            range.GetBaseAddress() = sc.function->GetAddressRange().GetBaseAddress();
+            range.GetBaseAddress() = function->GetAddressRange().GetBaseAddress();
             range.GetBaseAddress().Slide(m_ranges[range_idx].GetBaseAddress ());
             range.SetByteSize (m_ranges[range_idx].GetByteSize());
             return true;
@@ -398,11 +419,10 @@
     if (m_ranges.empty())
         return false;
 
-    SymbolContext sc;
-    CalculateSymbolContext(&sc);
-    if (sc.function)
+    Function *function = CalculateSymbolContextFunction();
+    if (function)
     {
-        addr = sc.function->GetAddressRange().GetBaseAddress();
+        addr = function->GetAddressRange().GetBaseAddress();
         addr.Slide(m_ranges.front().GetBaseAddress ());
         return true;
     }

Modified: lldb/trunk/source/Symbol/CompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompileUnit.cpp?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompileUnit.cpp (original)
+++ lldb/trunk/source/Symbol/CompileUnit.cpp Fri Aug 12 16:40:01 2011
@@ -57,6 +57,18 @@
     GetModule()->CalculateSymbolContext(sc);
 }
 
+Module *
+CompileUnit::CalculateSymbolContextModule ()
+{
+    return GetModule();
+}
+
+CompileUnit *
+CompileUnit::CalculateSymbolContextCompileUnit ()
+{
+    return this;
+}
+
 void
 CompileUnit::DumpSymbolContext(Stream *s)
 {

Modified: lldb/trunk/source/Symbol/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Function.cpp?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Function.cpp (original)
+++ lldb/trunk/source/Symbol/Function.cpp Fri Aug 12 16:40:01 2011
@@ -386,6 +386,31 @@
     m_comp_unit->CalculateSymbolContext(sc);
 }
 
+Module *
+Function::CalculateSymbolContextModule ()
+{
+    return this->GetCompileUnit()->GetModule();
+}
+
+CompileUnit *
+Function::CalculateSymbolContextCompileUnit ()
+{
+    return this->GetCompileUnit();
+}
+
+Function *
+Function::CalculateSymbolContextFunction ()
+{
+    return this;
+}
+
+//Symbol *
+//Function::CalculateSymbolContextSymbol ()
+//{
+//    return // TODO: find the symbol for the function???
+//}
+
+
 void
 Function::DumpSymbolContext(Stream *s)
 {

Modified: lldb/trunk/source/Symbol/Symbol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symbol.cpp?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Symbol.cpp (original)
+++ lldb/trunk/source/Symbol/Symbol.cpp Fri Aug 12 16:40:01 2011
@@ -366,6 +366,22 @@
     sc->module_sp.reset();
 }
 
+Module *
+Symbol::CalculateSymbolContextModule ()
+{
+    const AddressRange *range = GetAddressRangePtr();
+    if (range)
+        return range->GetBaseAddress().GetModule ();
+    return NULL;
+}
+
+Symbol *
+Symbol::CalculateSymbolContextSymbol ()
+{
+    return this;
+}
+
+
 void
 Symbol::DumpSymbolContext (Stream *s)
 {

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Fri Aug 12 16:40:01 2011
@@ -51,7 +51,8 @@
     m_state_mutex (Mutex::eMutexTypeRecursive),
     m_plan_stack (),
     m_completed_plan_stack(),
-    m_curr_frames_ap (),
+    m_curr_frames_sp (),
+    m_prev_frames_sp (),
     m_resume_signal (LLDB_INVALID_SIGNAL_NUMBER),
     m_resume_state (eStateRunning),
     m_unwinder_ap (),
@@ -916,9 +917,9 @@
 StackFrameList &
 Thread::GetStackFrameList ()
 {
-    if (m_curr_frames_ap.get() == NULL)
-        m_curr_frames_ap.reset (new StackFrameList (*this, m_prev_frames_sp, true));
-    return *m_curr_frames_ap;
+    if (!m_curr_frames_sp)
+        m_curr_frames_sp.reset (new StackFrameList (*this, m_prev_frames_sp, true));
+    return *m_curr_frames_sp;
 }
 
 
@@ -933,13 +934,9 @@
 void
 Thread::ClearStackFrames ()
 {
-    if (m_curr_frames_ap.get() && m_curr_frames_ap->GetNumFrames (false) > 1)
-        m_prev_frames_sp.reset (m_curr_frames_ap.release());
-    else
-        m_curr_frames_ap.release();
-
-//    StackFrameList::Merge (m_curr_frames_ap, m_prev_frames_sp);
-//    assert (m_curr_frames_ap.get() == NULL);
+    if (m_curr_frames_sp && m_curr_frames_sp->GetNumFrames (false) > 1)
+        m_prev_frames_sp.swap (m_curr_frames_sp);
+    m_curr_frames_sp.reset();
 }
 
 lldb::StackFrameSP

Modified: lldb/trunk/source/Target/ThreadPlanTracer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanTracer.cpp?rev=137516&r1=137515&r2=137516&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanTracer.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanTracer.cpp Fri Aug 12 16:40:01 2011
@@ -91,45 +91,47 @@
 
 ThreadPlanAssemblyTracer::ThreadPlanAssemblyTracer (Thread &thread, lldb::StreamSP &stream_sp) :
     ThreadPlanTracer (thread, stream_sp),
-    m_process(thread.GetProcess()),
-    m_target(thread.GetProcess().GetTarget())
+    m_disassembler_ap (),
+    m_intptr_type (),
+    m_register_values ()
 {
-    InitializeTracer ();
 }
 
 ThreadPlanAssemblyTracer::ThreadPlanAssemblyTracer (Thread &thread) :
     ThreadPlanTracer (thread),
-    m_process(thread.GetProcess()),
-    m_target(thread.GetProcess().GetTarget())
+    m_disassembler_ap (),
+    m_intptr_type (),
+    m_register_values ()
 {
-    InitializeTracer ();
 }
 
-void
-ThreadPlanAssemblyTracer::InitializeTracer()
+Disassembler *
+ThreadPlanAssemblyTracer::GetDisassembler ()
 {
-    Process &process = m_thread.GetProcess();
-    Target &target = process.GetTarget();
-    
-    ArchSpec arch(target.GetArchitecture());
-    
-    m_disassembler = Disassembler::FindPlugin(arch, NULL);
-    
-    m_abi = process.GetABI().get();
-    
-    Module *exe_module = target.GetExecutableModulePointer();
-    
-    if (exe_module)
+    if (m_disassembler_ap.get() == NULL)
+        m_disassembler_ap.reset(Disassembler::FindPlugin(m_thread.GetProcess().GetTarget().GetArchitecture(), NULL));
+    return m_disassembler_ap.get();
+}
+
+TypeFromUser
+ThreadPlanAssemblyTracer::GetIntPointerType()
+{
+    if (!m_intptr_type.IsValid ())
     {
-        m_intptr_type = TypeFromUser(exe_module->GetClangASTContext().GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, arch.GetAddressByteSize() * 8),
-                                     exe_module->GetClangASTContext().getASTContext());
+        Target &target = m_thread.GetProcess().GetTarget();
+        Module *exe_module = target.GetExecutableModulePointer();
+        
+        if (exe_module)
+        {
+            m_intptr_type = TypeFromUser(exe_module->GetClangASTContext().GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, m_thread.GetProcess().GetAddressByteSize() * 8),
+                                         exe_module->GetClangASTContext().getASTContext());
+        }        
     }
-    
-    const unsigned int buf_size = 32;
-    
-    m_buffer_sp.reset(new DataBufferHeap(buf_size, 0));
+    return m_intptr_type;
 }
 
+
+
 ThreadPlanAssemblyTracer::~ThreadPlanAssemblyTracer()
 {
 }
@@ -171,33 +173,33 @@
     RegisterContext *reg_ctx = m_thread.GetRegisterContext().get();
     
     lldb::addr_t pc = reg_ctx->GetPC();
+    Process &process = m_thread.GetProcess();
     Address pc_addr;
     bool addr_valid = false;
-
-    addr_valid = m_process.GetTarget().GetSectionLoadList().ResolveLoadAddress (pc, pc_addr);
+    uint8_t buffer[16] = {0}; // Must be big enough for any single instruction
+    addr_valid = process.GetTarget().GetSectionLoadList().ResolveLoadAddress (pc, pc_addr);
     
     pc_addr.Dump(stream, &m_thread, Address::DumpStyleResolvedDescription, Address::DumpStyleModuleWithFileAddress);
     stream->PutCString (" ");
     
-    if (m_disassembler)
+    Disassembler *disassembler = GetDisassembler();
+    if (disassembler)
     {        
-        ::memset(m_buffer_sp->GetBytes(), 0, m_buffer_sp->GetByteSize());
-        
         Error err;
-        m_process.ReadMemory(pc, m_buffer_sp->GetBytes(), m_buffer_sp->GetByteSize(), err);
+        process.ReadMemory(pc, buffer, sizeof(buffer), err);
         
         if (err.Success())
         {
-            DataExtractor extractor(m_buffer_sp,
-                                    m_process.GetByteOrder(),
-                                    m_process.GetAddressByteSize());
+            DataExtractor extractor(buffer, sizeof(buffer), 
+                                    process.GetByteOrder(), 
+                                    process.GetAddressByteSize());
             
             if (addr_valid)
-                m_disassembler->DecodeInstructions (pc_addr, extractor, 0, 1, false);
+                disassembler->DecodeInstructions (pc_addr, extractor, 0, 1, false);
             else
-                m_disassembler->DecodeInstructions (Address (NULL, pc), extractor, 0, 1, false);
+                disassembler->DecodeInstructions (Address (NULL, pc), extractor, 0, 1, false);
             
-            InstructionList &instruction_list = m_disassembler->GetInstructionList();
+            InstructionList &instruction_list = disassembler->GetInstructionList();
             const uint32_t max_opcode_byte_size = instruction_list.GetMaxOpcocdeByteSize();
 
             if (instruction_list.GetSize())
@@ -215,7 +217,10 @@
         }
     }
     
-    if (m_abi && m_intptr_type.GetOpaqueQualType())
+    const ABI *abi = process.GetABI().get();
+    TypeFromUser intptr_type = GetIntPointerType();
+    
+    if (abi && intptr_type.IsValid())
     {
         ValueList value_list;
         const int num_args = 1;
@@ -224,11 +229,11 @@
         {
             Value value;
             value.SetValueType (Value::eValueTypeScalar);
-            value.SetContext (Value::eContextTypeClangType, m_intptr_type.GetOpaqueQualType());
+            value.SetContext (Value::eContextTypeClangType, intptr_type.GetOpaqueQualType());
             value_list.PushValue (value);
         }
         
-        if (m_abi->GetArgumentValues (m_thread, value_list))
+        if (abi->GetArgumentValues (m_thread, value_list))
         {                
             for (int arg_index = 0; arg_index < num_args; ++arg_index)
             {





More information about the lldb-commits mailing list