diff options
| author | Jeffrey Tan <jeffreytan@fb.com> | 2023-02-03 17:09:09 -0800 |
|---|---|---|
| committer | Jeffrey Tan <jeffreytan@fb.com> | 2023-03-07 14:48:15 -0800 |
| commit | b461398f1ce307ec80708b7eb50f3bc82b76ed3f (patch) | |
| tree | ad2231b14096485f58091b68490b4436615f32af /lldb/test/API/python_api | |
| parent | 6e2ade23c7944a09241d6cafe559f05b39cb17e8 (diff) | |
| download | llvm-b461398f1ce307ec80708b7eb50f3bc82b76ed3f.zip llvm-b461398f1ce307ec80708b7eb50f3bc82b76ed3f.tar.gz llvm-b461398f1ce307ec80708b7eb50f3bc82b76ed3f.tar.bz2 | |
Add a new SBDebugger::SetDestroyCallback() API
Adding a new SBDebugger::SetDestroyCallback() API.
This API can be used by any client to query for statistics/metrics before
exiting debug sessions.
Differential Revision: https://reviews.llvm.org/D143520
Diffstat (limited to 'lldb/test/API/python_api')
| -rw-r--r-- | lldb/test/API/python_api/debugger/TestDebuggerAPI.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py index 6bc6b3b..dcc8e24 100644 --- a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py +++ b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py @@ -30,7 +30,7 @@ class DebuggerAPITestCase(TestBase): self.dbg.SetPrompt(None) self.dbg.SetCurrentPlatform(None) self.dbg.SetCurrentPlatformSDKRoot(None) - + fresh_dbg = lldb.SBDebugger() self.assertEquals(len(fresh_dbg), 0) @@ -146,3 +146,16 @@ class DebuggerAPITestCase(TestBase): self.assertEqual(platform2.GetName(), expected_platform) self.assertTrue(platform2.GetWorkingDirectory().endswith("bar"), platform2.GetWorkingDirectory()) + + def test_SetDestroyCallback(self): + destroy_dbg_id = None + def foo(dbg_id): + # Need nonlocal to modify closure variable. + nonlocal destroy_dbg_id + destroy_dbg_id = dbg_id + + self.dbg.SetDestroyCallback(foo) + + original_dbg_id = self.dbg.GetID() + self.dbg.Destroy(self.dbg) + self.assertEqual(destroy_dbg_id, original_dbg_id) |
