brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · e24d3a4 Raw
47 lines · cpp
1// REQUIRES: system-windows2//3// RUN: %clang_cl /Od /Z7 /Zi %s -o %t4// RUN: %dexter --fail-lt 1.0 -w --binary %t --debugger 'dbgeng' -- %s5//6// RUN: %clang_cl /O2 /Z7 /Zi %s -o %t7// RUN: %dexter --fail-lt 1.0 -w --binary %t \8// RUN:      --debugger 'dbgeng' -- %s9 10// This code is structured to have an early exit with an epilogue in the middle11// of the function, which creates a gap between the beginning of the inlined12// code region and the end. Previously, this confused cdb.13 14volatile bool shutting_down_ = true;15volatile bool tearing_down_ = true;16 17void __attribute__((optnone)) setCrashString(const char *) {}18void __attribute__((optnone)) doTailCall() {}19extern "C" void __declspec(noreturn) abort();20 21void __forceinline inlineCrashFrame() {22  if (shutting_down_ || tearing_down_) {23    setCrashString("crashing");24    // MSVC lays out calls to abort out of line, gets the layout we want.25    abort(); // DexLabel('stop')26  }27}28 29void __declspec(noinline) callerOfInlineCrashFrame(bool is_keeping_alive) {30  if (is_keeping_alive)31    inlineCrashFrame();32  else33    doTailCall();34}35 36int __attribute__((optnone)) main() {37  callerOfInlineCrashFrame(true);38}39 40/*41DexExpectProgramState({'frames':[42     {'function': 'inlineCrashFrame', 'location':{'lineno' : ref('stop')} },43     {'function': 'callerOfInlineCrashFrame'},44     {'function': 'main'}45]})46*/47