summaryrefslogtreecommitdiffstats
path: root/debuginfo-tests/win_cdb/realigned-frame.cpp
blob: a964b43e0cbd4c6f8000b517a1fdc54adac764b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// RUN: %clang_cl %s -o %t.exe -fuse-ld=lld -Z7
// RUN: grep DE[B]UGGER: %s | sed -e 's/.*DE[B]UGGER: //' > %t.script
// RUN: %cdb -cf %t.script %t.exe | FileCheck %s --check-prefixes=DEBUGGER,CHECK

// From https://llvm.org/pr38857, where we had issues with stack realignment.

struct Foo {
  int x = 42;
  int __declspec(noinline) foo();
  void __declspec(noinline) bar(int *a, int *b, double *c);
};
int Foo::foo() {
  int a = 1;
  int b = 2;
  double __declspec(align(32)) force_alignment = 0.42;
  bar(&a, &b, &force_alignment);
  // DEBUGGER: g
  // DEBUGGER: .frame 1
  // DEBUGGER: dv
  // CHECK: a = 0n1
  // CHECK: b = 0n2
  // CHECK: force_alignment = 0.41999{{.*}}
  // DEBUGGER: q
  x += (int)force_alignment;
  return x;
}
void Foo::bar(int *a, int *b, double *c) {
  __debugbreak();
  *c += *a + *b;
}
int main() {
  Foo o;
  o.foo();
}
OpenPOWER on IntegriCloud