35 lines · c
1// REQUIRES: lldb2// UNSUPPORTED: system-windows3// RUN: %clang -std=gnu11 -O2 -glldb %s -o %t4// RUN: %dexter --fail-lt 1.0 -w %dexter_lldb_args --binary %t -- %s5 6//// Check that we give good locations to a variable ('local') which is escaped7//// down some control paths and not others. This example is handled well currently.8 9int g;10__attribute__((__noinline__))11void leak(int *ptr) {12 g = *ptr;13 *ptr = 2;14}15 16__attribute__((__noinline__))17int fun(int cond) {18 int local = 0; // DexLabel('s1')19 if (cond)20 leak(&local);21 else22 local = 1;23 return local; // DexLabel('s2')24}25 26int main() {27 int a = fun(1);28 int b = fun(0);29 return a + b;30}31 32//// fun(1) fun(0)33// DexExpectWatchValue('local', '0', '0', on_line=ref('s1'))34// DexExpectWatchValue('local', '2', '1', on_line=ref('s2'))35