Files
clang-p2996/cross-project-tests/debuginfo-tests/dexter/feature_tests/subtools/test/address_printing.cpp
Stephen Tozer 1c8366f9f2 [Dexter] Collate penalties of the same type into a single line for each
Currently in Dexter, every step at which a DexExpectWatchValue/Type does
not have the correct value is printed on a separate line. This patch
reduces the size of the text output by instead printing each incorrect
result (i.e. each incorrect value seen, 'Variable optimized out', and so
on) on its own line, alongside a list of the steps at which that result
was seen. This makes for much less spam in the output when watches are
missing or wrong for many steps.

Differential Revision: https://reviews.llvm.org/D120716
2022-04-11 17:01:40 +01:00

53 lines
1.9 KiB
C++

// Purpose:
// Test that address values in a \DexExpectWatchValue are printed with
// their address name along with the address' resolved value (if any), and
// that when verbose output is enabled the complete map of resolved
// addresses and list of unresolved addresses will also be printed.
//
// Note: Currently "misordered result" is the only penalty that does not
// display the address properly; if it is implemented, this test should be
// updated.
//
// The dbgeng driver doesn't support \DexLimitSteps yet.
// UNSUPPORTED: system-windows
//
// RUN: not %dexter_regression_test -v -- %s | FileCheck %s
// CHECK: Resolved Addresses:
// CHECK-NEXT: 'x_2': 0x[[X2_VAL:[0-9a-f]+]]
// CHECK-NEXT: 'y': 0x[[Y_VAL:[0-9a-f]+]]
// CHECK: Unresolved Addresses:
// CHECK-NEXT: ['x_1']
// CHECK-LABEL: [x] ExpectValue
// CHECK: expected encountered watches:
// CHECK-NEXT: address 'x_2' (0x[[X2_VAL]])
// CHECK: missing values:
// CHECK-NEXT: address 'x_1'
// CHECK-LABEL: [z] ExpectValue
// CHECK: expected encountered watches:
// CHECK-NEXT: address 'x_2' (0x[[X2_VAL]])
// CHECK-NEXT: address 'y' (0x[[Y_VAL]])
// CHECK: misordered result:
// CHECK-NEXT: (0x[[Y_VAL]]): step 4
// CHECK-NEXT: (0x[[X2_VAL]]): step 5
int main() {
int *x = new int(5);
int *y = new int(4);
if (false) {
(void)0; // DexLabel('unreachable')
}
int *z = y;
z = x; // DexLabel('start_line')
delete y;
delete x; // DexLabel('end_line')
}
// DexDeclareAddress('x_1', 'x', on_line=ref('unreachable'))
// DexDeclareAddress('x_2', 'x', on_line=ref('end_line'))
// DexDeclareAddress('y', 'y', on_line=ref('start_line'))
// DexExpectWatchValue('x', address('x_1'), address('x_2'), from_line=ref('start_line'), to_line=ref('end_line'))
// DexExpectWatchValue('z', address('x_2'), address('y'), from_line=ref('start_line'), to_line=ref('end_line'))