[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 18 11:06:20 PDT 2024


================
@@ -357,3 +363,61 @@ def step_in_template(self):
 
         step_sequence = [["// In max_value specialized", "into"]]
         self.run_step_sequence(step_sequence)
+
+    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
+        )
+
+        # 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()
+        result = bkpt_loc.GetDescription(strm, lldb.eDescriptionLevelFull)
+
+        self.assertTrue(result, "Got a location description")
+        desc = strm.GetData()
+        print(f"Description:\n{desc}\n")
----------------
adrian-prantl wrote:

should this be `if self.TraceOn():`?

https://github.com/llvm/llvm-project/pull/112939


More information about the lldb-commits mailing list