GNU gdb 5.0
Copyright 2000 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 "i386-redhat-linux".
(gdb)
当你启动 gdb 后, 你能在命令行上指定很多的选项. 你也可以以下面的方式来运行 gdb
:
Old value = 0 '00'
New value = 104 'h'
my_print2 (string=0xbffffab0 "hello world!") at hello.c:25
25 for (i = 0; i < size; i++)
这个值正是期望的. 后来的数次循环的结果都是正确的. 当 i=11 时, 表达式
string2[size - i] 的值等于 `!`, size - i 的值等于 1, 最后一个字符已经拷到新串
里了.