aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-09-13 13:21:44 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-09-13 13:25:38 +0300
commit257342992a91ec435ed13c942f92075600f717f3 (patch)
tree4131b737f6b51ead9f045a28b279f1dc1aef0f87 /test
parentcall_stack: try to fix __declspec(noinline) #2 (diff)
downloadwinapi-debug-257342992a91ec435ed13c942f92075600f717f3.tar.gz
winapi-debug-257342992a91ec435ed13c942f92075600f717f3.zip
call_stack: try to fix __declspec(noinline) #3
Diffstat (limited to 'test')
-rw-r--r--test/call_stack.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/test/call_stack.cpp b/test/call_stack.cpp
index 082ff3a..25f3985 100644
--- a/test/call_stack.cpp
+++ b/test/call_stack.cpp
@@ -7,6 +7,8 @@
namespace test {
+typedef void (*F)();
+
void call_stack() {
const auto dbghelp = pdb::DbgHelp::current_process();
const auto call_stack = pdb::CallStack::capture();
@@ -14,26 +16,30 @@ void call_stack() {
}
// Some tricks to prevent the functions from being inlined follow...
-BOOST_NOINLINE void baz() {
+void baz() {
boost::nowide::cout << "baz " << &baz << '\n';
- call_stack();
+ F f = &call_stack;
+ f();
}
-BOOST_NOINLINE void bar() {
+void bar() {
boost::nowide::cout << "bar " << &bar << '\n';
- baz();
+ F f = &baz;
+ f();
}
-BOOST_NOINLINE void foo() {
+void foo() {
boost::nowide::cout << "foo " << &foo << '\n';
- bar();
+ F f = &bar;
+ f();
}
} // namespace test
int main() {
try {
- test::foo();
+ test::F f = &test::foo;
+ f();
} catch (const std::exception& e) {
boost::nowide::cerr << e.what() << '\n';
return 1;