aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@fb.com>2024-02-06 13:53:29 -0800
committerGitHub <noreply@github.com>2024-02-06 13:53:29 -0800
commit1dd9162b95d29367635f32c7be24779b1ddaa7e5 (patch)
treed7edb3218e142357b2c1876d6029c1c21573736b /lldb/test/API/python_api
parentc8a97c0f30f3da86e892bf68d572068634994a1e (diff)
downloadllvm-1dd9162b95d29367635f32c7be24779b1ddaa7e5.zip
llvm-1dd9162b95d29367635f32c7be24779b1ddaa7e5.tar.gz
llvm-1dd9162b95d29367635f32c7be24779b1ddaa7e5.tar.bz2
[lldb] Fix a crasher when using the public API. (#80508)
A user found a crash when they would do code like: ``` (lldb) script >>> target = lldb.SBTarget() >>> lldb.debugger.SetSelectedTarget(target) ``` We were not checking if the target was valid in and it caused a crash..
Diffstat (limited to 'lldb/test/API/python_api')
-rw-r--r--lldb/test/API/python_api/target/TestTargetAPI.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lldb/test/API/python_api/target/TestTargetAPI.py b/lldb/test/API/python_api/target/TestTargetAPI.py
index c8e1904..63d3434 100644
--- a/lldb/test/API/python_api/target/TestTargetAPI.py
+++ b/lldb/test/API/python_api/target/TestTargetAPI.py
@@ -526,3 +526,9 @@ class TargetAPITestCase(TestBase):
target.IsLoaded(module),
"Running the target should " "have loaded its modules.",
)
+
+ @no_debug_info_test
+ def test_setting_selected_target_with_invalid_target(self):
+ """Make sure we don't crash when trying to select invalid target."""
+ target = lldb.SBTarget()
+ self.dbg.SetSelectedTarget(target)