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 // REQUIRES: lldb, system-linux
12 //
13 // RUN: not %dexter_regression_test -v -- %s | FileCheck %s
14 
15 // CHECK: Resolved Addresses:
16 // CHECK-NEXT: 'x_2': 0x[[X2_VAL:[0-9a-f]+]]
17 // CHECK-NEXT: 'y': 0x[[Y_VAL:[0-9a-f]+]]
18 // CHECK: Unresolved Addresses:
19 // CHECK-NEXT: ['x_1']
20 
21 // CHECK-LABEL: [x] ExpectValue
22 // CHECK: expected encountered watches:
23 // CHECK-NEXT: address 'x_2' (0x[[X2_VAL]])
24 // CHECK: missing values:
25 // CHECK-NEXT: address 'x_1'
26 
27 // CHECK-LABEL: [z] ExpectValue
28 // CHECK: expected encountered watches:
29 // CHECK-NEXT: address 'x_2' (0x[[X2_VAL]])
30 // CHECK-NEXT: address 'y' (0x[[Y_VAL]])
31 // CHECK: misordered result:
32 // CHECK-NEXT: step 4 (0x[[Y_VAL]])
33 // CHECK-NEXT: step 5 (0x[[X2_VAL]])
34 
35 int main() {
36     int *x = new int(5);
37     int *y = new int(4);
38     if (false) {
39         (void)0; // DexLabel('unreachable')
40     }
41     int *z = y;
42     z = x; // DexLabel('start_line')
43     delete y;
44     delete x; // DexLabel('end_line')
45 }
46 
47 // DexDeclareAddress('x_1', 'x', on_line=ref('unreachable'))
48 // DexDeclareAddress('x_2', 'x', on_line=ref('end_line'))
49 // DexDeclareAddress('y', 'y', on_line=ref('start_line'))
50 // DexExpectWatchValue('x', address('x_1'), address('x_2'), from_line=ref('start_line'), to_line=ref('end_line'))
51 // DexExpectWatchValue('z', address('x_2'), address('y'), from_line=ref('start_line'), to_line=ref('end_line'))
52