|
发表于 2005-3-20 20:02:59
|
显示全部楼层
很奇怪,这个函数的返回值居然是int。
- bash-2.05b$ gdb a.out
- GNU gdb 6.0
- Copyright 2003 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 "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".
- (gdb) l
- 1 #include <stdio.h>
- 2 #include <unistd.h>
- 3 #define _GNU_SOURCE
- 4 #define __USE_GNU
- 5
- 6 int main(int argc,char *argv[])
- 7 {
- 8 char *path;
- 9 path = get_current_dir_name();
- 10 printf("%s>\n",path);
- (gdb) ptype path
- No symbol "path" in current context.
- (gdb) b 10
- Breakpoint 1 at 0x804840c: file tt.c, line 10.
- (gdb) r
- Starting program: /home/kj501/program/c/a.out
- warning: Unable to find dynamic linker breakpoint function.
- GDB will be unable to debug shared library initializers
- and track explicitly loaded dynamic code.
- Breakpoint 1, main (argc=1, argv=0xbffff3d4) at tt.c:10
- 10 printf("%s>\n",path);
- (gdb) ptype path
- type = char *
- (gdb) ptype get_current_dir_name()
- type = int
复制代码 |
|