| 1 | // XFAIL:* |
| 2 | //// Currently debug info for 'local' behaves, but 'plocal' dereferences to |
| 3 | //// the incorrect value 0xFF after the call to esc. |
| 4 | |
| 5 | // REQUIRES: lldb |
| 6 | // UNSUPPORTED: system-windows |
| 7 | // RUN: %clang -std=gnu11 -O2 -glldb %s -o %t |
| 8 | // RUN: %dexter --fail-lt 1.0 -w --debugger lldb --binary %t -- %s |
| 9 | // |
| 10 | //// Check that a pointer to a variable living on the stack dereferences to the |
| 11 | //// variable value. |
| 12 | |
| 13 | int glob; |
| 14 | __attribute__((__noinline__)) |
| 15 | void esc(int* p) { |
| 16 | glob = *p; |
| 17 | *p = 0xFF; |
| 18 | } |
| 19 | |
| 20 | int main() { |
| 21 | int local = 0xA; |
| 22 | int *plocal = &local; |
| 23 | esc(p: plocal); // DexLabel('s1') |
| 24 | local = 0xB; //// DSE |
| 25 | return 0; // DexLabel('s2') |
| 26 | } |
| 27 | |
| 28 | |
| 29 | // DexExpectWatchValue('local', 0xA, on_line=ref('s1')) |
| 30 | // DexExpectWatchValue('local', 0xB, on_line=ref('s2')) |
| 31 | // DexExpectWatchValue('*plocal', 0xA, on_line=ref('s1')) |
| 32 | // DexExpectWatchValue('*plocal', 0xB, on_line=ref('s2')) |
| 33 | //// Ideally we should be able to observe the dead store to local (0xB) through |
| 34 | //// plocal here. |
| 35 | // DexExpectWatchValue('(local == *plocal)', 'true', from_line=ref('s1'), to_line=ref('s2')) |
| 36 | |