| 1 | // XFAIL:* |
| 2 | //// We don't yet support DW_OP_implicit_pointer in llvm. |
| 3 | |
| 4 | // REQUIRES: lldb |
| 5 | // UNSUPPORTED: system-windows |
| 6 | // RUN: %clang -std=gnu11 -O3 -glldb %s -o %t |
| 7 | // RUN: %dexter --fail-lt 1.0 -w --debugger lldb --binary %t -- %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__)) |
| 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__)) |
| 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__)) |
| 32 | int fun(int param) { |
| 33 | volatile int step = 0; // DexLabel('s1') |
| 34 | use_promote(pa: ¶m); |
| 35 | use_inline(pb: ¶m); |
| 36 | return step; // DexLabel('s4') |
| 37 | } |
| 38 | |
| 39 | int main() { |
| 40 | return fun(param: 5); |
| 41 | } |
| 42 | |
| 43 | // DexExpectWatchValue('param', 5, from_line=ref('s1'), to_line=ref('s4')) |
| 44 | // DexExpectWatchValue('*pa', 5, on_line=ref('s2')) |
| 45 | // DexExpectWatchValue('*pb', 5, on_line=ref('s3')) |
| 46 | |