brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · cded557 Raw
53 lines · c
1// XFAIL:*2//// See PR47946.3 4// REQUIRES: lldb5// UNSUPPORTED: system-windows6// RUN: %clang -std=gnu11 -O2 -glldb %s -o %t7// RUN: %dexter --fail-lt 1.0 -w %dexter_lldb_args --binary %t -- %s8//9//// Check that once-escaped variable 'param' can still be read after we10//// perform inlining + mem2reg, and that we see the DSE'd value 255.11 12 13int g;14__attribute__((__always_inline__))15static void use(int* p) {16  g = *p;17  *p = 255;18  volatile int step = 0;  // DexLabel('use1')19}20 21__attribute__((__noinline__))22void fun(int param) {23  //// Make sure first step is in 'fun'.24  volatile int step = 0;  // DexLabel('fun1')25  use(&param);26  return;                 // DexLabel('fun2')27}28 29int main() {30  fun(5);31}32 33/*34# Expect param == 5 before stepping through inlined 'use'.35DexExpectWatchValue('param', '5', on_line=ref('fun1'))36 37# Expect param == 255 after assignment in inlined frame 'use'.38DexExpectProgramState({39  'frames': [40    { 'function': 'use',41      'location': { 'lineno': ref('use1') },42    },43    { 'function': 'fun',44      'location': { 'lineno': 20 },45      'watches':  { 'param': '255' }46    },47  ]48})49 50# Expect param == 255 after inlined call to 'use'.51DexExpectWatchValue('param', '255', on_line=ref('fun2'))52*/53