1 | // XFAIL:* |
2 | //// Currently, LowerDbgDeclare doesn't lower dbg.declares pointing at allocas |
3 | //// for structs. |
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 debug-info for the escaped struct variable num is reasonable. |
11 | |
12 | #include <stdio.h> |
13 | struct Nums { |
14 | int a, b, c, d, e, f, g, h, i, j; |
15 | }; |
16 | struct Nums glob; |
17 | __attribute__((__noinline__)) |
18 | void esc(struct Nums* nums) { |
19 | glob = *nums; |
20 | } |
21 | |
22 | __attribute__((__noinline__)) |
23 | int main() { |
24 | struct Nums nums = { .c=1 }; //// Dead store. |
25 | printf(format: "s1 nums.c: %d\n" , nums.c); // DexLabel('s1') |
26 | |
27 | nums.c = 2; //// Killing store. |
28 | printf(format: "s2 nums.c: %d\n" , nums.c); // DexLabel('s2') |
29 | |
30 | esc(nums: &nums); //// Force nums to live on the stack. |
31 | return 0; // DexLabel('s3') |
32 | } |
33 | |
34 | // DexExpectWatchValue('nums.c', '1', on_line=ref('s1')) |
35 | // DexExpectWatchValue('nums.c', '2', from_line=ref('s2'), to_line=ref('s3')) |
36 | |