1 // XFAIL:*
2 //// We don't yet support DW_OP_implicit_pointer in llvm.
3 
4 // REQUIRES: lldb
5 // UNSUPPORTED: system-windows
6 // RUN: %dexter --fail-lt 1.0 -w --debugger lldb \
7 // RUN:     --builder 'clang-c'  --cflags "-O3 -glldb" -- %s
8 
9 //// Check that 'param' in 'fun' can be read throughout, and that 'pa' and 'pb'
10 //// can be dereferenced in the debugger even if we can't provide the pointer
11 //// value itself.
12 
13 int globa;
14 int globb;
15 
16 //// A no-inline, read-only function with internal linkage is a good candidate
17 //// for arg promotion.
18 __attribute__((__noinline__))
use_promote(const int * pa)19 static void use_promote(const int* pa) {
20   //// Promoted args would be a good candidate for an DW_OP_implicit_pointer.
21   globa = *pa; // DexLabel('s2')
22 }
23 
24 __attribute__((__always_inline__))
use_inline(const int * pb)25 static void use_inline(const int* pb) {
26   //// Inlined pointer to callee local would be a good candidate for an
27   //// DW_OP_implicit_pointer.
28   globb = *pb; // DexLabel('s3')
29 }
30 
31 __attribute__((__noinline__))
fun(int param)32 int fun(int param) {
33   volatile int step = 0;   // DexLabel('s1')
34   use_promote(&param);
35   use_inline(&param);
36   return step;             // DexLabel('s4')
37 }
38 
main()39 int main() {
40   return fun(5);
41 }
42 
43 // DexExpectWatchValue('param', 5, from_line='s1', to_line='s4')
44 // DexExpectWatchValue('*pa', 5, on_line='s2')
45 // DexExpectWatchValue('*pb', 5, on_line='s3')
46