[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:22:12 PDT 2021


wallace updated this revision to Diff 362943.
wallace added a comment.
Herald added a subscriber: JDevlieghere.

add a comment


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107126/new/

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.
@@ -229,18 +229,25 @@
   const uint32_t line = m_location_spec.GetLine().getValueOr(0);
   const llvm::Optional<uint16_t> column = m_location_spec.GetColumn();
 
+  // We'll create a new SourceLocationSpec that can take into account the
+  // relative path case, and we'll use it to resolve the symbol context
+  // of the CUs.
   FileSpec search_file_spec = m_location_spec.GetFileSpec();
   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.362943.patch
Type: text/x-patch
Size: 3302 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210730/f3d54ed9/attachment.bin>


More information about the lldb-commits mailing list