diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp --- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp +++ b/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 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); } } diff --git a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py --- a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py +++ b/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") -