Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- me@oliphant:~$ cat lala.cpp
- #include <iostream>
- #include <unistd.h>>
- int main(int argc, char** argv) {
- volatile int i(0);
- while(true){
- std::cout << i << std::endl;
- sleep(5);
- }
- }
- me@oliphant:~$ g++ -ggdb lala.cpp
- me@oliphant:~$ ./a.out & gdb a.out $! -f a.out
- [1] 98933
- 0
- Excess command line arguments ignored. (a.out)
- GNU gdb 6.3.50-20050815 (Apple version gdb-1461.2) (Fri Mar 5 04:43:10 UTC 2010)
- Copyright 2004 Free Software Foundation, Inc.
- GDB is free software, covered by the GNU General Public License, and you are
- welcome to change it and/or distribute copies of it under certain conditions.
- Type "show copying" to see the conditions.
- There is absolutely no warranty for GDB. Type "show warranty" for details.
- This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ... done
- /Users/me/98933: No such file or directory
- Attaching to program: `/Users/me/a.out', process 98933.
- Reading symbols for shared libraries ++. done
- 0x00007fff888b3a6a in __semwait_signal ()
- (gdb) break lala.cpp:9
- Breakpoint 1 at 0x100000d4b: file lala.cpp, line 9.
- (gdb) c
- Continuing.
- 0
- Breakpoint 1, main (argc=1, argv=0x7fff5fbfef28) at lala.cpp:9
- /Users/me/lala.cpp:9:154:beg:0x100000d4b
- (gdb) print i=22
- $1 = 22
- (gdb) c
- Continuing.
- 22
- Breakpoint 1, main (argc=1, argv=0x7fff5fbfef28) at lala.cpp:9
- /Users/me/lala.cpp:9:154:beg:0x100000d4b
- (gdb) The program is running. Quit anyway (and detach it)? (y or n) y
- Detaching from program: `/Users/me/a.out', process 98933.
- me@oliphant:~$ 22
- fg
- ./a.out
- 22
- ^C
- me@oliphant:~$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement