[Lldb-commits] [lldb] r155259 - in /lldb/branches/lldb-platform-work: ./ examples/python/ include/lldb/Breakpoint/ include/lldb/Target/ source/Core/ source/Plugins/Platform/MacOSX/ source/Plugins/SymbolFile/DWARF/ source/Target/ test/functionalities/load_unload/

Johnny Chen johnny.chen at apple.com
Fri Apr 20 16:53:43 PDT 2012


Author: johnny
Date: Fri Apr 20 18:53:43 2012
New Revision: 155259

URL: http://llvm.org/viewvc/llvm-project?rev=155259&view=rev
Log:
Merge chages from ToT and resolve conflicts:

svn merge -r 155175:155255 https://johnny@llvm.org/svn/llvm-project/lldb/trunk .

Modified:
    lldb/branches/lldb-platform-work/   (props changed)
    lldb/branches/lldb-platform-work/examples/python/crashlog.py
    lldb/branches/lldb-platform-work/examples/python/symbolication.py
    lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointOptions.h
    lldb/branches/lldb-platform-work/include/lldb/Target/StopInfo.h
    lldb/branches/lldb-platform-work/source/Core/Module.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/branches/lldb-platform-work/source/Target/StopInfo.cpp
    lldb/branches/lldb-platform-work/source/Target/Thread.cpp
    lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepRange.cpp
    lldb/branches/lldb-platform-work/test/functionalities/load_unload/TestLoadUnload.py

Propchange: lldb/branches/lldb-platform-work/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Apr 20 18:53:43 2012
@@ -1 +1 @@
-/lldb/trunk:154224-155175
+/lldb/trunk:154224-155255

Modified: lldb/branches/lldb-platform-work/examples/python/crashlog.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/examples/python/crashlog.py?rev=155259&r1=155258&r2=155259&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/examples/python/crashlog.py (original)
+++ lldb/branches/lldb-platform-work/examples/python/crashlog.py Fri Apr 20 18:53:43 2012
@@ -114,7 +114,7 @@
         def locate_module_and_debug_symbols(self):
             if self.resolved_path:
                 # Don't load a module twice...
-                return 0
+                return True
             print 'Locating %s %s...' % (self.uuid, self.path),
             if os.path.exists(self.dsymForUUIDBinary):
                 dsym_for_uuid_command = '%s %s' % (self.dsymForUUIDBinary, self.uuid)
@@ -144,16 +144,15 @@
                             break;
                 if not self.resolved_path:
                     print "error: file %s '%s' doesn't match the UUID in the installed file" % (self.uuid, self.path)
-                    return 0
+                    return False
             if (self.resolved_path and os.path.exists(self.resolved_path)) or (self.path and os.path.exists(self.path)):
                 print 'ok'
-                if self.path != self.resolved_path:
+                if self.resolved_path:
                     print '  exe = "%s"' % self.resolved_path 
                 if self.symfile:
                     print ' dsym = "%s"' % self.symfile
-                return 1
-            else:
-                return 0
+                return True
+            return False
         
     
         

Modified: lldb/branches/lldb-platform-work/examples/python/symbolication.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/examples/python/symbolication.py?rev=155259&r1=155258&r2=155259&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/examples/python/symbolication.py (original)
+++ lldb/branches/lldb-platform-work/examples/python/symbolication.py Fri Apr 20 18:53:43 2012
@@ -282,17 +282,16 @@
     def add_module(self, target):
         '''Add the Image described in this object to "target" and load the sections if "load" is True.'''
         if target:
-            resolved_path = self.get_resolved_path();
             # Try and find using UUID only first so that paths need not match up
             if self.uuid:
                 self.module = target.AddModule (None, None, str(self.uuid))
             if not self.module:
-                if self.locate_module_and_debug_symbols ():
-                    path_spec = lldb.SBFileSpec (resolved_path)
-                    #print 'target.AddModule (path="%s", arch="%s", uuid=%s)' % (resolved_path, self.arch, self.uuid)
-                    self.module = target.AddModule (resolved_path, self.arch, self.uuid)
+                self.locate_module_and_debug_symbols ()
+                resolved_path = self.get_resolved_path()
+                print 'target.AddModule (path="%s", arch="%s", uuid=%s, symfile="%s")' % (resolved_path, self.arch, self.uuid, self.symfile)
+                self.module = target.AddModule (resolved_path, self.arch, self.uuid)#, self.symfile)
             if not self.module:
-                return 'error: unable to get module for (%s) "%s"' % (self.arch, resolved_path)
+                return 'error: unable to get module for (%s) "%s"' % (self.arch, self.get_resolved_path())
             if self.has_section_load_info():
                 return self.load_module(target)
             else:

Modified: lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointOptions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointOptions.h?rev=155259&r1=155258&r2=155259&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointOptions.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointOptions.h Fri Apr 20 18:53:43 2012
@@ -79,15 +79,91 @@
 
     //------------------------------------------------------------------
     // Callbacks
+    //
+    // Breakpoint callbacks come in two forms, synchronous and asynchronous.  Synchronous callbacks will get
+    // run before any of the thread plans are consulted, and if they return false the target will continue
+    // "under the radar" of the thread plans.  There are a couple of restrictions to synchronous callbacks:
+    // 1) They should NOT resume the target themselves.  Just return false if you want the target to restart.
+    // 2) Breakpoints with synchronous callbacks can't have conditions (or rather, they can have them, but they
+    //    won't do anything.  Ditto with ignore counts, etc...  You are supposed to control that all through the
+    //    callback.
+    // Asynchronous callbacks get run as part of the "ShouldStop" logic in the thread plan.  The logic there is:
+    //   a) If the breakpoint is thread specific and not for this thread, continue w/o running the callback.
+    //   b) If the ignore count says we shouldn't stop, then ditto.
+    //   c) If the condition says we shouldn't stop, then ditto.
+    //   d) Otherwise, the callback will get run, and if it returns true we will stop, and if false we won't.
+    //  The asynchronous callback can run the target itself, but at present that should be the last action the
+    //  callback does.  We will relax this condition at some point, but it will take a bit of plumbing to get
+    //  that to work.
+    // 
+    //------------------------------------------------------------------
+    
+    //------------------------------------------------------------------
+    /// Adds a callback to the breakpoint option set.
+    ///
+    /// @param[in] callback
+    ///    The function to be called when the breakpoint gets hit.
+    ///
+    /// @param[in] baton_sp
+    ///    A baton which will get passed back to the callback when it is invoked.
+    ///
+    /// @param[in] synchronous
+    ///    Whether this is a synchronous or asynchronous callback.  See discussion above.
     //------------------------------------------------------------------
     void SetCallback (BreakpointHitCallback callback, const lldb::BatonSP &baton_sp, bool synchronous = false);
+    
+    
+    //------------------------------------------------------------------
+    /// Remove the callback from this option set.
+    //------------------------------------------------------------------
+    void ClearCallback ();
+
+    // The rest of these functions are meant to be used only within the breakpoint handling mechanism.
+    
+    //------------------------------------------------------------------
+    /// Use this function to invoke the callback for a specific stop.
+    ///
+    /// @param[in] context
+    ///    The context in which the callback is to be invoked.  This includes the stop event, the
+    ///    execution context of the stop (since you might hit the same breakpoint on multiple threads) and
+    ///    whether we are currently executing synchronous or asynchronous callbacks.
+    /// 
+    /// @param[in] break_id
+    ///    The breakpoint ID that owns this option set.
+    ///
+    /// @param[in] break_loc_id
+    ///    The breakpoint location ID that owns this option set.
+    ///
+    /// @return
+    ///     The callback return value.
+    //------------------------------------------------------------------
     bool InvokeCallback (StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
+    
+    //------------------------------------------------------------------
+    /// Used in InvokeCallback to tell whether it is the right time to run this kind of callback.
+    ///
+    /// @param[in] condition
+    ///    The condition expression to evaluate when the breakpoint is hit.
+    //------------------------------------------------------------------
     bool IsCallbackSynchronous () {
         return m_callback_is_synchronous;
     }
+    
+    //------------------------------------------------------------------
+    /// Fetch the baton from the callback.
+    ///
+    /// @return
+    ///     The baton.
+    //------------------------------------------------------------------
     Baton *GetBaton ();
+    
+    //------------------------------------------------------------------
+    /// Fetch  a const version of the baton from the callback.
+    ///
+    /// @return
+    ///     The baton.
+    //------------------------------------------------------------------
     const Baton *GetBaton () const;
-    void ClearCallback ();
     
     //------------------------------------------------------------------
     // Condition

Modified: lldb/branches/lldb-platform-work/include/lldb/Target/StopInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/StopInfo.h?rev=155259&r1=155258&r2=155259&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/StopInfo.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/StopInfo.h Fri Apr 20 18:53:43 2012
@@ -74,12 +74,25 @@
     }
 
     // Stop the thread by default. Subclasses can override this to allow
-    // the thread to continue if desired.
+    // the thread to continue if desired.  The ShouldStop method should not do anything
+    // that might run code.  If you need to run code when deciding whether to stop
+    // at this StopInfo, that must be done in the PerformAction.  The PerformAction will
+    // always get called before the ShouldStop.
     virtual bool
     ShouldStop (Event *event_ptr)
     {
         return true;
     }
+    
+    // ShouldStopSynchronous will get called before any thread plans are consulted, and if it says we should
+    // resume the target, then we will just immediately resume.  This should not run any code in or resume the
+    // target.
+    
+    virtual bool
+    ShouldStopSynchronous (Event *event_ptr)
+    {
+        return true;
+    }
 
     // If should stop returns false, check if we should notify of this event
     virtual bool

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=155259&r1=155258&r2=155259&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/Module.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/Module.cpp Fri Apr 20 18:53:43 2012
@@ -240,11 +240,6 @@
         Mutex::Locker locker (m_mutex);
         if (process_sp)
         {
-            StreamString s;
-            if (m_file.GetFilename())
-                s << m_file.GetFilename();
-                s.Printf("[0x%16.16llx]", header_addr);
-                m_file.GetFilename().SetCString (s.GetData());
             m_did_load_objfile = true;
             std::auto_ptr<DataBufferHeap> data_ap (new DataBufferHeap (512, 0));
             Error readmem_error;
@@ -258,7 +253,11 @@
                 m_objfile_sp = ObjectFile::FindPlugin(shared_from_this(), process_sp, header_addr, data_sp);
                 if (m_objfile_sp)
                 {
-                    // Once we get the object file, update our module with the object file's 
+                    StreamString s;
+                    s.Printf("0x%16.16llx", header_addr);
+                    m_object_name.SetCString (s.GetData());
+
+                    // Once we get the object file, update our module with the object file's
                     // architecture since it might differ in vendor/os if some parts were
                     // unknown.
                     m_objfile_sp->GetArchitecture (m_arch);

Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp?rev=155259&r1=155258&r2=155259&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp Fri Apr 20 18:53:43 2012
@@ -135,7 +135,11 @@
 //------------------------------------------------------------------
 PlatformRemoteiOS::PlatformRemoteiOS () :
     PlatformDarwin (false),    // This is a remote platform
-    m_device_support_directory_for_os_version ()
+    m_sdk_directory_infos(),
+    m_device_support_directory(),
+    m_device_support_directory_for_os_version (),
+    m_build_update(),
+    m_last_module_sdk_idx(UINT32_MAX)
 {
 }
 
@@ -160,15 +164,15 @@
     else
         strm.PutCString ("  SDK Path: error: unable to locate SDK\n");
     
-//    const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
-//    for (uint32_t i=0; i<num_sdk_infos; ++i)
-//    {
-//        const SDKDirectoryInfo &sdk_dir_info = m_sdk_directory_infos[i];
-//        strm.Printf (" SDK Roots: [%2u] \"%s/%s\"\n",
-//                     i,
-//                     sdk_dir_info.directory.GetDirectory().GetCString(),
-//                     sdk_dir_info.directory.GetFilename().GetCString());
-//    }
+    const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
+    for (uint32_t i=0; i<num_sdk_infos; ++i)
+    {
+        const SDKDirectoryInfo &sdk_dir_info = m_sdk_directory_infos[i];
+        strm.Printf (" SDK Roots: [%2u] \"%s/%s\"\n",
+                     i,
+                     sdk_dir_info.directory.GetDirectory().GetCString(),
+                     sdk_dir_info.directory.GetFilename().GetCString());
+    }
 }
 
 
@@ -484,6 +488,97 @@
     return NULL;
 }
 
+uint32_t
+PlatformRemoteiOS::FindFileInAllSDKs (const char *platform_file_path,
+                                      FileSpecList &file_list)
+{
+    if (platform_file_path && platform_file_path[0] && UpdateSDKDirectoryInfosInNeeded())
+    {
+        const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
+        lldb_private::FileSpec local_file;
+        // First try for an exact match of major, minor and update
+        for (uint32_t sdk_idx=0; sdk_idx<num_sdk_infos; ++sdk_idx)
+        {
+            if (GetFileInSDK (platform_file_path,
+                              sdk_idx,
+                              local_file))
+            {
+                file_list.Append(local_file);
+            }
+        }
+    }
+    return file_list.GetSize();
+}
+
+bool
+PlatformRemoteiOS::GetFileInSDK (const char *platform_file_path,
+                                 uint32_t sdk_idx,
+                                 lldb_private::FileSpec &local_file)
+{
+    if (sdk_idx < m_sdk_directory_infos.size())
+    {
+        char sdkroot_path[PATH_MAX];
+        const SDKDirectoryInfo &sdk_dir_info = m_sdk_directory_infos[sdk_idx];
+        if (sdk_dir_info.directory.GetPath(sdkroot_path, sizeof(sdkroot_path)))
+        {
+            const bool symbols_dirs_only = true;
+
+            return GetFileInSDKRoot (platform_file_path,
+                                     sdkroot_path,
+                                     symbols_dirs_only,
+                                     local_file);
+        }
+    }
+    return false;
+}
+
+
+bool
+PlatformRemoteiOS::GetFileInSDKRoot (const char *platform_file_path,
+                                     const char *sdkroot_path,
+                                     bool symbols_dirs_only,
+                                     lldb_private::FileSpec &local_file)
+{
+    if (sdkroot_path && sdkroot_path[0] && platform_file_path && platform_file_path[0])
+    {
+        char resolved_path[PATH_MAX];
+        
+        if (!symbols_dirs_only)
+        {
+            ::snprintf (resolved_path, 
+                        sizeof(resolved_path), 
+                        "%s/%s", 
+                        sdkroot_path,
+                        platform_file_path);
+            
+            local_file.SetFile(resolved_path, true);
+            if (local_file.Exists())
+                return true;
+        }
+            
+        ::snprintf (resolved_path,
+                    sizeof(resolved_path), 
+                    "%s/Symbols.Internal/%s", 
+                    sdkroot_path,
+                    platform_file_path);
+        
+        local_file.SetFile(resolved_path, true);
+        if (local_file.Exists())
+            return true;
+        ::snprintf (resolved_path,
+                    sizeof(resolved_path), 
+                    "%s/Symbols/%s", 
+                    sdkroot_path, 
+                    platform_file_path);
+        
+        local_file.SetFile(resolved_path, true);
+        if (local_file.Exists())
+            return true;                
+    }
+    return false;
+}
+
+
 Error
 PlatformRemoteiOS::GetSymbolFile (const FileSpec &platform_file, 
                                   const UUID *uuid_ptr,
@@ -557,22 +652,85 @@
     const FileSpec &platform_file = module_spec.GetFileSpec();
 
     FileSpec local_file;
-    Error error (GetSymbolFile (platform_file, module_spec.GetUUIDPtr(), local_file));
+    const UUID *module_uuid_ptr = module_spec.GetUUIDPtr();
+    Error error (GetSymbolFile (platform_file, module_uuid_ptr, local_file));
     if (error.Success())
     {
-        error = ResolveExecutable (local_file, module_spec.GetArchitecture(), module_sp, module_search_paths_ptr);
-    }
-    else
-    {
-        const bool always_create = false;
-        error = ModuleList::GetSharedModule (module_spec, 
-                                             module_sp,
-                                             module_search_paths_ptr,
-                                             old_module_sp_ptr,
-                                             did_create_ptr,
-                                             always_create);
+        error = ResolveExecutable (local_file, module_spec.GetArchitecture(), module_sp, NULL);
+        if (module_sp && ((module_uuid_ptr == NULL) || (module_sp->GetUUID() == *module_uuid_ptr)))
+        {
+            //printf ("found in user specified SDK\n");
+            error.Clear();
+            return error;
+        }
 
+        char platform_file_path[PATH_MAX];
+        if (platform_file.GetPath(platform_file_path, sizeof(platform_file_path)))
+        {
+            FileSpec local_file;
+            const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
+            // Try the last SDK index if it is set as most files from an SDK
+            // will tend to be valid in that same SDK.
+            if (m_last_module_sdk_idx < num_sdk_infos)
+            {
+                if (GetFileInSDK (platform_file_path, m_last_module_sdk_idx, local_file))
+                {
+                    //printf ("sdk[%u] last: '%s/%s'\n", m_last_module_sdk_idx, local_file.GetDirectory().GetCString(), local_file.GetFilename().GetCString());
+                    module_sp.reset();
+                    error = ResolveExecutable (local_file,
+                                               module_spec.GetArchitecture(),
+                                               module_sp,
+                                               NULL);
+                    if (module_sp && module_sp->GetUUID() == *module_uuid_ptr)
+                    {
+                        //printf ("sdk[%u] last found\n", m_last_module_sdk_idx);
+                        error.Clear();
+                        return error;
+                    }
+                }
+            }
+            
+            // First try for an exact match of major, minor and update
+            for (uint32_t sdk_idx=0; sdk_idx<num_sdk_infos; ++sdk_idx)
+            {
+                if (m_last_module_sdk_idx == sdk_idx)
+                {
+                    // Skip the last module SDK index if we already searched
+                    // it above
+                    continue;
+                }
+                if (GetFileInSDK (platform_file_path, sdk_idx, local_file))
+                {
+                    //printf ("sdk[%u]: '%s/%s'\n", sdk_idx, local_file.GetDirectory().GetCString(), local_file.GetFilename().GetCString());
+                    
+                    error = ResolveExecutable (local_file,
+                                               module_spec.GetArchitecture(),
+                                               module_sp,
+                                               NULL);
+                    if (module_sp && module_sp->GetUUID() == *module_uuid_ptr)
+                    {
+                        // Remember the index of the last SDK that we found a file
+                        // in in case the wrong SDK was selected.
+                        m_last_module_sdk_idx = sdk_idx;
+                        //printf ("sdk[%u]: found (setting last to %u)\n", sdk_idx, m_last_module_sdk_idx);
+                        error.Clear();
+                        return error;
+                    }
+                }
+            }
+        }
+        // Not the module we are looking for... Nothing to see here...
+        module_sp.reset();
     }
+
+    const bool always_create = false;
+    error = ModuleList::GetSharedModule (module_spec, 
+                                         module_sp,
+                                         module_search_paths_ptr,
+                                         old_module_sp_ptr,
+                                         did_create_ptr,
+                                         always_create);
+
     if (module_sp)
         module_sp->SetPlatformFileSpec(platform_file);
 

Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h?rev=155259&r1=155258&r2=155259&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h Fri Apr 20 18:53:43 2012
@@ -126,11 +126,11 @@
         bool user_cached;
     };
     typedef std::vector<SDKDirectoryInfo> SDKDirectoryInfoCollection;
-    std::string m_device_support_directory;
     SDKDirectoryInfoCollection m_sdk_directory_infos;
+    std::string m_device_support_directory;
     std::string m_device_support_directory_for_os_version;
     std::string m_build_update;
-    //std::vector<FileSpec> m_device_support_os_dirs;
+    uint32_t m_last_module_sdk_idx;
 
     bool
     UpdateSDKDirectoryInfosInNeeded();
@@ -152,6 +152,25 @@
                                                   lldb_private::FileSpec::FileType file_type,
                                                   const lldb_private::FileSpec &file_spec);
 
+    uint32_t
+    FindFileInAllSDKs (const char *platform_file_path,
+                       lldb_private::FileSpecList &file_list);
+
+    bool
+    GetFileInSDK (const char *platform_file_path,
+                  uint32_t sdk_idx,
+                  lldb_private::FileSpec &local_file);
+
+    bool
+    GetFileInSDKRoot (const char *platform_file_path,
+                      const char *sdkroot_path,
+                      bool symbols_dirs_only,
+                      lldb_private::FileSpec &local_file);
+
+    uint32_t
+    FindFileInAllSDKs (const lldb_private::FileSpec &platform_file,
+                       lldb_private::FileSpecList &file_list);
+
 private:
     DISALLOW_COPY_AND_ASSIGN (PlatformRemoteiOS);
 

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=155259&r1=155258&r2=155259&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 Fri Apr 20 18:53:43 2012
@@ -4561,6 +4561,18 @@
     if (cu == NULL || die == NULL || !type_name)
         return type_sp;
 
+    LogSP log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_TYPE_COMPLETION|DWARF_LOG_LOOKUPS));
+    if (log)
+    {
+        std::string qualified_name;
+        die->GetQualifiedName(this, cu, qualified_name);
+        GetObjectFile()->GetModule()->LogMessage (log.get(),
+                                                  "SymbolFileDWARF::FindDefinitionTypeForDIE(die=0x%8.8x (%s), name='%s')",
+                                                  die->GetOffset(),
+                                                  qualified_name.c_str(),
+                                                  type_name.GetCString());
+    }
+
     DIEArray die_offsets;
 
     if (m_using_apple_tables)
@@ -4639,6 +4651,18 @@
                         
                 if (try_resolving_type)
                 {
+                    if (log)
+                    {
+                        std::string qualified_name;
+                        type_die->GetQualifiedName(this, cu, qualified_name);
+                        GetObjectFile()->GetModule()->LogMessage (log.get(),
+                                                                  "SymbolFileDWARF::FindDefinitionTypeForDIE(die=0x%8.8x, name='%s') trying die=0x%8.8x (%s)",
+                                                                  die->GetOffset(),
+                                                                  type_name.GetCString(),
+                                                                  type_die->GetOffset(),
+                                                                  qualified_name.c_str());
+                    }
+                    
                     // Make sure the decl contexts match all the way up
                     if (DIEDeclContextsMatch(cu, die, type_cu, type_die))
                     {
@@ -4658,6 +4682,20 @@
                         }
                     }
                 }
+                else
+                {
+                    if (log)
+                    {
+                        std::string qualified_name;
+                        type_die->GetQualifiedName(this, cu, qualified_name);
+                        GetObjectFile()->GetModule()->LogMessage (log.get(),
+                                                                  "SymbolFileDWARF::FindDefinitionTypeForDIE(die=0x%8.8x, name='%s') ignoring die=0x%8.8x (%s)",
+                                                                  die->GetOffset(),
+                                                                  type_name.GetCString(),
+                                                                  type_die->GetOffset(),
+                                                                  qualified_name.c_str());
+                    }
+                }
             }
             else
             {

Modified: lldb/branches/lldb-platform-work/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/StopInfo.cpp?rev=155259&r1=155258&r2=155259&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/StopInfo.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/StopInfo.cpp Fri Apr 20 18:53:43 2012
@@ -134,7 +134,7 @@
     }
 
     virtual bool
-    ShouldStop (Event *event_ptr)
+    ShouldStopSynchronous (Event *event_ptr)
     {
         if (!m_should_stop_is_valid)
         {
@@ -160,6 +160,15 @@
         return m_should_stop;
     }
     
+    bool
+    ShouldStop (Event *event_ptr)
+    {
+        // This just reports the work done by PerformAction or the synchronous stop.  It should
+        // only ever get called after they have had a chance to run.
+        assert (m_should_stop_is_valid);
+        return m_should_stop;
+    }
+    
     virtual void
     PerformAction (Event *event_ptr)
     {
@@ -216,7 +225,7 @@
                         const bool discard_on_error = true;
                         Error error;
                         result_code = ClangUserExpression::EvaluateWithError (exe_ctx,
-                                                                              eExecutionPolicyAlways,
+                                                                              eExecutionPolicyOnlyWhenNeeded,
                                                                               lldb::eLanguageTypeUnknown,
                                                                               ClangUserExpression::eResultTypeAny,
                                                                               discard_on_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=155259&r1=155258&r2=155259&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/Thread.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/Thread.cpp Fri Apr 20 18:53:43 2012
@@ -333,6 +333,17 @@
     
     // The top most plan always gets to do the trace log...
     current_plan->DoTraceLog ();
+    
+    // First query the stop info's ShouldStopSynchronous.  This handles "synchronous" stop reasons, for example the breakpoint
+    // command on internal breakpoints.  If a synchronous stop reason says we should not stop, then we don't have to
+    // do any more work on this stop.
+    StopInfoSP private_stop_info (GetPrivateStopReason());
+    if (private_stop_info && private_stop_info->ShouldStopSynchronous(event_ptr) == false)
+    {
+        if (log)
+            log->Printf ("StopInfo::ShouldStop async callback says we should not stop, returning ShouldStop of false.");
+        return false;
+    }
 
     // If the base plan doesn't understand why we stopped, then we have to find a plan that does.
     // If that plan is still working, then we don't need to do any more work.  If the plan that explains 

Modified: lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepRange.cpp?rev=155259&r1=155258&r2=155259&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepRange.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepRange.cpp Fri Apr 20 18:53:43 2012
@@ -368,6 +368,9 @@
         case eStopReasonBreakpoint:
             if (NextRangeBreakpointExplainsStop(stop_info_sp))
                 return true;
+            else
+                return false;
+            break;
         case eStopReasonWatchpoint:
         case eStopReasonSignal:
         case eStopReasonException:

Modified: lldb/branches/lldb-platform-work/test/functionalities/load_unload/TestLoadUnload.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/load_unload/TestLoadUnload.py?rev=155259&r1=155258&r2=155259&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/load_unload/TestLoadUnload.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/load_unload/TestLoadUnload.py Fri Apr 20 18:53:43 2012
@@ -222,6 +222,33 @@
         self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
             substrs = [' resolved, hit count = 2'])
 
+    def test_step_over_load (self):
+        """Test stepping over code that loads a shared library works correctly."""
+
+        # Invoke the default build rule.
+        self.buildDefault()
+
+        exe = os.path.join(os.getcwd(), "a.out")
+        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+        # Break by function name a_function (not yet loaded).
+        self.expect("breakpoint set -f main.c -l %d"%(self.line), BREAKPOINT_CREATED,
+            substrs = ['Breakpoint created:',
+                      "file ='main.c', line = %d, locations = 1"%(self.line)])
+
+        self.runCmd("run", RUN_SUCCEEDED)
+
+        # The stop reason of the thread should be breakpoint and at a_function.
+        self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+            substrs = ['stopped',
+                       'stop reason = breakpoint'])
+
+        self.runCmd("thread step-over", "Stepping over function that loads library")
+        
+        # The stop reason should be step end.
+        self.expect("thread list", "step over succeeded.", 
+            substrs = ['stopped',
+                      'stop reason = step over'])
 
 if __name__ == '__main__':
     import atexit





More information about the lldb-commits mailing list