Files
clang-p2996/cross-project-tests/debuginfo-tests/dexter-tests/memvars/struct-dse.c
Felipe de Azevedo Piovezan a8837b49c1 [cross-project-tests] Fix struct-dse example so that it fails again (#73566)
The purpose of this example is to provide a case where the debugger /
debug info experience could be improved. A recent commit by clang
(0d2860b795) changed codegen such that it
changes how "small structs" are initialized, in a way that the debugger
is now able to correctly display the variable being targeted by this
test.

In order to keep the example relevant, i.e. failing, this commit makes
it so that the struct is now "big enough" to not trigger the new
codegen.
2023-11-27 13:14:10 -08:00

36 lines
1.0 KiB
C

// XFAIL:*
//// Currently, LowerDbgDeclare doesn't lower dbg.declares pointing at allocas
//// for structs.
// REQUIRES: lldb
// UNSUPPORTED: system-windows
// RUN: %clang -std=gnu11 -O2 -glldb %s -o %t
// RUN: %dexter --fail-lt 1.0 -w --debugger lldb --binary %t -- %s
//
//// Check debug-info for the escaped struct variable num is reasonable.
#include <stdio.h>
struct Nums {
int a, b, c, d, e, f, g, h, i, j;
};
struct Nums glob;
__attribute__((__noinline__))
void esc(struct Nums* nums) {
glob = *nums;
}
__attribute__((__noinline__))
int main() {
struct Nums nums = { .c=1 }; //// Dead store.
printf("s1 nums.c: %d\n", nums.c); // DexLabel('s1')
nums.c = 2; //// Killing store.
printf("s2 nums.c: %d\n", nums.c); // DexLabel('s2')
esc(&nums); //// Force nums to live on the stack.
return 0; // DexLabel('s3')
}
// DexExpectWatchValue('nums.c', '1', on_line=ref('s1'))
// DexExpectWatchValue('nums.c', '2', from_line=ref('s2'), to_line=ref('s3'))