aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/Shell/ScriptInterpreter/Python
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test/Shell/ScriptInterpreter/Python')
-rw-r--r--lldb/test/Shell/ScriptInterpreter/Python/Inputs/sbaddress.py7
-rw-r--r--lldb/test/Shell/ScriptInterpreter/Python/sb_address_exception.test8
2 files changed, 15 insertions, 0 deletions
diff --git a/lldb/test/Shell/ScriptInterpreter/Python/Inputs/sbaddress.py b/lldb/test/Shell/ScriptInterpreter/Python/Inputs/sbaddress.py
new file mode 100644
index 0000000..132d284
--- /dev/null
+++ b/lldb/test/Shell/ScriptInterpreter/Python/Inputs/sbaddress.py
@@ -0,0 +1,7 @@
+import lldb
+
+def test(debugger, command, result, internal_dict):
+ return int(lldb.SBAddress())
+
+def __lldb_init_module(debugger, internal_dict):
+ debugger.HandleCommand('command script add -f sbaddress.test test')
diff --git a/lldb/test/Shell/ScriptInterpreter/Python/sb_address_exception.test b/lldb/test/Shell/ScriptInterpreter/Python/sb_address_exception.test
new file mode 100644
index 0000000..ffcec11
--- /dev/null
+++ b/lldb/test/Shell/ScriptInterpreter/Python/sb_address_exception.test
@@ -0,0 +1,8 @@
+# REQUIRES: python
+# UNSUPPORTED: lldb-repro
+#
+# Test that the SBAddress properties throw an exception when used outside of
+# the interactive script interpreter.
+#
+# RUN: %lldb --script-language python -o 'command script import %S/Inputs/sbaddress.py' -o 'test' 2>&1 | FileCheck %s
+# CHECK: RuntimeError: This resolves the SBAddress using the SBTarget from lldb.target so this property can ONLY be used in the interactive script interpreter (i.e. under the lldb script command). For things like Python based commands and breakpoint callbacks use GetLoadAddress instead.