Otherwise debug-info is stripped, which influences the language of the
current frame.
Also, set explicit breakpoint because Windows seems to not obey the
debugtrap.
Log from failing test on Windows:
```
(lldb) command source -s 0 'lit-lldb-init-quiet'
Executing commands in 'D:\test\lit-lldb-init-quiet'.
(lldb) command source -C --silent-run true lit-lldb-init
(lldb) target create "main.out"
Current executable set to 'D:\test\main.out' (x86_64).
(lldb) settings set interpreter.stop-command-source-on-error false
(lldb) command source -s 0 'with-target.input'
Executing commands in 'D:\test\with-target.input'.
(lldb) expr blah
^
error: use of undeclared identifier 'blah'
note: Falling back to default language. Ran expression as 'Objective C++'.
(lldb) run
Process 29404 launched: 'D:\test\main.out' (x86_64)
Process 29404 stopped
* thread #1, stop reason = Exception 0x80000003 encountered at address 0x7ff7b3df7189
frame #0: 0x00007ff7b3df718a main.out
-> 0x7ff7b3df718a: xorl %eax, %eax
0x7ff7b3df718c: popq %rcx
0x7ff7b3df718d: retq
0x7ff7b3df718e: int3
(lldb) expr blah
^
error: use of undeclared identifier 'blah'
note: Falling back to default language. Ran expression as 'Objective C++'.
(lldb) expr -l objc -- blah
^
error: use of undeclared identifier 'blah'
note: Expression evaluation in pure Objective-C not supported. Ran expression as 'Objective C++'.
(lldb) expr -l c -- blah
^
error: use of undeclared identifier 'blah'
note: Expression evaluation in pure C not supported. Ran expression as 'ISO C++'.
```
91 lines
2.1 KiB
Plaintext
91 lines
2.1 KiB
Plaintext
# REQUIRES: (system-windows && lld) || !system-windows
|
|
|
|
# RUN: split-file %s %t
|
|
# RUN: %clang_host -g %t/main.cpp -o %t.out
|
|
#
|
|
# RUN: %lldb -x -b -o "settings set interpreter.stop-command-source-on-error false" \
|
|
# RUN: -s %t/no-target.input 2>&1 | FileCheck %s --check-prefix=CHECK-NO-TARGET
|
|
#
|
|
# RUN: %lldb %t.out -x -b -o "settings set interpreter.stop-command-source-on-error false" \
|
|
# RUN: -s %t/with-target.input 2>&1 | FileCheck %s --check-prefix=CHECK-TARGET
|
|
|
|
#--- main.cpp
|
|
|
|
int main() {
|
|
int x = 10;
|
|
return x;
|
|
}
|
|
|
|
#--- with-target.input
|
|
|
|
expr blah
|
|
|
|
# CHECK-TARGET: (lldb) expr
|
|
# CHECK-TARGET: note: Falling back to default language. Ran expression as 'Objective C++'.
|
|
|
|
b 4
|
|
run
|
|
|
|
expr blah
|
|
|
|
# CHECK-TARGET: (lldb) expr
|
|
# CHECK-TARGET: note: Ran expression as 'C++{{.*}}'
|
|
|
|
expr -l objc -- blah
|
|
|
|
# CHECK-TARGET: (lldb) expr
|
|
# CHECK-TARGET: note: Expression evaluation in pure Objective-C not supported. Ran expression as 'Objective C++'.
|
|
|
|
expr -l c -- blah
|
|
|
|
# CHECK-TARGET: (lldb) expr
|
|
# CHECK-TARGET: note: Expression evaluation in pure C not supported. Ran expression as 'ISO C++'.
|
|
|
|
expr -l c++14 -- blah
|
|
|
|
# CHECK-TARGET: (lldb) expr
|
|
# CHECK-TARGET: note: Ran expression as 'C++14'
|
|
|
|
expr -l c++20 -- blah
|
|
|
|
# CHECK-TARGET: (lldb) expr
|
|
# CHECK-TARGET: note: Ran expression as 'C++20'
|
|
|
|
expr -l objective-c++ -- blah
|
|
|
|
# CHECK-TARGET: (lldb) expr
|
|
# CHECK-TARGET: note: Ran expression as 'Objective C++'
|
|
|
|
# D uses TypeSystemClang but running expressions in it isn't supported. Test that we warn about this.
|
|
expr -l D -- blah
|
|
|
|
# CHECK-TARGET: (lldb) expr
|
|
# CHECK-TARGET: note: Expression evaluation in D not supported. Falling back to default language. Ran expression as 'Objective C++'.
|
|
|
|
expr -l c++17 -- x = 5
|
|
|
|
# CHECK-TARGET: (lldb) expr
|
|
# CHECK-TARGET-NOT: note:
|
|
|
|
expr x = 5
|
|
|
|
# CHECK-TARGET: (lldb) expr
|
|
# CHECK-TARGET-NOT: note:
|
|
|
|
#--- no-target.input
|
|
|
|
expr blah
|
|
|
|
# CHECK-NO-TARGET: (lldb) expr
|
|
# CHECK-NO-TARGET: note: Falling back to default language. Ran expression as 'Objective C++'.
|
|
|
|
expr -l c++ -- 1 + 1
|
|
|
|
# CHECK-NO-TARGET: (lldb) expr
|
|
# CHECK-NO-TARGET-NOT: note:
|
|
|
|
expr 1 + 1
|
|
|
|
# CHECK-NO-TARGET: (lldb) expr
|
|
# CHECK-NO-TARGET-NOT: note:
|