[Lldb-commits] [lldb] r129867 - in /lldb/trunk: include/lldb/Core/SourceManager.h source/Commands/CommandObjectSource.cpp

Greg Clayton gclayton at apple.com
Wed Apr 20 11:52:45 PDT 2011


Author: gclayton
Date: Wed Apr 20 13:52:45 2011
New Revision: 129867

URL: http://llvm.org/viewvc/llvm-project?rev=129867&view=rev
Log:
Fixed an issue where breakpoint were being displayed when using the "source list"
command when the file was implicit or found from a symbol.


Modified:
    lldb/trunk/include/lldb/Core/SourceManager.h
    lldb/trunk/source/Commands/CommandObjectSource.cpp

Modified: lldb/trunk/include/lldb/Core/SourceManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/SourceManager.h?rev=129867&r1=129866&r2=129867&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/SourceManager.h (original)
+++ lldb/trunk/include/lldb/Core/SourceManager.h Wed Apr 20 13:52:45 2011
@@ -47,6 +47,12 @@
         bool
         FileSpecMatches (const FileSpec &file_spec);
 
+        const FileSpec &
+        GetFileSpec ()
+        {
+            return m_file_spec;
+        }
+
     protected:
 
         bool
@@ -73,6 +79,12 @@
     FileSP
     GetFile (const FileSpec &file_spec);
 
+    FileSP
+    GetLastFile () 
+    {
+        return m_last_file_sp;
+    }
+
     size_t
     DisplaySourceLines (const FileSpec &file,
                         uint32_t line,

Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=129867&r1=129866&r2=129867&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSource.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSource.cpp Wed Apr 20 13:52:45 2011
@@ -417,13 +417,25 @@
             
             char path_buf[PATH_MAX];
             start_file.GetPath(path_buf, sizeof(path_buf));
+            
+            if (m_options.show_bp_locs && exe_ctx.target)
+            {
+                const bool show_inlines = true;
+                m_breakpoint_locations.Reset (start_file, 0, show_inlines);
+                SearchFilter target_search_filter (exe_ctx.target->GetSP());
+                target_search_filter.Search (m_breakpoint_locations);
+            }
+            else
+                m_breakpoint_locations.Clear();
+
             result.AppendMessageWithFormat("File: %s.\n", path_buf);
             m_interpreter.GetDebugger().GetSourceManager().DisplaySourceLinesWithLineNumbers (start_file,
                                                                                               line_no,
                                                                                               0,
                                                                                               m_options.num_lines,
                                                                                               "",
-                                                                                              &result.GetOutputStream());
+                                                                                              &result.GetOutputStream(),
+                                                                                              GetBreakpointLocations ());
             
             result.SetStatus (eReturnStatusSuccessFinishResult);
             return true;
@@ -445,6 +457,20 @@
             }
             else
             {
+                if (m_options.show_bp_locs && exe_ctx.target)
+                {
+                    SourceManager::FileSP last_file_sp (m_interpreter.GetDebugger().GetSourceManager().GetLastFile ());
+                    if (last_file_sp)
+                    {
+                        const bool show_inlines = true;
+                        m_breakpoint_locations.Reset (last_file_sp->GetFileSpec(), 0, show_inlines);
+                        SearchFilter target_search_filter (exe_ctx.target->GetSP());
+                        target_search_filter.Search (m_breakpoint_locations);
+                    }
+                }
+                else
+                    m_breakpoint_locations.Clear();
+
                 if (m_interpreter.GetDebugger().GetSourceManager().DisplaySourceLinesWithLineNumbersUsingLastFile(
                             m_options.start_line,   // Line to display
                             0,                      // Lines before line to display





More information about the lldb-commits mailing list