1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
$ g++ -std=c++11 -g foo.cpp
$ gdb -q ./a.out
Reading symbols from ./a.out...done.
(gdb) b checkpalindrome(std::vector<int, std::allocator<int> >, int, int*, int)
Breakpoint 1 at 0x400a7d: file foo.cpp, line 6.
(gdb) run
Starting program: ./a.out
Breakpoint 1, checkpalindrome (vect=std::vector of length 6, capacity 6 = {...}, k=0, count=0x7fffffffdde4, size=6) at foo.cpp:6
6 *count = 0;
(gdb) p vect
$1 = std::vector of length 6, capacity 6 = {0, 0, 0, 0, 0, 0}
(gdb) bt
#0 checkpalindrome (vect=std::vector of length 6, capacity 6 = {...}, k=0, count=0x7fffffffdde4, size=6) at foo.cpp:6
#1 0x0000000000400c44 in main () at foo.cpp:42
(gdb) up
#1 0x0000000000400c44 in main () at foo.cpp:42
42 checkpalindrome(vect, k, &count, size);
(gdb) p i
$2 = 100
(gdb) p j
$3 = 100
(gdb) p sum
$4 = 10000
(gdb) p vect
$5 = std::vector of length 6, capacity 6 = {0, 0, 0, 0, 0, 0}
(gdb)
|