[Lldb-commits] [lldb] r154355 - in /lldb/branches/lldb-platform-work: ./ include/lldb/Core/ include/lldb/Symbol/ include/lldb/Target/ lldb.xcodeproj/ lldb.xcodeproj/xcshareddata/xcschemes/ source/API/ source/Commands/ source/Core/ source/Plugins/Process/gdb-remote/ source/Plugins/SymbolFile/DWARF/ source/Symbol/ source/Target/

Johnny Chen johnny.chen at apple.com
Mon Apr 9 16:16:33 PDT 2012


Author: johnny
Date: Mon Apr  9 18:16:33 2012
New Revision: 154355

URL: http://llvm.org/viewvc/llvm-project?rev=154355&view=rev
Log:
Merge changes from ToT:

svn merge -r 154255:154354 https://johnny@llvm.org/svn/llvm-project/lldb/trunk .

Modified:
    lldb/branches/lldb-platform-work/   (props changed)
    lldb/branches/lldb-platform-work/include/lldb/Core/ModuleList.h
    lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h
    lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangNamespaceDecl.h
    lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h
    lldb/branches/lldb-platform-work/include/lldb/Target/Thread.h
    lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlan.h
    lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanBase.h
    lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanCallFunction.h
    lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepOverRange.h
    lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepUntil.h
    lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj
    lldb/branches/lldb-platform-work/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
    lldb/branches/lldb-platform-work/source/API/SBDebugger.cpp
    lldb/branches/lldb-platform-work/source/Commands/CommandObjectPlatform.cpp
    lldb/branches/lldb-platform-work/source/Commands/CommandObjectTarget.cpp
    lldb/branches/lldb-platform-work/source/Core/Module.cpp
    lldb/branches/lldb-platform-work/source/Core/ModuleList.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
    lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/branches/lldb-platform-work/source/Symbol/ClangNamespaceDecl.cpp
    lldb/branches/lldb-platform-work/source/Target/Platform.cpp
    lldb/branches/lldb-platform-work/source/Target/Thread.cpp
    lldb/branches/lldb-platform-work/source/Target/ThreadPlan.cpp
    lldb/branches/lldb-platform-work/source/Target/ThreadPlanBase.cpp
    lldb/branches/lldb-platform-work/source/Target/ThreadPlanCallFunction.cpp
    lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepOverRange.cpp
    lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepUntil.cpp

Propchange: lldb/branches/lldb-platform-work/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Apr  9 18:16:33 2012
@@ -1 +1 @@
-/lldb/trunk:154224-154255
+/lldb/trunk:154224-154354

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/ModuleList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/ModuleList.h?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/ModuleList.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/ModuleList.h Mon Apr  9 18:16:33 2012
@@ -356,7 +356,7 @@
     Remove (ModuleList &module_list);
     
     size_t
-    RemoveOrphans ();
+    RemoveOrphans (bool mandatory);
 
     bool
     ResolveFileAddress (lldb::addr_t vm_addr,
@@ -418,7 +418,7 @@
                        ModuleList &matching_module_list);
 
     static uint32_t
-    RemoveOrphanSharedModules ();
+    RemoveOrphanSharedModules (bool mandatory);
 
 protected:
     //------------------------------------------------------------------

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h Mon Apr  9 18:16:33 2012
@@ -28,7 +28,6 @@
 #include "lldb/Target/ExecutionContextScope.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/StackID.h"
-#include "lldb/Utility/PriorityPointerPair.h"
 #include "lldb/Utility/SharedCluster.h"
 
 namespace lldb_private {

Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangNamespaceDecl.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangNamespaceDecl.h?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangNamespaceDecl.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangNamespaceDecl.h Mon Apr  9 18:16:33 2012
@@ -89,6 +89,9 @@
         m_namespace_decl = namespace_decl;
     }
 
+    std::string
+    GetQualifiedName () const;
+
 protected:
     clang::ASTContext  *m_ast;
     clang::NamespaceDecl *m_namespace_decl;

Modified: lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h Mon Apr  9 18:16:33 2012
@@ -499,9 +499,7 @@
                 
         virtual Error
         GetFile (const FileSpec& source,
-                 const FileSpec& destination,
-                 uint32_t uid = UINT32_MAX,
-                 uint32_t gid = UINT32_MAX);
+                 const FileSpec& destination);
                 
     protected:
         bool m_is_host;

Modified: lldb/branches/lldb-platform-work/include/lldb/Target/Thread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/Thread.h?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/Thread.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/Thread.h Mon Apr  9 18:16:33 2012
@@ -587,12 +587,8 @@
 
 private:
     bool
-    PlanIsBasePlan (ThreadPlan *plan_ptr)
-    {
-        if (m_plan_stack.size() == 0)
-            return false;
-        return m_plan_stack[0].get() == plan_ptr;
-    }
+    PlanIsBasePlan (ThreadPlan *plan_ptr);
+    
 public:
 
     //------------------------------------------------------------------

Modified: lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlan.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlan.h?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlan.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlan.h Mon Apr  9 18:16:33 2012
@@ -334,10 +334,18 @@
     virtual bool
     WillStop () = 0;
 
-    virtual bool
+    bool
     IsMasterPlan()
     {
-        return false;
+        return m_is_master_plan;
+    }
+    
+    bool
+    SetIsMasterPlan (bool value)
+    {
+        bool old_value = m_is_master_plan;
+        m_is_master_plan = value;
+        return old_value;
     }
 
     virtual bool
@@ -390,6 +398,12 @@
     void
     SetPlanComplete ();
     
+    virtual bool
+    IsBasePlan()
+    {
+        return false;
+    }
+    
     lldb::ThreadPlanTracerSP &
     GetThreadPlanTracer()
     {
@@ -474,6 +488,7 @@
     bool m_plan_complete;
     bool m_plan_private;
     bool m_okay_to_discard;
+    bool m_is_master_plan;
     
     lldb::ThreadPlanTracerSP m_tracer_sp;
 

Modified: lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanBase.h?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanBase.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanBase.h Mon Apr  9 18:16:33 2012
@@ -14,6 +14,7 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
+#include "lldb/Target/Process.h"
 #include "lldb/Target/Thread.h"
 #include "lldb/Target/ThreadPlan.h"
 
@@ -28,6 +29,7 @@
 
 class ThreadPlanBase : public ThreadPlan
 {
+friend class Process;  // RunThreadPlan manages "stopper" base plans.
 public:
     virtual ~ThreadPlanBase ();
 
@@ -41,16 +43,17 @@
     virtual bool MischiefManaged ();
     virtual bool WillResume (lldb::StateType resume_state, bool current_plan);
 
-    virtual bool IsMasterPlan()
-    {
-        return true;
-    }
-
     virtual bool OkayToDiscard()
     {
         return false;
     }
 
+    virtual bool
+    IsBasePlan()
+    {
+        return true;
+    }
+    
 protected:
     ThreadPlanBase (Thread &thread);
 

Modified: lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanCallFunction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanCallFunction.h?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanCallFunction.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanCallFunction.h Mon Apr  9 18:16:33 2012
@@ -80,12 +80,6 @@
     virtual bool
     MischiefManaged ();
 
-    virtual bool
-    IsMasterPlan()
-    {
-        return true;
-    }
-
     // To get the return value from a function call you must create a 
     // lldb::ValueSP that contains a valid clang type in its context and call
     // RequestReturnValue. The ValueSP will be stored and when the function is

Modified: lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepOverRange.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepOverRange.h?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepOverRange.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepOverRange.h Mon Apr  9 18:16:33 2012
@@ -35,11 +35,6 @@
 
     virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
     virtual bool ShouldStop (Event *event_ptr);
-    virtual bool
-    IsMasterPlan()
-    {
-        return true;
-    }
 
 protected:
 

Modified: lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepUntil.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepUntil.h?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepUntil.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepUntil.h Mon Apr  9 18:16:33 2012
@@ -35,12 +35,6 @@
     virtual bool WillStop ();
     virtual bool MischiefManaged ();
 
-    virtual bool
-    IsMasterPlan()
-    {
-        return true;
-    }
-
 protected:
     ThreadPlanStepUntil (Thread &thread,
                          lldb::addr_t *address_list,

Modified: lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj Mon Apr  9 18:16:33 2012
@@ -2181,22 +2181,22 @@
 			isa = PBXGroup;
 			children = (
 				26CF992414428766001E4138 /* AnsiTerminal.h */,
+				26F996A7119B79C300412154 /* ARM_DWARF_Registers.h */,
+				26ECA04213665FED008D1F18 /* ARM_DWARF_Registers.cpp */,
+				26F996A8119B79C300412154 /* ARM_GCC_Registers.h */,
 				264723A511FA076E00DE380C /* CleanUp.h */,
+				94031A9F13CF5B3D00DCFF3C /* PriorityPointerPair.h */,
+				2682F16B115EDA0D00CCFF99 /* PseudoTerminal.h */,
+				2682F16A115EDA0D00CCFF99 /* PseudoTerminal.cpp */,
 				94611EAF13CCA363003A22AF /* RefCounter.h */,
 				94611EB113CCA4A4003A22AF /* RefCounter.cpp */,
 				261B5A5211C3F2AD00AABD0A /* SharingPtr.cpp */,
 				4C2FAE2E135E3A70001EDE44 /* SharedCluster.h */,
 				261B5A5311C3F2AD00AABD0A /* SharingPtr.h */,
-				26F996A7119B79C300412154 /* ARM_DWARF_Registers.h */,
-				26ECA04213665FED008D1F18 /* ARM_DWARF_Registers.cpp */,
-				26F996A8119B79C300412154 /* ARM_GCC_Registers.h */,
 				2660D9F711922A1300958FBD /* StringExtractor.h */,
 				2660D9F611922A1300958FBD /* StringExtractor.cpp */,
 				2676A094119C93C8008A98EF /* StringExtractorGDBRemote.h */,
 				2676A093119C93C8008A98EF /* StringExtractorGDBRemote.cpp */,
-				2682F16B115EDA0D00CCFF99 /* PseudoTerminal.h */,
-				2682F16A115EDA0D00CCFF99 /* PseudoTerminal.cpp */,
-				94031A9F13CF5B3D00DCFF3C /* PriorityPointerPair.h */,
 				94EBAC8313D9EE26009BA64E /* PythonPointer.h */,
 				B2462249141AE62200F3D409 /* Utils.h */,
 			);

Modified: lldb/branches/lldb-platform-work/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme (original)
+++ lldb/branches/lldb-platform-work/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme Mon Apr  9 18:16:33 2012
@@ -84,7 +84,7 @@
    <LaunchAction
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      launchStyle = "1"
+      launchStyle = "0"
       useCustomWorkingDirectory = "NO"
       customWorkingDirectory = "/Volumes/work/gclayton/Documents/devb/attach"
       buildConfiguration = "Debug"

Modified: lldb/branches/lldb-platform-work/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/SBDebugger.cpp?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/SBDebugger.cpp (original)
+++ lldb/branches/lldb-platform-work/source/API/SBDebugger.cpp Mon Apr  9 18:16:33 2012
@@ -143,7 +143,12 @@
 void
 SBDebugger::MemoryPressureDetected ()
 {
-    ModuleList::RemoveOrphanSharedModules();    
+    // Since this function can be call asynchronously, we allow it to be
+    // non-mandatory. We have seen deadlocks with this function when called
+    // so we need to safeguard against this until we can determine what is
+    // causing the deadlocks.
+    const bool mandatory = false;
+    ModuleList::RemoveOrphanSharedModules(mandatory);
 }
 
 SBDebugger::SBDebugger () :
@@ -648,7 +653,8 @@
             result = m_opaque_sp->GetTargetList().DeleteTarget (target_sp);
             target_sp->Destroy();
             target.Clear();
-            ModuleList::RemoveOrphanSharedModules();
+            const bool mandatory = true;
+            ModuleList::RemoveOrphanSharedModules(mandatory);
         }
     }
 

Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectPlatform.cpp?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectPlatform.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectPlatform.cpp Mon Apr  9 18:16:33 2012
@@ -632,6 +632,57 @@
 };
 
 //----------------------------------------------------------------------
+// "platform get-file remote-file-path host-file-path"
+//----------------------------------------------------------------------
+class CommandObjectPlatformGetFile : public CommandObject
+{
+public:
+    CommandObjectPlatformGetFile (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "platform get-file",
+                   "Get a file from the remote platform into the host platform.",
+                   NULL,
+                   0)
+    {
+    }
+    
+    virtual
+    ~CommandObjectPlatformGetFile ()
+    {
+    }
+    
+    virtual bool
+    Execute (Args& args, CommandReturnObject &result)
+    {
+        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+        if (platform_sp)
+        {
+            std::string remote_file_path(args.GetArgumentAtIndex(0));
+            std::string host_file_path(args.GetArgumentAtIndex(1));
+            Error error = platform_sp->GetFile(FileSpec(remote_file_path.c_str(), false),
+                                               FileSpec(host_file_path.c_str(), false));
+            if (error.Success())
+            {
+                result.AppendMessageWithFormat("Successfully uploaded file from %s (remote) to %s (host)\n",
+                                               remote_file_path.c_str(), host_file_path.c_str());
+                result.SetStatus (eReturnStatusSuccessFinishResult);
+            }
+            else
+            {
+                result.AppendMessageWithFormat("Uploading failed: %s\n", error.AsCString());
+                result.SetStatus (eReturnStatusFailed);
+            }
+        }
+        else
+        {
+            result.AppendError ("no platform currently selected\n");
+            result.SetStatus (eReturnStatusFailed);
+        }
+        return result.Succeeded();
+    }
+};
+
+//----------------------------------------------------------------------
 // "platform put-file"
 //----------------------------------------------------------------------
 class CommandObjectPlatformPutFile : public CommandObject
@@ -1349,6 +1400,7 @@
     LoadSubCommand ("fclose", CommandObjectSP (new CommandObjectPlatformFClose  (interpreter)));
     LoadSubCommand ("fread", CommandObjectSP (new CommandObjectPlatformFRead  (interpreter)));
     LoadSubCommand ("fwrite", CommandObjectSP (new CommandObjectPlatformFWrite  (interpreter)));
+    LoadSubCommand ("get-file", CommandObjectSP (new CommandObjectPlatformGetFile  (interpreter)));
     LoadSubCommand ("put-file", CommandObjectSP (new CommandObjectPlatformPutFile  (interpreter)));
 #endif
 }

Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectTarget.cpp?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectTarget.cpp Mon Apr  9 18:16:33 2012
@@ -520,7 +520,8 @@
             // the global shared module list
             if (m_cleanup_option.GetOptionValue ())
             {
-                ModuleList::RemoveOrphanSharedModules();
+                const bool mandatory = true;
+                ModuleList::RemoveOrphanSharedModules(mandatory);
             }
             result.GetOutputStream().Printf("%u targets deleted.\n", (uint32_t)num_targets_to_delete);
             result.SetStatus(eReturnStatusSuccessFinishResult);

Modified: lldb/branches/lldb-platform-work/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/Module.cpp?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/Module.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/Module.cpp Mon Apr  9 18:16:33 2012
@@ -86,7 +86,8 @@
     void
     ClearModuleInfo (void)
     {
-        ModuleList::RemoveOrphanSharedModules();
+        const bool mandatory = true;
+        ModuleList::RemoveOrphanSharedModules(mandatory);
     }
     
     void

Modified: lldb/branches/lldb-platform-work/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/ModuleList.cpp?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/ModuleList.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/ModuleList.cpp Mon Apr  9 18:16:33 2012
@@ -112,9 +112,20 @@
 
 
 size_t
-ModuleList::RemoveOrphans ()
+ModuleList::RemoveOrphans (bool mandatory)
 {
-    Mutex::Locker locker(m_modules_mutex);
+    Mutex::Locker locker;
+    
+    if (mandatory)
+    {
+        locker.Reset (m_modules_mutex.GetMutex());
+    }
+    else
+    {
+        // Not mandatory, remove orphans if we can get the mutex
+        if (!locker.TryLock(m_modules_mutex.GetMutex()))
+            return 0;
+    }
     collection::iterator pos = m_modules.begin();
     size_t remove_count = 0;
     while (pos != m_modules.end())
@@ -587,9 +598,9 @@
 }
 
 uint32_t
-ModuleList::RemoveOrphanSharedModules ()
+ModuleList::RemoveOrphanSharedModules (bool mandatory)
 {
-    return GetSharedModuleList ().RemoveOrphans();    
+    return GetSharedModuleList ().RemoveOrphans(mandatory);
 }
 
 Error

Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Mon Apr  9 18:16:33 2012
@@ -17,6 +17,7 @@
 // C++ Includes
 // Other libraries and framework includes
 #include "lldb/Core/Log.h"
+#include "lldb/Core/StreamFile.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Host/Host.h"
@@ -31,6 +32,63 @@
 using namespace lldb;
 using namespace lldb_private;
 
+GDBRemoteCommunication::History::History (uint32_t size) :
+    m_packets(),
+    m_curr_idx (0),
+    m_total_packet_count (0),
+    m_dumped_to_log (false)
+{
+    m_packets.resize(size);
+}
+
+GDBRemoteCommunication::History::~History ()
+{
+}
+
+void
+GDBRemoteCommunication::History::Dump (lldb_private::Stream &strm) const
+{
+    const uint32_t size = GetNumPacketsInHistory ();
+    const uint32_t first_idx = GetFirstSavedPacketIndex ();
+    const uint32_t stop_idx = m_curr_idx + size;
+    for (uint32_t i = first_idx;  i < stop_idx; ++i)
+    {
+        const uint32_t idx = NormalizeIndex (i);
+        const Entry &entry = m_packets[idx];
+        if (entry.type == ePacketTypeInvalid || entry.packet.empty())
+            break;
+        strm.Printf ("history[%u] <%4u> %s packet: %s\n",
+                     entry.packet_idx,
+                     entry.bytes_transmitted,
+                     (entry.type == ePacketTypeSend) ? "send" : "read",
+                     entry.packet.c_str());
+    }
+}
+
+void
+GDBRemoteCommunication::History::Dump (lldb_private::Log *log) const
+{
+    if (log && !m_dumped_to_log)
+    {
+        m_dumped_to_log = true;
+        const uint32_t size = GetNumPacketsInHistory ();
+        const uint32_t first_idx = GetFirstSavedPacketIndex ();
+        const uint32_t stop_idx = m_curr_idx + size;
+        for (uint32_t i = first_idx;  i < stop_idx; ++i)
+        {
+            const uint32_t idx = NormalizeIndex (i);
+            const Entry &entry = m_packets[idx];
+            if (entry.type == ePacketTypeInvalid || entry.packet.empty())
+                break;
+            log->Printf ("history[%u] <%4u> %s packet: %s",
+                         entry.packet_idx,
+                         entry.bytes_transmitted,
+                         (entry.type == ePacketTypeSend) ? "send" : "read",
+                         entry.packet.c_str());
+        }
+    }
+}
+
 //----------------------------------------------------------------------
 // GDBRemoteCommunication constructor
 //----------------------------------------------------------------------
@@ -46,6 +104,7 @@
     m_sequence_mutex (Mutex::eMutexTypeRecursive),
     m_public_is_running (false),
     m_private_is_running (false),
+    m_history (512),
     m_send_acks (true),
     m_is_platform (is_platform)
 {
@@ -80,22 +139,26 @@
 GDBRemoteCommunication::SendAck ()
 {
     LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS));
-    if (log)
-        log->Printf ("send packet: +");
     ConnectionStatus status = eConnectionStatusSuccess;
-    char ack_char = '+';
-    return Write (&ack_char, 1, status, NULL);
+    char ch = '+';
+    const size_t bytes_written = Write (&ch, 1, status, NULL);
+    if (log)
+        log->Printf ("<%4zu> send packet: %c", bytes_written, ch);
+    m_history.AddPacket (ch, History::ePacketTypeSend, bytes_written);
+    return bytes_written;
 }
 
 size_t
 GDBRemoteCommunication::SendNack ()
 {
     LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS));
-    if (log)
-        log->Printf ("send packet: -");
     ConnectionStatus status = eConnectionStatusSuccess;
-    char nack_char = '-';
-    return Write (&nack_char, 1, status, NULL);
+    char ch = '-';
+    const size_t bytes_written = Write (&ch, 1, status, NULL);
+    if (log)
+        log->Printf ("<%4zu> send packet: %c", bytes_written, ch);
+    m_history.AddPacket (ch, History::ePacketTypeSend, bytes_written);
+    return bytes_written;
 }
 
 size_t
@@ -133,10 +196,26 @@
         packet.PutHex8(CalculcateChecksum (payload, payload_length));
 
         LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS));
-        if (log)
-            log->Printf ("send packet: %.*s", (int)packet.GetSize(), packet.GetData());
         ConnectionStatus status = eConnectionStatusSuccess;
         size_t bytes_written = Write (packet.GetData(), packet.GetSize(), status, NULL);
+        if (log)
+        {
+            // If logging was just enabled and we have history, then dump out what
+            // we have to the log so we get the historical context. The Dump() call that
+            // logs all of the packet will set a boolean so that we don't dump this more
+            // than once
+            if (!m_history.DidDumpToLog ())
+            {
+                DumpHistory("/tmp/foo.txt");
+                m_history.Dump (log.get());
+            }
+
+            log->Printf ("<%4zu> send packet: %.*s", bytes_written, (int)packet.GetSize(), packet.GetData());
+        }
+
+        m_history.AddPacket (packet.GetString(), packet.GetSize(), History::ePacketTypeSend, bytes_written);
+
+
         if (bytes_written == packet.GetSize())
         {
             if (GetSendAcks ())
@@ -150,7 +229,6 @@
         }
         else
         {
-            LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS));
             if (log)
                 log->Printf ("error: failed to send packet: %.*s", (int)packet.GetSize(), packet.GetData());
         }
@@ -357,7 +435,24 @@
             
             bool success = true;
             std::string &packet_str = packet.GetStringRef();
+            
+            
+            if (log)
+            {
+                // If logging was just enabled and we have history, then dump out what
+                // we have to the log so we get the historical context. The Dump() call that
+                // logs all of the packet will set a boolean so that we don't dump this more
+                // than once
+                if (!m_history.DidDumpToLog ())
+                    m_history.Dump (log.get());
+                
+                log->Printf ("<%4zu> read packet: %.*s", total_length, (int)(total_length), m_bytes.c_str());
+            }
+
+            m_history.AddPacket (m_bytes.c_str(), total_length, History::ePacketTypeRecv, total_length);
+
             packet_str.assign (m_bytes, content_start, content_length);
+            
             if (m_bytes[0] == '$')
             {
                 assert (checksum_idx < m_bytes.size());
@@ -385,11 +480,6 @@
                         else
                             SendAck();
                     }
-                    if (success)
-                    {
-                        if (log)
-                            log->Printf ("read packet: %.*s", (int)(total_length), m_bytes.c_str());
-                    }
                 }
                 else
                 {
@@ -398,6 +488,7 @@
                         log->Printf ("error: invalid checksum in packet: '%s'\n", m_bytes.c_str());
                 }
             }
+            
             m_bytes.erase(0, total_length);
             packet.SetFilePos(0);
             return success;
@@ -535,3 +626,13 @@
     return error;
 }
 
+void
+GDBRemoteCommunication::DumpHistory(const char *path)
+{
+    StreamFile strm;
+    Error error (strm.GetFile().Open(path, File::eOpenOptionWrite | File::eOpenOptionCanCreate));
+    if (error.Success())
+        m_history.Dump (strm);
+    else
+        fprintf (stderr, "error: unable to open '%s' -- %s\n", path, error.AsCString());
+}

Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h Mon Apr  9 18:16:33 2012
@@ -17,7 +17,7 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private.h"
+#include "lldb/lldb-public.h"
 #include "lldb/Core/Communication.h"
 #include "lldb/Core/Listener.h"
 #include "lldb/Host/Mutex.h"
@@ -128,9 +128,136 @@
                              const char *unix_socket_name,
                              lldb_private::ProcessLaunchInfo &launch_info); 
 
+    void
+    DumpHistory(const char *path);
     
 protected:
-    typedef std::list<std::string> packet_collection;
+
+    class History
+    {
+    public:
+        enum PacketType
+        {
+            ePacketTypeInvalid = 0,
+            ePacketTypeSend,
+            ePacketTypeRecv
+        };
+
+        struct Entry
+        {
+            Entry() :
+                packet(),
+                type (ePacketTypeInvalid),
+                bytes_transmitted (0),
+                packet_idx (0)
+            {
+            }
+            
+            void
+            Clear ()
+            {
+                packet.clear();
+                type = ePacketTypeInvalid;
+                bytes_transmitted = 0;
+                packet_idx = 0;
+                
+            }
+            std::string packet;
+            PacketType type;
+            uint32_t bytes_transmitted;
+            uint32_t packet_idx;
+        };
+
+        History (uint32_t size);
+        
+        ~History ();
+
+        // For single char packets for ack, nack and /x03
+        void
+        AddPacket (char packet_char,
+                   PacketType type,
+                   uint32_t bytes_transmitted)
+        {
+            const size_t size = m_packets.size();
+            if (size > 0)
+            {
+                const uint32_t idx = GetNextIndex();
+                m_packets[idx].packet.assign (1, packet_char);
+                m_packets[idx].type = type;
+                m_packets[idx].bytes_transmitted = bytes_transmitted;
+                m_packets[idx].packet_idx = m_total_packet_count;
+            }
+        }
+
+        void
+        AddPacket (const std::string &src,
+                   uint32_t src_len,
+                   PacketType type,
+                   uint32_t bytes_transmitted)
+        {
+            const size_t size = m_packets.size();
+            if (size > 0)
+            {
+                const uint32_t idx = GetNextIndex();
+                m_packets[idx].packet.assign (src, 0, src_len);
+                m_packets[idx].type = type;
+                m_packets[idx].bytes_transmitted = bytes_transmitted;
+                m_packets[idx].packet_idx = m_total_packet_count;
+            }
+        }
+        
+        void
+        Dump (lldb_private::Stream &strm) const;
+
+        void
+        Dump (lldb_private::Log *log) const;
+
+        bool
+        DidDumpToLog () const
+        {
+            return m_dumped_to_log;
+        }
+    
+protected:
+        uint32_t
+        GetFirstSavedPacketIndex () const
+        {
+            if (m_total_packet_count < m_packets.size())
+                return 0;
+            else
+                return m_curr_idx + 1;
+        }
+
+        uint32_t
+        GetNumPacketsInHistory () const
+        {
+            if (m_total_packet_count < m_packets.size())
+                return m_total_packet_count;
+            else
+                return (uint32_t)m_packets.size();
+        }
+
+        uint32_t
+        GetNextIndex()
+        {
+            ++m_total_packet_count;
+            const uint32_t idx = m_curr_idx;
+            m_curr_idx = NormalizeIndex(idx + 1);
+            return idx;
+        }
+
+        uint32_t
+        NormalizeIndex (uint32_t i) const
+        {
+            return i % m_packets.size();
+        }
+
+        
+        std::vector<Entry> m_packets;
+        uint32_t m_curr_idx;
+        uint32_t m_total_packet_count;
+        mutable bool m_dumped_to_log;
+    };
 
     size_t
     SendPacketNoLock (const char *payload, 
@@ -150,6 +277,7 @@
     lldb_private::Mutex m_sequence_mutex;    // Restrict access to sending/receiving packets to a single thread at a time
     lldb_private::Predicate<bool> m_public_is_running;
     lldb_private::Predicate<bool> m_private_is_running;
+    History m_history;
     bool m_send_acks;
     bool m_is_platform; // Set to true if this class represents a platform,
                         // false if this class represents a debug session for

Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Mon Apr  9 18:16:33 2012
@@ -53,6 +53,20 @@
 #include "ThreadGDBRemote.h"
 #include "StopInfoMachException.h"
 
+namespace lldb
+{
+    // Provide a function that can easily dump the packet history if we know a
+    // ProcessGDBRemote * value (which we can get from logs or from debugging).
+    // We need the function in the lldb namespace so it makes it into the final
+    // executable since the LLDB shared library only exports stuff in the lldb
+    // namespace. This allows you to attach with a debugger and call this
+    // function and get the packet history dumped to a file.
+    void
+    DumpProcessGDBRemotePacketHistory (void *p, const char *path)
+    {
+        ((ProcessGDBRemote *)p)->GetGDBRemote().DumpHistory (path);
+    }
+};
 
 
 #define DEBUGSERVER_BASENAME    "debugserver"

Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Mon Apr  9 18:16:33 2012
@@ -210,6 +210,12 @@
     virtual bool
     StopNoticingNewThreads();    
 
+    GDBRemoteCommunicationClient &
+    GetGDBRemote()
+    {
+        return m_gdb_comm;
+    }
+
 protected:
     friend class ThreadGDBRemote;
     friend class GDBRemoteCommunicationClient;
@@ -275,12 +281,6 @@
     void
     BuildDynamicRegisterInfo (bool force);
 
-    GDBRemoteCommunicationClient &
-    GetGDBRemote()
-    {
-        return m_gdb_comm;
-    }
-
     void
     SetLastStopPacket (const StringExtractorGDBRemote &response)
     {

Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon Apr  9 18:16:33 2012
@@ -2607,11 +2607,12 @@
     
     LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
 
-    const DWARFDebugInfoEntry *decl_ctx_die = GetDeclContextDIEContainingDIE (cu, die);
+    const DWARFDebugInfoEntry *decl_ctx_die = NULL;
+    clang::DeclContext *die_clang_decl_ctx = GetClangDeclContextContainingDIE (cu, die, &decl_ctx_die);
     if (decl_ctx_die)
-    {
-
+    { 
         clang::NamespaceDecl *clang_namespace_decl = namespace_decl->GetNamespaceDecl();
+
         if (clang_namespace_decl)
         {
             if (decl_ctx_die->Tag() != DW_TAG_namespace)
@@ -2621,17 +2622,10 @@
                 return false;
             }
                 
-            DeclContextToDIEMap::iterator pos = m_decl_ctx_to_die.find(clang_namespace_decl);
-            
-            if (pos == m_decl_ctx_to_die.end())
-            {
-                if (log)
-                    GetObjectFile()->GetModule()->LogMessage(log.get(), "Found a match in a namespace, but its parent is not the requested namespace");
-                
+            if (clang_namespace_decl == die_clang_decl_ctx)
+                return true;
+            else
                 return false;
-            }
-            
-            return pos->second.count (decl_ctx_die);
         }
         else
         {
@@ -2704,8 +2698,8 @@
         m_global_index.Find (name, die_offsets);
     }
     
-    const size_t num_matches = die_offsets.size();
-    if (num_matches)
+    const size_t num_die_matches = die_offsets.size();
+    if (num_die_matches)
     {
         SymbolContext sc;
         sc.module_sp = m_obj_file->GetModule();
@@ -2714,23 +2708,38 @@
         DWARFDebugInfo* debug_info = DebugInfo();
         DWARFCompileUnit* dwarf_cu = NULL;
         const DWARFDebugInfoEntry* die = NULL;
-        for (size_t i=0; i<num_matches; ++i)
+        bool done = false;
+        for (size_t i=0; i<num_die_matches && !done; ++i)
         {
             const dw_offset_t die_offset = die_offsets[i];
             die = debug_info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu);
 
             if (die)
             {
-                sc.comp_unit = GetCompUnitForDWARFCompUnit(dwarf_cu, UINT32_MAX);
-                assert(sc.comp_unit != NULL);
-                
-                if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
-                    continue;
+                switch (die->Tag())
+                {
+                    default:
+                    case DW_TAG_subprogram:
+                    case DW_TAG_inlined_subroutine:
+                    case DW_TAG_try_block:
+                    case DW_TAG_catch_block:
+                        break;
+                        
+                    case DW_TAG_variable:
+                        {
+                            sc.comp_unit = GetCompUnitForDWARFCompUnit(dwarf_cu, UINT32_MAX);
+                            assert(sc.comp_unit != NULL);
+                    
+                            if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
+                                continue;
 
-                ParseVariables(sc, dwarf_cu, LLDB_INVALID_ADDRESS, die, false, false, &variables);
+                            ParseVariables(sc, dwarf_cu, LLDB_INVALID_ADDRESS, die, false, false, &variables);
 
-                if (variables.GetSize() - original_size >= max_matches)
-                    break;
+                            if (variables.GetSize() - original_size >= max_matches)
+                                done = true;
+                        }
+                        break;
+                }
             }
             else
             {
@@ -2744,7 +2753,18 @@
     }
 
     // Return the number of variable that were appended to the list
-    return variables.GetSize() - original_size;
+    const uint32_t num_matches = variables.GetSize() - original_size;
+    if (log && num_matches > 0)
+    {
+        GetObjectFile()->GetModule()->LogMessage (log.get(), 
+                                                  "SymbolFileDWARF::FindGlobalVariables (name=\"%s\", namespace_decl=%p, append=%u, max_matches=%u, variables) => %u",
+                                                  name.GetCString(), 
+                                                  namespace_decl,
+                                                  append, 
+                                                  max_matches,
+                                                  num_matches);
+    }
+    return num_matches;
 }
 
 uint32_t
@@ -3340,7 +3360,18 @@
     }
 
     // Return the number of variable that were appended to the list
-    return sc_list.GetSize() - original_size;
+    const uint32_t num_matches = sc_list.GetSize() - original_size;
+    
+    if (log && num_matches > 0)
+    {
+        GetObjectFile()->GetModule()->LogMessage (log.get(), 
+                                                  "SymbolFileDWARF::FindFunctions (name=\"%s\", name_type_mask=0x%x, append=%u, sc_list) => %u",
+                                                  name.GetCString(), 
+                                                  name_type_mask, 
+                                                  append,
+                                                  num_matches);
+    }
+    return num_matches;
 }
 
 uint32_t
@@ -3405,11 +3436,24 @@
     
     if (log)
     {
-        GetObjectFile()->GetModule()->LogMessage (log.get(), 
-                                                  "SymbolFileDWARF::FindTypes (sc, name=\"%s\", append=%u, max_matches=%u, type_list)", 
-                                                  name.GetCString(), 
-                                                  append, 
-                                                  max_matches);
+        if (namespace_decl)
+        {
+            GetObjectFile()->GetModule()->LogMessage (log.get(),
+                                                      "SymbolFileDWARF::FindTypes (sc, name=\"%s\", clang::NamespaceDecl(%p) \"%s\", append=%u, max_matches=%u, type_list)", 
+                                                      name.GetCString(),
+                                                      namespace_decl->GetNamespaceDecl(),
+                                                      namespace_decl->GetQualifiedName().c_str(),
+                                                      append, 
+                                                      max_matches);
+        }
+        else
+        {
+            GetObjectFile()->GetModule()->LogMessage (log.get(),
+                                                      "SymbolFileDWARF::FindTypes (sc, name=\"%s\", clang::NamespaceDecl(NULL), append=%u, max_matches=%u, type_list)",
+                                                      name.GetCString(), 
+                                                      append, 
+                                                      max_matches);
+        }
     }
 
     // If we aren't appending the results to this list, then clear the list
@@ -3437,15 +3481,15 @@
         m_type_index.Find (name, die_offsets);
     }
     
-    const size_t num_matches = die_offsets.size();
+    const size_t num_die_matches = die_offsets.size();
 
-    if (num_matches)
+    if (num_die_matches)
     {
         const uint32_t initial_types_size = types.GetSize();
         DWARFCompileUnit* dwarf_cu = NULL;
         const DWARFDebugInfoEntry* die = NULL;
         DWARFDebugInfo* debug_info = DebugInfo();
-        for (size_t i=0; i<num_matches; ++i)
+        for (size_t i=0; i<num_die_matches; ++i)
         {
             const dw_offset_t die_offset = die_offsets[i];
             die = debug_info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu);
@@ -3474,7 +3518,31 @@
             }            
 
         }
-        return types.GetSize() - initial_types_size;
+        const uint32_t num_matches = types.GetSize() - initial_types_size;
+        if (log && num_matches)
+        {
+            if (namespace_decl)
+            {
+                GetObjectFile()->GetModule()->LogMessage (log.get(),
+                                                          "SymbolFileDWARF::FindTypes (sc, name=\"%s\", clang::NamespaceDecl(%p) \"%s\", append=%u, max_matches=%u, type_list) => %u", 
+                                                          name.GetCString(),
+                                                          namespace_decl->GetNamespaceDecl(),
+                                                          namespace_decl->GetQualifiedName().c_str(),
+                                                          append, 
+                                                          max_matches,
+                                                          num_matches);
+            }
+            else
+            {
+                GetObjectFile()->GetModule()->LogMessage (log.get(),
+                                                          "SymbolFileDWARF::FindTypes (sc, name=\"%s\", clang::NamespaceDecl(NULL), append=%u, max_matches=%u, type_list) => %u",
+                                                          name.GetCString(), 
+                                                          append, 
+                                                          max_matches,
+                                                          num_matches);
+            }
+        }
+        return num_matches;
     }
     return 0;
 }
@@ -3557,6 +3625,15 @@
             }
         }
     }
+    if (log && namespace_decl.GetNamespaceDecl())
+    {
+        GetObjectFile()->GetModule()->LogMessage (log.get(), 
+                                                  "SymbolFileDWARF::FindNamespace (sc, name=\"%s\") => clang::NamespaceDecl(%p) \"%s\"",
+                                                  name.GetCString(),
+                                                  namespace_decl.GetNamespaceDecl(),
+                                                  namespace_decl.GetQualifiedName().c_str());
+    }
+
     return namespace_decl;
 }
 

Modified: lldb/branches/lldb-platform-work/source/Symbol/ClangNamespaceDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Symbol/ClangNamespaceDecl.cpp?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Symbol/ClangNamespaceDecl.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Symbol/ClangNamespaceDecl.cpp Mon Apr  9 18:16:33 2012
@@ -9,3 +9,17 @@
 
 #include "lldb/Symbol/ClangNamespaceDecl.h"
 
+#include "clang/AST/Decl.h"
+
+namespace lldb_private {
+    
+std::string
+ClangNamespaceDecl::GetQualifiedName () const
+{
+    if (m_namespace_decl)
+        return m_namespace_decl->getQualifiedNameAsString();
+    return std::string();
+}
+
+
+}

Modified: lldb/branches/lldb-platform-work/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/Platform.cpp?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/Platform.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/Platform.cpp Mon Apr  9 18:16:33 2012
@@ -670,9 +670,7 @@
 
 Error
 Platform::GetFile (const FileSpec& source,
-                   const FileSpec& destination,
-                   uint32_t uid,
-                   uint32_t gid)
+                   const FileSpec& destination)
 {
     Error error("unimplemented");
     return error;

Modified: lldb/branches/lldb-platform-work/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/Thread.cpp?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/Thread.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/Thread.cpp Mon Apr  9 18:16:33 2012
@@ -349,7 +349,7 @@
         }
         else
         {
-            // If the current plan doesn't explain the stop, then, find one that
+            // If the current plan doesn't explain the stop, then find one that
             // does and let it handle the situation.
             ThreadPlan *plan_ptr = current_plan;
             while ((plan_ptr = GetPreviousPlan(plan_ptr)) != NULL)
@@ -839,6 +839,17 @@
     }
 }
 
+bool
+Thread::PlanIsBasePlan (ThreadPlan *plan_ptr)
+{
+    if (plan_ptr->IsBasePlan())
+        return true;
+    else if (m_plan_stack.size() == 0)
+        return false;
+    else
+       return m_plan_stack[0].get() == plan_ptr;
+}
+
 ThreadPlan *
 Thread::QueueFundamentalPlan (bool abort_other_plans)
 {

Modified: lldb/branches/lldb-platform-work/source/Target/ThreadPlan.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/ThreadPlan.cpp?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/ThreadPlan.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/ThreadPlan.cpp Mon Apr  9 18:16:33 2012
@@ -36,7 +36,8 @@
     m_plan_complete_mutex (Mutex::eMutexTypeRecursive),
     m_plan_complete (false),
     m_plan_private (false),
-    m_okay_to_discard (false)
+    m_okay_to_discard (false),
+    m_is_master_plan (false)
 {
     SetID (GetNextID());
 }

Modified: lldb/branches/lldb-platform-work/source/Target/ThreadPlanBase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/ThreadPlanBase.cpp?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/ThreadPlanBase.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/ThreadPlanBase.cpp Mon Apr  9 18:16:33 2012
@@ -47,6 +47,7 @@
 #endif
     new_tracer_sp->EnableTracing (m_thread.GetTraceEnabledState());
     SetThreadPlanTracer(new_tracer_sp);
+    SetIsMasterPlan (true);
 }
 
 ThreadPlanBase::~ThreadPlanBase ()

Modified: lldb/branches/lldb-platform-work/source/Target/ThreadPlanCallFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/ThreadPlanCallFunction.cpp?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/ThreadPlanCallFunction.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/ThreadPlanCallFunction.cpp Mon Apr  9 18:16:33 2012
@@ -52,6 +52,9 @@
     m_takedown_done (false),
     m_stop_address (LLDB_INVALID_ADDRESS)
 {
+    // Call function thread plans need to be master plans so that they can potentially stay on the stack when
+    // a breakpoint is hit during the function call.
+    SetIsMasterPlan (true);
     SetOkayToDiscard (discard_on_error);
 
     ProcessSP process_sp (thread.GetProcess());
@@ -172,6 +175,9 @@
     m_return_type (return_type),
     m_takedown_done (false)
 {
+    // Call function thread plans need to be master plans so that they can potentially stay on the stack when
+    // a breakpoint is hit during the function call.
+    SetIsMasterPlan (true);
     SetOkayToDiscard (discard_on_error);
     
     ProcessSP process_sp (thread.GetProcess());

Modified: lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepOverRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepOverRange.cpp?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepOverRange.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepOverRange.cpp Mon Apr  9 18:16:33 2012
@@ -43,6 +43,9 @@
 ) :
     ThreadPlanStepRange (ThreadPlan::eKindStepOverRange, "Step range stepping over", thread, range, addr_context, stop_others)
 {
+    // Step over range plans can be master plans, since you could hit a breakpoint while stepping over, step around
+    // a bit, then continue to finish up the step over.
+    SetIsMasterPlan (true);
     SetOkayToDiscard (okay_to_discard);
 }
 

Modified: lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepUntil.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepUntil.cpp?rev=154355&r1=154354&r2=154355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepUntil.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepUntil.cpp Mon Apr  9 18:16:33 2012
@@ -52,7 +52,11 @@
     m_stop_others (stop_others)
 {
 
+    // Step until plans can be master plans, since you could hit a breakpoint while stepping to the stop point, step around
+    // a bit, then continue to finish up the step until.
+    SetIsMasterPlan (true);
     SetOkayToDiscard(true);
+    
     // Stash away our "until" addresses:
     TargetSP target_sp (m_thread.CalculateTarget());
 





More information about the lldb-commits mailing list