[Lldb-commits] [PATCH] D107126: [source map] fix relative path breakpoints

walter erquinigo via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 29 18:17:57 PDT 2021


wallace created this revision.
wallace added a reviewer: clayborg.
wallace requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

https://reviews.llvm.org/D45592 added a nice feature to be able to specify a breakpoint by a relative path. E.g. passing foo.cpp or bar/foo.cpp or zaz/bar/foo.cpp is fine. However, https://reviews.llvm.org/D68671 by mistake disabled the test that ensured this functionality works. With time, someone made a small mistake and fully broke the functionality.

So, I'm making a very simple fix and the test passes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107126

Files:
  lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
  lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py


Index: lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
===================================================================
--- lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
+++ lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
@@ -18,7 +18,7 @@
 
     @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528")
     @skipIfReproducer # side_effect bypasses reproducer
-    def not_test_breakpoint_command_sequence(self):
+    def test_breakpoint_command_sequence(self):
         """Test a sequence of breakpoint command add, list, and delete."""
         self.build()
         self.breakpoint_command_sequence()
@@ -302,7 +302,7 @@
         bp_id_1 = bp_1.GetID()
         bp_id_2 = bp_2.GetID()
         bp_id_3 = bp_3.GetID()
-        
+
         self.runCmd("breakpoint delete --disabled DeleteMeNot")
 
         bp_1 = target.FindBreakpointByID(bp_id_1)
@@ -320,7 +320,7 @@
         bp_1.SetEnabled(False)
 
         bp_id_1 = bp_1.GetID()
-        
+
         self.runCmd("breakpoint delete --disabled")
 
         bp_1 = target.FindBreakpointByID(bp_id_1)
@@ -331,4 +331,3 @@
 
         bp_3 = target.FindBreakpointByID(bp_id_3)
         self.assertFalse(bp_3.IsValid(), "Didn't delete disabled breakpoint 3")
-        
Index: lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
===================================================================
--- lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
+++ lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
@@ -188,7 +188,7 @@
     // is 0, then we can't do this calculation.  That can happen if
     // GetStartLineSourceInfo gets an error, or if the first line number in
     // the function really is 0 - which happens for some languages.
-    
+
     // But only do this calculation if the line number we found in the SC
     // was different from the one requested in the source file.  If we actually
     // found an exact match it must be valid.
@@ -233,14 +233,18 @@
   const bool is_relative = search_file_spec.IsRelative();
   if (is_relative)
     search_file_spec.GetDirectory().Clear();
+  SourceLocationSpec search_location_spec(
+      search_file_spec, m_location_spec.GetLine().getValueOr(0),
+      m_location_spec.GetColumn(), m_location_spec.GetCheckInlines(),
+      m_location_spec.GetExactMatch());
 
   const size_t num_comp_units = context.module_sp->GetNumCompileUnits();
   for (size_t i = 0; i < num_comp_units; i++) {
     CompUnitSP cu_sp(context.module_sp->GetCompileUnitAtIndex(i));
     if (cu_sp) {
       if (filter.CompUnitPasses(*cu_sp))
-        cu_sp->ResolveSymbolContext(m_location_spec, eSymbolContextEverything,
-                                    sc_list);
+        cu_sp->ResolveSymbolContext(search_location_spec,
+                                    eSymbolContextEverything, sc_list);
     }
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107126.362942.patch
Type: text/x-patch
Size: 2934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210730/d7b811c0/attachment-0001.bin>


More information about the lldb-commits mailing list