aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/call_stack.cpp
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-09-13 13:47:30 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-09-14 00:18:49 +0300
commit418e850b2b1f76b204af87a5d930f5129055e09a (patch)
tree470f40f91b500ca1de712689d171433d9dd4d0d5 /test/call_stack.cpp
parentcall_stack: try to fix __declspec(noinline) #3 (diff)
downloadwinapi-debug-418e850b2b1f76b204af87a5d930f5129055e09a.tar.gz
winapi-debug-418e850b2b1f76b204af87a5d930f5129055e09a.zip
call_stack: can't noinline w/ MSVC, let's try a DLL
Diffstat (limited to '')
-rw-r--r--test/call_stack.cpp37
1 files changed, 2 insertions, 35 deletions
diff --git a/test/call_stack.cpp b/test/call_stack.cpp
index 25f3985..e14f744 100644
--- a/test/call_stack.cpp
+++ b/test/call_stack.cpp
@@ -1,45 +1,12 @@
-#include "pdb/all.hpp"
+#include <test_lib.hpp>
-#include <boost/config.hpp>
#include <boost/nowide/iostream.hpp>
#include <exception>
-namespace test {
-
-typedef void (*F)();
-
-void call_stack() {
- const auto dbghelp = pdb::DbgHelp::current_process();
- const auto call_stack = pdb::CallStack::capture();
- call_stack.dump(boost::nowide::cout, dbghelp);
-}
-
-// Some tricks to prevent the functions from being inlined follow...
-void baz() {
- boost::nowide::cout << "baz " << &baz << '\n';
- F f = &call_stack;
- f();
-}
-
-void bar() {
- boost::nowide::cout << "bar " << &bar << '\n';
- F f = &baz;
- f();
-}
-
-void foo() {
- boost::nowide::cout << "foo " << &foo << '\n';
- F f = &bar;
- f();
-}
-
-} // namespace test
-
int main() {
try {
- test::F f = &test::foo;
- f();
+ test::print_call_stack();
} catch (const std::exception& e) {
boost::nowide::cerr << e.what() << '\n';
return 1;