blob: 63e51adcf51ee9fb0397c4a1b897f629340f0147 (
plain) (
blame)
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
35
36
37
38
39
40
41
42
43
44
|
#include "test_lib.hpp"
#include <pdb/all.hpp>
#include <boost/nowide/iostream.hpp>
// Prevent frame pointer omission (FPO) and/or inlining.
#ifdef _MSC_VER
#pragma optimize("", off)
#endif
namespace test_ns {
namespace {
void do_print_call_stack() {
const auto dbghelp = pdb::DbgHelp::current_process();
const auto call_stack = pdb::CallStack::capture();
call_stack.dump(boost::nowide::cout, dbghelp);
}
} // namespace
volatile int var = 42;
void baz(F f) {
boost::nowide::cout << "baz\n";
f();
}
void bar(F f) {
boost::nowide::cout << "bar\n";
baz(f);
}
void foo(F f) {
boost::nowide::cout << "foo\n";
bar(f);
}
void print_call_stack() {
foo(&do_print_call_stack);
}
} // namespace test_ns
|