| 1 |
// REQUIRES: lldb |
| 2 |
// UNSUPPORTED: system-windows |
| 3 |
// RUN: %clang -std=gnu11 -O2 -glldb %s -o %t |
| 4 |
// RUN: %dexter --fail-lt 1.0 -w %dexter_lldb_args --binary %t -- %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__)) |
| 11 |
void leak(int *ptr) { |
| 12 |
g = *ptr; |
| 13 |
*ptr = 2; |
| 14 |
} |
| 15 |
|
| 16 |
__attribute__((__noinline__)) |
| 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 |
|
| 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=ref('s1')) |
| 34 |
// DexExpectWatchValue('local', '2', '1', on_line=ref('s2')) |