MRPT  1.9.9
test.cpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+
9  */
10 
11 #include <mrpt/system/backtrace.h>
12 #include <iostream>
13 
14 class Foo
15 {
16  public:
17  static int func1(int a, int b)
18  {
21  std::cout << bt.asString();
22  return a + b;
23  }
24 };
25 
26 // ------------------------------------------------------
27 // MAIN
28 // ------------------------------------------------------
29 int main()
30 {
31  try
32  {
33  Foo::func1(1, 2);
34 
35  return 0;
36  }
37  catch (std::exception& e)
38  {
39  std::cout << "MRPT exception caught: " << e.what() << std::endl;
40  return -1;
41  }
42  catch (...)
43  {
44  printf("Untyped exception!!");
45  return -1;
46  }
47 }
void getCallStackBackTrace(TCallStackBackTrace &out_bt)
Returns a list of strings representing the current call stack backtrace.
Definition: backtrace.cpp:31
GLubyte GLubyte b
Definition: glext.h:6279
static int func1(int a, int b)
See: getCallStackBackTrace()
Definition: backtrace.h:33
std::string asString() const
Prints all backtrace entries, one per line in a human-readable format.
Definition: backtrace.cpp:123
GLubyte GLubyte GLubyte a
Definition: glext.h:6279



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020