1 // REQUIRES: lldb
2 // UNSUPPORTED: system-windows
3 // RUN: %dexter --fail-lt 1.0 -w --debugger lldb \
4 // RUN: --builder clang-c --cflags "-O2 -glldb" -- %s
5
6 //// Check that we give good locations to a variable ('local') which is escaped
7 //// down some control paths and not others. This example is handled well currently.
8
9 int g;
10 __attribute__((__noinline__))
leak(int * ptr)11 void leak(int *ptr) {
12 g = *ptr;
13 *ptr = 2;
14 }
15
16 __attribute__((__noinline__))
fun(int cond)17 int fun(int cond) {
18 int local = 0; // DexLabel('s1')
19 if (cond)
20 leak(&local);
21 else
22 local = 1;
23 return local; // DexLabel('s2')
24 }
25
main()26 int 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='s1')
34 // DexExpectWatchValue('local', '2', '1', on_line='s2')
35