1 // Purpose:
2 //      Test that address values in a \DexExpectWatchValue are printed with
3 //      their address name along with the address' resolved value (if any), and
4 //      that when verbose output is enabled the complete map of resolved
5 //      addresses and list of unresolved addresses will also be printed.
6 //
7 //      Note: Currently "misordered result" is the only penalty that does not
8 //      display the address properly; if it is implemented, this test should be
9 //      updated.
10 //
11 // The dbgeng driver doesn't support \DexLimitSteps yet.
12 // UNSUPPORTED: system-windows
13 //
14 // RUN: %dexter_regression_test_build %s -o %t
15 // RUN: not %dexter_regression_test_run --binary %t -v -- %s | FileCheck %s
16 
17 // CHECK: Resolved Addresses:
18 // CHECK-NEXT: 'x_2': 0x[[X2_VAL:[0-9a-f]+]]
19 // CHECK-NEXT: 'y': 0x[[Y_VAL:[0-9a-f]+]]
20 // CHECK: Unresolved Addresses:
21 // CHECK-NEXT: ['x_1']
22 
23 // CHECK-LABEL: [x] ExpectValue
24 // CHECK: expected encountered watches:
25 // CHECK-NEXT: address 'x_2' (0x[[X2_VAL]])
26 // CHECK: missing values:
27 // CHECK-NEXT: address 'x_1'
28 
29 // CHECK-LABEL: [z] ExpectValue
30 // CHECK: expected encountered watches:
31 // CHECK-NEXT: address 'x_2' (0x[[X2_VAL]])
32 // CHECK-NEXT: address 'y' (0x[[Y_VAL]])
33 // CHECK: misordered result:
34 // CHECK-NEXT: (0x[[Y_VAL]]): step 4
35 // CHECK-NEXT: (0x[[X2_VAL]]): step 5
36 
main()37 int main() {
38     int *x = new int(5);
39     int *y = new int(4);
40     if (false) {
41         (void)0; // DexLabel('unreachable')
42     }
43     int *z = y;
44     z = x; // DexLabel('start_line')
45     delete y;
46     delete x; // DexLabel('end_line')
47 }
48 
49 // DexDeclareAddress('x_1', 'x', on_line=ref('unreachable'))
50 // DexDeclareAddress('x_2', 'x', on_line=ref('end_line'))
51 // DexDeclareAddress('y', 'y', on_line=ref('start_line'))
52 // DexExpectWatchValue('x', address('x_1'), address('x_2'), from_line=ref('start_line'), to_line=ref('end_line'))
53 // DexExpectWatchValue('z', address('x_2'), address('y'), from_line=ref('start_line'), to_line=ref('end_line'))
54