Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. #include <cstdio>
  2.  
  3. void f() {
  4. throw 42;
  5. }
  6. int main(int argc, char *argv[])
  7. {
  8. try {
  9. throw 42;
  10. //f();
  11. printf("after thrown");
  12. } catch (...) {
  13. printf("in catch stmtn");
  14. }
  15. printf("after try-catch stmtn");
  16. }
  17.  
  18. $ gdb -q foo
  19. Reading symbols from foo...done.
  20. (gdb) start
  21. Temporary breakpoint 1 at 0x912: file foo.cpp, line 9.
  22. Starting program: /home/dannas/foo
  23. Temporary breakpoint 1, main (argc=1, argv=0x7fffffffdd88) at foo.cpp:9
  24. 9 throw 42;
  25. (gdb) next
  26. 12 } catch (...) {
  27. (gdb)
  28. 13 printf("in catch stmtn");
  29. (gdb)
  30. in catch stmt
  31. 12 } catch (...) {
  32.  
  33. $ gdb -q foo
  34. Reading symbols from foo...done.
  35. (gdb) start
  36. Temporary breakpoint 1 at 0x912: file foo.cpp, line 10.
  37. Starting program: /home/dannas/foo
  38.  
  39. Temporary breakpoint 1, main (argc=1, argv=0x7fffffffdd78) at foo.cpp:10
  40. 10 f();
  41. (gdb) n
  42. in catch stmt
  43. after try-catch stmt
  44. [Inferior 1 (process 32522) exited normally]
  45.  
  46. $ gdb --version
  47. GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement