[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Oct 18 10:28:39 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r 7da0a698526ff657c2348a6e4bb835fc764177da...9c6705b21df14dc911665e1082c9b31ce00d7e7c lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- TestInlineStepping.py 2024-10-18 17:06:47.000000 +0000
+++ TestInlineStepping.py 2024-10-18 17:28:12.421777 +0000
@@ -367,11 +367,13 @@
def run_to_call_site_and_step(self, source_regex, func_name, start_pos):
main_spec = lldb.SBFileSpec("calling.cpp")
# Set the breakpoint by file and line, not sourced regex because
# we want to make sure we can set breakpoints on call sites:
call_site_line_num = line_number(self.main_source, source_regex)
- target, process, thread, bkpt = lldbutil.run_to_line_breakpoint(self, main_spec, call_site_line_num)
+ target, process, thread, bkpt = lldbutil.run_to_line_breakpoint(
+ self, main_spec, call_site_line_num
+ )
# Make sure that the location is at the call site (run_to_line_breakpoint already asserted
# that there's one location.):
bkpt_loc = bkpt.location[0]
strm = lldb.SBStream()
@@ -381,19 +383,25 @@
desc = strm.GetData()
print(f"Description:\n{desc}\n")
self.assertIn(f"calling.cpp:{call_site_line_num}", desc, "Right line listed")
# We don't get the function name right yet - so we omit it in printing.
# Turn on this test when that is working.
- #self.assertIn(func_name, desc, "Right function listed")
+ # self.assertIn(func_name, desc, "Right function listed")
pc = thread.frame[0].pc
for i in range(start_pos, 3):
thread.StepInto()
frame_0 = thread.frame[0]
-
- trivial_line_num = line_number(self.main_source, f"In caller_trivial_inline_{i}.")
- self.assertEqual(frame_0.line_entry.line, trivial_line_num, f"Stepped into the caller_trivial_inline_{i}")
+
+ trivial_line_num = line_number(
+ self.main_source, f"In caller_trivial_inline_{i}."
+ )
+ self.assertEqual(
+ frame_0.line_entry.line,
+ trivial_line_num,
+ f"Stepped into the caller_trivial_inline_{i}",
+ )
if pc != frame_0.pc:
# If we get here, we stepped to the expected line number, but
# the compiler on this system has decided to insert an instruction
# between the call site of an inlined function with no arguments,
# returning void, and its immediate call to another void inlined function
@@ -405,9 +413,11 @@
target.Clear()
def virtual_inline_stepping(self):
"""Use the Python API's to step through a virtual inlined stack"""
self.run_to_call_site_and_step("At caller_trivial_inline_1", "main", 1)
- self.run_to_call_site_and_step("In caller_trivial_inline_1", "caller_trivial_inline_1", 2)
- self.run_to_call_site_and_step("In caller_trivial_inline_2", "caller_trivial_inline_2", 3)
-
-
+ self.run_to_call_site_and_step(
+ "In caller_trivial_inline_1", "caller_trivial_inline_1", 2
+ )
+ self.run_to_call_site_and_step(
+ "In caller_trivial_inline_2", "caller_trivial_inline_2", 3
+ )
``````````
</details>
https://github.com/llvm/llvm-project/pull/112939
More information about the lldb-commits
mailing list