llvm-project/lldb/test/Shell/ScriptInterpreter/Python/sb_address_exception.test
Jonas Devlieghere 0800529fe6 [lldb/Bindings] Raise exception when using properties that rely on lldb.target
Several SBAddress properties use the lldb.target or lldb.process
convenience variables which are only set under the interactive script
interpreter. Unfortunately, users have been using these properties in
Python script and commands. This patch raises a Python exception to
force users to use GetLoadAddress instead.

Differential revision: https://reviews.llvm.org/D80848
2020-05-29 22:11:21 -07:00

9 lines
570 B
Plaintext

# 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.