Patasuss

Backtrace

Nov 8th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 KB | None | 0 0
  1. Benutzung von break, step...
  2. http://openbook.rheinwerk-verlag.de/linux_unix_programmierung/Kap17-005.htm
  3.  
  4. After the first steps:
  5. https://sourceware.org/gdb/onlinedocs/gdb/Print-Settings.html#Print-Settings
  6.  
  7. In Java gibt es Stacktraces -> Nach Äquivalent gesucht und gefunden:
  8. http://www.chemie.fu-berlin.de/chemnet/use/info/gdb/gdb_7.html
  9.  
  10. Finish (Funkion ausführen bis zum Ende und Return-Value anzeigen lassen):
  11. http://stackoverflow.com/questions/267674/inspect-the-return-value-of-a-function-in-gdb
  12.  
  13. patrick@pats-ubuntu:~/ti2/ueb/02$ gdb fehlerhaft
  14. GNU gdb (Ubuntu 7.9-1ubuntu1) 7.9
  15. Copyright (C) 2015 Free Software Foundation, Inc.
  16. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  17. This is free software: you are free to change and redistribute it.
  18. There is NO WARRANTY, to the extent permitted by law. Type "show copying"
  19. and "show warranty" for details.
  20. This GDB was configured as "x86_64-linux-gnu".
  21. Type "show configuration" for configuration details.
  22. For bug reporting instructions, please see:
  23. <http://www.gnu.org/software/gdb/bugs/>.
  24. Find the GDB manual and other documentation resources online at:
  25. <http://www.gnu.org/software/gdb/documentation/>.
  26. For help, type "help".
  27. Type "apropos word" to search for commands related to "word"...
  28. Reading symbols from fehlerhaft...done.
  29. (gdb) break main
  30. Breakpoint 1 at 0x400dcf: file fehlerhaft.cc, line 12.
  31. (gdb) run
  32. Starting program: /home/patrick/ti2/ueb/02/fehlerhaft
  33.  
  34. Breakpoint 1, main () at fehlerhaft.cc:12
  35. 12 fehlerhaft.cc: No such file or directory.
  36. (gdb) step
  37. make_reader () at fehlerhaft.cc:6
  38. 6 in fehlerhaft.cc
  39. (gdb) step
  40. 7 in fehlerhaft.cc
  41. (gdb) step
  42. main () at fehlerhaft.cc:15
  43. 15 in fehlerhaft.cc
  44. (gdb) step
  45. Reader::read (this=0x0, in=...) at read.cc:7
  46. 7 read.cc: No such file or directory.
  47. (gdb) step
  48.  
  49. Program received signal SIGSEGV, Segmentation fault.
  50. 0x00007ffff7b8cab0 in std::string::length() const ()
  51. from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
  52. (gdb) step
  53. Single stepping until exit from function _ZNKSs6lengthEv,
  54. which has no line number information.
  55.  
  56. Program terminated with signal SIGSEGV, Segmentation fault.
  57. The program no longer exists.
  58. (gdb) break make_reader
  59. Breakpoint 2 at 0x400dc0: file fehlerhaft.cc, line 6.
  60. (gdb) break Reader::read
  61. Breakpoint 3 at 0x400ea0: Reader::read. (2 locations)
  62. (gdb) run
  63. Starting program: /home/patrick/ti2/ueb/02/fehlerhaft
  64.  
  65. Breakpoint 1, main () at fehlerhaft.cc:12
  66. 12 fehlerhaft.cc: No such file or directory.
  67. (gdb) step
  68.  
  69. Breakpoint 2, make_reader () at fehlerhaft.cc:6
  70. 6 in fehlerhaft.cc
  71. (gdb) backtrace full
  72. #0 make_reader () at fehlerhaft.cc:6
  73. No locals.
  74. #1 0x0000000000400dd4 in main () at fehlerhaft.cc:12
  75. reader = 0x0
  76. chars_read = 140737488346784
  77. (gdb) finish
  78. Run till exit from #0 make_reader () at fehlerhaft.cc:6
  79. 0x0000000000400dd4 in main () at fehlerhaft.cc:12
  80. 12 in fehlerhaft.cc
  81. Value returned is $1 = (Reader *) 0x0
  82. (gdb) step
  83. 15 in fehlerhaft.cc
  84. (gdb) step
  85.  
  86. Breakpoint 3, Reader::read (this=0x0, in=...) at read.cc:7
  87. 7 read.cc: No such file or directory.
  88. (gdb) backtrace full
  89. #0 Reader::read (this=0x0, in=...) at read.cc:7
  90. old_length = 0
  91. c = 0
  92. #1 0x0000000000400de9 in main () at fehlerhaft.cc:15
  93. reader = 0x0
  94. chars_read = 140737488346784
  95. (gdb) step
  96.  
  97. Program received signal SIGSEGV, Segmentation fault.
  98. 0x00007ffff7b8cab0 in std::string::length() const ()
  99. from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
  100. (gdb) step
  101. Single stepping until exit from function _ZNKSs6lengthEv,
  102. which has no line number information.
  103.  
  104. Program terminated with signal SIGSEGV, Segmentation fault.
  105. The program no longer exists.
  106. (gdb) q
Advertisement
Add Comment
Please, Sign In to add comment