Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Benutzung von break, step...
- http://openbook.rheinwerk-verlag.de/linux_unix_programmierung/Kap17-005.htm
- After the first steps:
- https://sourceware.org/gdb/onlinedocs/gdb/Print-Settings.html#Print-Settings
- In Java gibt es Stacktraces -> Nach Äquivalent gesucht und gefunden:
- http://www.chemie.fu-berlin.de/chemnet/use/info/gdb/gdb_7.html
- Finish (Funkion ausführen bis zum Ende und Return-Value anzeigen lassen):
- http://stackoverflow.com/questions/267674/inspect-the-return-value-of-a-function-in-gdb
- patrick@pats-ubuntu:~/ti2/ueb/02$ gdb fehlerhaft
- GNU gdb (Ubuntu 7.9-1ubuntu1) 7.9
- Copyright (C) 2015 Free Software Foundation, Inc.
- License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
- This is free software: you are free to change and redistribute it.
- There is NO WARRANTY, to the extent permitted by law. Type "show copying"
- and "show warranty" for details.
- This GDB was configured as "x86_64-linux-gnu".
- Type "show configuration" for configuration details.
- For bug reporting instructions, please see:
- <http://www.gnu.org/software/gdb/bugs/>.
- Find the GDB manual and other documentation resources online at:
- <http://www.gnu.org/software/gdb/documentation/>.
- For help, type "help".
- Type "apropos word" to search for commands related to "word"...
- Reading symbols from fehlerhaft...done.
- (gdb) break main
- Breakpoint 1 at 0x400dcf: file fehlerhaft.cc, line 12.
- (gdb) run
- Starting program: /home/patrick/ti2/ueb/02/fehlerhaft
- Breakpoint 1, main () at fehlerhaft.cc:12
- 12 fehlerhaft.cc: No such file or directory.
- (gdb) step
- make_reader () at fehlerhaft.cc:6
- 6 in fehlerhaft.cc
- (gdb) step
- 7 in fehlerhaft.cc
- (gdb) step
- main () at fehlerhaft.cc:15
- 15 in fehlerhaft.cc
- (gdb) step
- Reader::read (this=0x0, in=...) at read.cc:7
- 7 read.cc: No such file or directory.
- (gdb) step
- Program received signal SIGSEGV, Segmentation fault.
- 0x00007ffff7b8cab0 in std::string::length() const ()
- from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
- (gdb) step
- Single stepping until exit from function _ZNKSs6lengthEv,
- which has no line number information.
- Program terminated with signal SIGSEGV, Segmentation fault.
- The program no longer exists.
- (gdb) break make_reader
- Breakpoint 2 at 0x400dc0: file fehlerhaft.cc, line 6.
- (gdb) break Reader::read
- Breakpoint 3 at 0x400ea0: Reader::read. (2 locations)
- (gdb) run
- Starting program: /home/patrick/ti2/ueb/02/fehlerhaft
- Breakpoint 1, main () at fehlerhaft.cc:12
- 12 fehlerhaft.cc: No such file or directory.
- (gdb) step
- Breakpoint 2, make_reader () at fehlerhaft.cc:6
- 6 in fehlerhaft.cc
- (gdb) backtrace full
- #0 make_reader () at fehlerhaft.cc:6
- No locals.
- #1 0x0000000000400dd4 in main () at fehlerhaft.cc:12
- reader = 0x0
- chars_read = 140737488346784
- (gdb) finish
- Run till exit from #0 make_reader () at fehlerhaft.cc:6
- 0x0000000000400dd4 in main () at fehlerhaft.cc:12
- 12 in fehlerhaft.cc
- Value returned is $1 = (Reader *) 0x0
- (gdb) step
- 15 in fehlerhaft.cc
- (gdb) step
- Breakpoint 3, Reader::read (this=0x0, in=...) at read.cc:7
- 7 read.cc: No such file or directory.
- (gdb) backtrace full
- #0 Reader::read (this=0x0, in=...) at read.cc:7
- old_length = 0
- c = 0
- #1 0x0000000000400de9 in main () at fehlerhaft.cc:15
- reader = 0x0
- chars_read = 140737488346784
- (gdb) step
- Program received signal SIGSEGV, Segmentation fault.
- 0x00007ffff7b8cab0 in std::string::length() const ()
- from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
- (gdb) step
- Single stepping until exit from function _ZNKSs6lengthEv,
- which has no line number information.
- Program terminated with signal SIGSEGV, Segmentation fault.
- The program no longer exists.
- (gdb) q
Advertisement
Add Comment
Please, Sign In to add comment