Change the "breakpoint fuzz" algorithm from "coalesce the line ranges for a file...
authorJim Ingham <jingham@apple.com>
Tue, 10 Sep 2013 02:06:17 +0000 (02:06 +0000)
committerJim Ingham <jingham@apple.com>
Tue, 10 Sep 2013 02:06:17 +0000 (02:06 +0000)
"coalesce the line ranges for a file & line breakpoint to the first range in each block".  We were still setting a silly number
of independent breakpoints sometimes, and until we get a compiler that emits trustworthy is_stmt flags in the line table, we
need to do something to reduce the noise.

<rdar://problem/14920404>

llvm-svn: 190380

lldb/source/Breakpoint/BreakpointResolverFileLine.cpp

index 91a218f..005253d 100644 (file)
@@ -140,21 +140,20 @@ BreakpointResolverFileLine::SearchCallback
         // Next go through and see if there are line table entries that are contiguous, and if so keep only the
         // first of the contiguous range:
         
-        lldb::addr_t last_end_addr = LLDB_INVALID_ADDRESS;
         current_idx = 0;
+        std::map<Block *, lldb::addr_t> blocks_with_breakpoints;
+        
         while (current_idx < tmp_sc_list.GetSize())
         {
             if (tmp_sc_list.GetContextAtIndex(current_idx, sc))
             {
-                lldb::addr_t start_file_addr = sc.line_entry.range.GetBaseAddress().GetFileAddress();
-                lldb::addr_t end_file_addr   = start_file_addr + sc.line_entry.range.GetByteSize();
-                
-                if (start_file_addr == last_end_addr)
+                if (blocks_with_breakpoints.find (sc.block) != blocks_with_breakpoints.end())
                     tmp_sc_list.RemoveContextAtIndex(current_idx);
                 else
+                {
+                    blocks_with_breakpoints.insert (std::pair<Block *, lldb::addr_t>(sc.block, sc.line_entry.range.GetBaseAddress().GetFileAddress()));
                     current_idx++;
-
-                last_end_addr = end_file_addr;
+                }
             }
         }