[Lldb-commits] [lldb] [lldb] Handle accelerator plugin breakpoint actions on the client (PR #201489)
satyanarayana reddy janga via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 5 07:22:25 PDT 2026
================
@@ -0,0 +1,92 @@
+"""
+End-to-end test for accelerator plugin breakpoints.
+
+Launches a real process against an lldb-server that has the mock accelerator
+plugin enabled and verifies that the breakpoints requested by the plugin are
+set in the native process, hit, and that hitting one breakpoint can request
+further breakpoints. This exercises all three breakpoint types: by name, by
+name scoped to a shared library, and by address.
+"""
+
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import configuration
+
+
+class MockAcceleratorBreakpointsTestCase(TestBase):
+ NO_DEBUG_INFO_TESTCASE = True
+
+ def setUp(self):
+ super().setUp()
+ if "mock-accelerator" not in configuration.enabled_plugins:
+ self.skipTest("mock-accelerator plugin is not enabled")
+
+ def check_accelerator_stop(self, process, function_name):
+ """Verify the process stopped at an internal accelerator breakpoint in
+ the given function, and return that breakpoint."""
+ self.assertState(process.GetState(), lldb.eStateStopped)
+ thread = process.GetSelectedThread()
+
+ # The stop must be due to a breakpoint, and the frame must be in the
+ # expected function.
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonBreakpoint)
+ frame = thread.GetFrameAtIndex(0)
+ self.assertEqual(frame.GetFunctionName(), function_name)
+
+ # The breakpoint id is carried in the stop reason data. Accelerator
+ # breakpoints are internal, so they are not in the public breakpoint
+ # list, but can still be looked up by id.
+ self.assertGreater(thread.GetStopReasonDataCount(), 0)
+ # The stop reason datum is an unsigned 64-bit value; breakpoint ids are
+ # signed 32-bit and internal ids are negative, so reinterpret the low
+ # 32 bits as a signed integer.
+ raw_id = thread.GetStopReasonDataAtIndex(0) & 0xFFFFFFFF
+ bp_id = raw_id - 0x100000000 if raw_id >= 0x80000000 else raw_id
+ bp = process.GetTarget().FindBreakpointByID(bp_id)
+ self.assertTrue(bp.IsValid())
----------------
satyajanga wrote:
>From my understanding, we do not have an SB API get returns the kind.
SBBreakpoint::GetDescription implementation is different the breakpoint kind is not included in there.
We might need a new SBBreakpoint::GetKind or improve the SBBreakpoint::GetDescription to contain the kind. I prefer to do it in a separate patch later. Let me know.
https://github.com/llvm/llvm-project/pull/201489
More information about the lldb-commits
mailing list