xref: /llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/dbg-arg.c (revision e6cc7b723f244f52663b6d67a5d94597109da1ef)
1 // REQUIRES: lldb
2 // UNSUPPORTED: system-windows
3 //
4 // This test case checks debug info during register moves for an argument.
5 // RUN: %clang -std=gnu11 -m64 -mllvm -fast-isel=false -g %s -o %t
6 // RUN: %dexter --fail-lt 1.0 -w \
7 // RUN:     --binary %t --debugger 'lldb' -- %s
8 //
9 // Radar 8412415
10 
11 struct _mtx
12 {
13   long unsigned int ptr;
14   int waiters;
15   struct {
16     int tag;
17     int pad;
18   } mtxi;
19 };
20 
21 int bar(int, int);
22 
foobar(struct _mtx * mutex)23 int foobar(struct _mtx *mutex) {
24   int r = 1;
25   int l = 0; // DexLabel('l_assign')
26   int j = 0;
27   do {
28     if (mutex->waiters) {
29       r = 2;
30     }
31     j = bar(r, l);
32     ++l;
33   } while (l < j);
34   return r + j;
35 }
36 
bar(int i,int j)37 int bar(int i, int j) {
38   return i + j;
39 }
40 
main()41 int main() {
42   struct _mtx m;
43   m.waiters = 0;
44   return foobar(&m);
45 }
46 
47 
48 /*
49 DexExpectProgramState({
50   'frames': [
51     {
52       'location': { 'lineno': ref('l_assign') },
53       'watches': {
54         '*mutex': { 'is_irretrievable': False }
55       }
56     }
57   ]
58 })
59 */
60 
61