aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/Shell/ScriptInterpreter/Python/bytecode.test
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2024-10-22 16:29:50 -0700
committerAdrian Prantl <aprantl@apple.com>2024-12-06 16:27:16 -0800
commitfffe8c668461e73055182f229765cb7de908e295 (patch)
tree4cc3363546bf6be86f33a3ac2e40d02239b44bd3 /lldb/test/Shell/ScriptInterpreter/Python/bytecode.test
parentb504c8771f238883ef6c7234d741c2dc1d885ae3 (diff)
downloadllvm-fffe8c668461e73055182f229765cb7de908e295.zip
llvm-fffe8c668461e73055182f229765cb7de908e295.tar.gz
llvm-fffe8c668461e73055182f229765cb7de908e295.tar.bz2
[lldb] Add a compiler/interpreter of LLDB data formatter bytecode to examples
This PR adds a proof-of-concept for a bytecode designed to ship and run LLDB data formatters. More motivation and context can be found in the formatter-bytecode.rst file and on discourse. https://discourse.llvm.org/t/a-bytecode-for-lldb-data-formatters/82696 Relanding with a fix for a case-sensitive path.
Diffstat (limited to 'lldb/test/Shell/ScriptInterpreter/Python/bytecode.test')
-rw-r--r--lldb/test/Shell/ScriptInterpreter/Python/bytecode.test16
1 files changed, 16 insertions, 0 deletions
diff --git a/lldb/test/Shell/ScriptInterpreter/Python/bytecode.test b/lldb/test/Shell/ScriptInterpreter/Python/bytecode.test
new file mode 100644
index 0000000..2745680
--- /dev/null
+++ b/lldb/test/Shell/ScriptInterpreter/Python/bytecode.test
@@ -0,0 +1,16 @@
+# RUN: %python %S/../../../../examples/python/formatter_bytecode.py --test
+# RUN: %python %S/../../../../examples/python/formatter_bytecode.py --compile "1u dup" | FileCheck %s --check-prefix=COMPILE
+# RUN: %python %S/../../../../examples/python/formatter_bytecode.py --disassemble "200101" | FileCheck %s --check-prefix=DISASSEMBLE
+# COMPILE: 200101
+# DISASSEMBLE: 1u dup
+
+# RUN: %clang_host -std=c++17 -g %S/Inputs/FormatterBytecode/MyOptional.cpp -o %t.exe
+# RUN: %lldb %t.exe -o "command script import %S/../../../../examples/python/formatter_bytecode.py" -o "command script import %S/Inputs/FormatterBytecode/formatter.py" -o "b -p here" -o "r" -o "v x" -o "v y" -o q | FileCheck %s --check-prefix=OPTIONAL
+# OPTIONAL: (lldb) v x
+# OPTIONAL: (MyOptional<int>) x = {
+# OPTIONAL: hasVal = false
+# OPTIONAL: }
+# OPTIONAL: (lldb) v y
+# OPTIONAL: (MyOptional<int>) y = {
+# OPTIONAL: Storage = (value = 42, hasVal = true)
+# OPTIONAL: }