summaryrefslogtreecommitdiffstats
path: root/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_program_state.cpp
blob: 71d56bcc448f071a6d97a4a7c4deca528156bb6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Purpose:
//      Check that \DexExpectWatchValue applies no penalties when expected
//      program states are found.
//
// REQUIRES: system-linux, lldb
//
// RUN: %dexter test --fail-lt 1.0 -w \
// RUN:     --builder 'clang' --debugger 'lldb' --cflags "-O0 -glldb" -- %s \
// RUN:     | FileCheck %s
// CHECK: expect_program_state.cpp:

int GCD(int lhs, int rhs)
{
    if (rhs == 0)
        return lhs; // DexLabel('check')
    return GCD(rhs, lhs % rhs);
}

int main()
{
    return GCD(111, 259);
}

/*
DexExpectProgramState({
    'frames': [
        {
            'location': {
                'lineno': 'check'
            },
            'watches': {
                'lhs': '37', 'rhs': '0'
            }
        },
        {
            'watches': {
                'lhs': {'value': '111'}, 'rhs': {'value': '37'}
            }
        },
        {
            'watches': {
                'lhs': {'value': '259'}, 'rhs': {'value': '111'}
            }
        },
        {
            'watches': {
                'lhs': {'value': '111'}, 'rhs': {'value': '259'}
            }
        }
    ]
})
*/
OpenPOWER on IntegriCloud