[Lldb-commits] [lldb] r339182 - If a function starts with line number 0, don't try to check if a breakpoint crossed function boundaries.
Jim Ingham via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 7 14:09:56 PDT 2018
Author: jingham
Date: Tue Aug 7 14:09:55 2018
New Revision: 339182
URL: http://llvm.org/viewvc/llvm-project?rev=339182&view=rev
Log:
If a function starts with line number 0, don't try to check if a breakpoint crossed function boundaries.
clang doesn't use line number 0 (to mean artifically generated code) very often, but swift does it
quite often. We were rejecting all by line breakpoints in functions that started at line 0. But that's
a special marker so we can just not do this test in that case.
Modified:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/TestMoveNearest.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/main.cpp
lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/TestMoveNearest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/TestMoveNearest.py?rev=339182&r1=339181&r2=339182&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/TestMoveNearest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/TestMoveNearest.py Tue Aug 7 14:09:55 2018
@@ -18,6 +18,8 @@ class TestMoveNearest(TestBase):
# Find the line number to break inside main().
self.line1 = line_number('foo.h', '// !BR1')
self.line2 = line_number('foo.h', '// !BR2')
+ self.line_between = line_number('main.cpp', "// BR_Between")
+ print("BR_Between found at", self.line_between)
self.line_main = line_number('main.cpp', '// !BR_main')
def test(self):
@@ -61,3 +63,7 @@ class TestMoveNearest(TestBase):
# "return .."
lldbutil.run_break_set_by_file_and_line(self, 'main.cpp',
self.line_main+2, extra_options="-m 1")
+
+ # Make sure we don't put move the breakpoint if it is set between two functions:
+ lldbutil.run_break_set_by_file_and_line(self, 'main.cpp',
+ self.line_between, extra_options="-m 1", num_expected_locations=0)
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/main.cpp?rev=339182&r1=339181&r2=339182&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/main.cpp (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/main.cpp Tue Aug 7 14:09:55 2018
@@ -1,7 +1,7 @@
#include "foo.h"
int call_foo2() { return foo2(); }
-
+// BR_Between
int
main() // !BR_main
{
Modified: lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp?rev=339182&r1=339181&r2=339182&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp Tue Aug 7 14:09:55 2018
@@ -181,8 +181,12 @@ void BreakpointResolverFileLine::FilterC
// inline int foo2() { ... }
//
// but that's the best we can do for now.
+ // One complication, if the line number returned from GetStartLineSourceInfo
+ // 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.
const int decl_line_is_too_late_fudge = 1;
- if (m_line_number < line - decl_line_is_too_late_fudge) {
+ if (line && m_line_number < line - decl_line_is_too_late_fudge) {
LLDB_LOG(log, "removing symbol context at {0}:{1}", file, line);
sc_list.RemoveContextAtIndex(i);
--i;
More information about the lldb-commits
mailing list