LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2231|回复: 3

利用__FILE__, __LINE__, __FUNCTION__等宏跟踪调试程序的运行

[复制链接]
发表于 2005-11-30 01:07:44 | 显示全部楼层 |阅读模式
利用__FILE__, __LINE__, __FUNCTION__跟踪调试程序

作为一个Linux系统下的C程序员,你可能发现调试程序是个比较麻烦的工作,虽然已经有gdb,kgdb等专业的调试软件,但如果对这些软件运用不熟练是根本达不到调试程序找出bug的目的的。又或者你对gdb已经很熟了,但运行gdb开始调试后在哪里设置断点成了你头痛的问题?当然,你可以从程序开始就以单步运行step by step来调试程序,但这会耗去你很多时间。
如果你能很好地跟踪并记录程序的运行情况,那么一切将变得简单。下面我以一个实例说明我是如何操作的:
首先我有一个程序主体main,其代码如下:

  1. //////////////////////////////trace.c 开始///////////////////////////////////////////
  2. /*********************************************************************
  3. *filename: trace.c
  4. *purpose: demonstrate how to trace program easily. We'll
  5. *         get every source filename, function-name, and the
  6. *         current line number wrote into a stream. The stream
  7. *         can be a file descriptor or stdout
  8. *wrote by: zhoulifa(zhoulifa@163.com) 周立发([url]http://zhoulifa.bokee.com[/url])
  9. *date time:2005-11-30 00:30
  10. *Note: 任何人可以任意复制代码并运用这些代码,当然包括你的商业用途
  11. *                         但请遵循GPL               
  12. *********************************************************************/

  13. #include "global.h"
  14. #include "MyFuncOne.h"
  15. #include "MyFuncTwo.h"

  16. int x;

  17. int main(int argc, char ** argv)
  18. {
  19.         x = 5;
  20.         dump(stdout, "now: x=%d", x);
  21.         MyFuncOne();
  22.         MyFuncTwo();
  23.         dump(stdout, "now: x=%d", x);
  24.         return 0;
  25. }
  26. //////////////////////////////trace.c 结束///////////////////////////////////////////
复制代码

这个main里面引用了global.h,MyFuncOne.h,MyFuncTwo.h等,global.h里面是一个宏定义,定义了dump宏,其内容如下:

  1. //////////////////////////////global.h 开始///////////////////////////////////////////
  2. #ifndef GLOBAL_H
  3.         #define GLOBAL_H
  4.         #include "dump.h"

  5. /*********************************************************************
  6. *filename: global.h
  7. *purpose: dump function declare
  8. *wrote by: zhoulifa(zhoulifa@163.com) 周立发([url]http://zhoulifa.bokee.com[/url])
  9. *date time:2005-11-30 00:30
  10. *Note: 任何人可以任意复制代码并运用这些代码,当然包括你的商业用途
  11. *                         但请遵循GPL               
  12. *********************************************************************/
  13.         #ifdef DEBUG
  14.                 #define dump(fp, x...)  debug_print(fp, __FILE__, __LINE__, __FUNCTION__, ##x);
  15.         #else
  16.                 #define dump(fp, x...)
  17.         #endif

  18. #endif
  19. //////////////////////////////global.h 结束///////////////////////////////////////////
复制代码

global.h这里又引用了dump.h,其内容稍后再贴出来。
MyFuncOne.h和MyFuncTwo.h分别定义了两个函数MyFuncOne和MyFuncTwo,其内容如下:

  1. //////////////////////////////MyFuncOne.h 开始///////////////////////////////////////////
  2. #ifndef MYFUNC_ONE_H
  3.         #define MYFUNC_ONE_H
  4.         #include "global.h"
  5. /*********************************************************************
  6. *filename: MyFuncOne.h
  7. *purpose: MyFuncOne function declare
  8. *wrote by: zhoulifa(zhoulifa@163.com) 周立发([url]http://zhoulifa.bokee.com[/url])
  9. *date time:2005-11-30 00:30
  10. *Note: 任何人可以任意复制代码并运用这些代码,当然包括你的商业用途
  11. *                         但请遵循GPL               
  12. *********************************************************************/
  13.         void MyFuncOne();
  14. #endif
  15. //////////////////////////////MyFuncOne.h 结束///////////////////////////////////////////
复制代码

  1. //////////////////////////////MyFuncTwo.h 开始///////////////////////////////////////////
  2. #ifndef MYFUNC_TWO_H
  3.         #define MYFUNC_TWO_H
  4.         #include "global.h"
  5. /*********************************************************************
  6. *filename: MyFuncTwo.h
  7. *purpose: MyFuncTwo function declare
  8. *wrote by: zhoulifa(zhoulifa@163.com) 周立发([url]http://zhoulifa.bokee.com[/url])
  9. *Note: 任何人可以任意复制代码并运用这些代码,当然包括你的商业用途
  10. *                         但请遵循GPL               
  11. *********************************************************************/
  12.         void MyFuncTwo();
  13. #endif
  14. //////////////////////////////MyFuncTwo.h 结束///////////////////////////////////////////
复制代码

  1. //////////////////////////////MyFuncOne.c 开始///////////////////////////////////////////
  2. #include "MyFuncOne.h"

  3. extern int x;
  4. /*********************************************************************
  5. *filename: MyFuncOne.c
  6. *purpose: MyFuncOne function instance
  7. *wrote by: zhoulifa(zhoulifa@163.com) 周立发([url]http://zhoulifa.bokee.com[/url])
  8. *date time:2005-11-30 00:30
  9. *Note: 任何人可以任意复制代码并运用这些代码,当然包括你的商业用途
  10. *                         但请遵循GPL               
  11. *********************************************************************/
  12. void MyFuncOne()
  13. {
  14.         x *= -2;
  15.         dump(stdout, "MyFuncOne, now: x=%d", x);
  16. }
  17. //////////////////////////////MyFuncOne.c 结束///////////////////////////////////////////
复制代码

  1. //////////////////////////////MyFuncTwo.c 开始///////////////////////////////////////////
  2. #include "MyFuncTwo.h"

  3. extern int x;
  4. /*********************************************************************
  5. *filename: MyFuncTwo.h
  6. *purpose: MyFuncOne function declare
  7. *wrote by: zhoulifa(zhoulifa@163.com) 周立发([url]http://zhoulifa.bokee.com[/url])
  8. *date time:2005-11-30 00:30
  9. *Note: 任何人可以任意复制代码并运用这些代码,当然包括你的商业用途
  10. *                         但请遵循GPL               
  11. *********************************************************************/
  12. void MyFuncTwo()
  13. {
  14.         x++;
  15.         dump(stdout, "MyFuncTwo, now: x=%d", x);
  16. }
  17. //////////////////////////////MyFuncTwo.c 结束///////////////////////////////////////////
复制代码

现在该是时候说dump了,先看看其实现:

  1. //////////////////////////////dump.h 开始///////////////////////////////////////////
  2. #ifndef DUMP_H
  3.         #define DUMP_H
  4.         #include <sys/param.h>
  5.         #include <stdio.h>
  6.         #include <stdarg.h>
  7.         #include <time.h>
  8. /*********************************************************************
  9. *filename: dump.h
  10. *purpose: debug_print function declare
  11. *wrote by: zhoulifa(zhoulifa@163.com) 周立发([url]http://zhoulifa.bokee.com[/url])
  12. *date time:2005-11-30 00:30
  13. *Note: 任何人可以任意复制代码并运用这些代码,当然包括你的商业用途
  14. *                         但请遵循GPL               
  15. *********************************************************************/
  16.         void debug_print(FILE * fp, const char * filename, const int line, const char * funcname, char *fmt, ...);
  17. #endif
  18. //////////////////////////////dump.h 结束///////////////////////////////////////////
复制代码

  1. //////////////////////////////dump.c 开始///////////////////////////////////////////
  2. #include "dump.h"

  3. /*********************************************************************
  4. *filename: dump.c
  5. *purpose: debug_print function instance
  6. *wrote by: zhoulifa(zhoulifa@163.com) 周立发([url]http://zhoulifa.bokee.com[/url])
  7. *date time:2005-11-30 00:30
  8. *Note: 任何人可以任意复制代码并运用这些代码,当然包括你的商业用途
  9. *                         但请遵循GPL               
  10. *********************************************************************/
  11. void debug_print(FILE * fp, const char * filename, const int line, const char * funcname, char *fmt, ...)
  12. {
  13.         char buf[1024];
  14.         time_t t;
  15.         struct tm * now;
  16.         va_list ap;

  17.         time(&t);
  18.         now = localtime(&t);
  19.         va_start(ap, fmt);
  20.         fprintf(fp, "%04d-%02d-%02d %02d:%02d:%02d -- %s(%d):%s DEBUG:@"", now -> tm_year + 1900, now -> tm_mon + 1, now -> tm_mday, now -> tm_hour, now -> tm_min, now -> tm_sec, filename, line, funcname);
  21.         vsprintf(buf, fmt, ap);
  22.         fprintf(fp, "%s"@\n", buf);
  23.         va_end(ap);
  24. }
  25. //////////////////////////////dump.c 结束///////////////////////////////////////////
复制代码

大家一定注意到:这个程序和大家一般写的程序并无大的区别,除了__FILE__, __LINE__, __FUNCTION__等几个宏和dump宏,__FILE__, __LINE__, __FUNCTION__是编译的时候已经内置了的几个宏,用来表明当前程序运行到了哪个源文件的哪一行,同时表明当前在哪个函数里面。而我们定义一个dump宏就是用来把这些信息送到一个文件句柄去。比如你的日志文件。这样,在任何程序需要的地方都可以加上一句dump来把需要的调试信息记录下来。
比如编译上述程序:
gcc -DDEBUG trace.c dump.c MyFuncOne.c MyFuncTwo.c -o trace
然后运行程序可以得到如下结果:

  1. 2005-11-30 00:40:38 -- trace.c(22):main DEBUG:@"now: x=5"@
  2. 2005-11-30 00:40:38 -- MyFuncOne.c(15):MyFuncOne DEBUG:@"MyFuncOne, now: x=-10"@
  3. 2005-11-30 00:40:38 -- MyFuncTwo.c(15):MyFuncTwo DEBUG:@"MyFuncTwo, now: x=-9"@
  4. 2005-11-30 00:40:38 -- trace.c(25):main DEBUG:@"now: x=-9"@
复制代码

第一行:显示在trace.c源文件的第22行处,即main函数内打印出:now: x=5;
第二行:显示在MyFuncOne.c源文件的第15行处,即MyFuncOne函数内打印出:MyFuncOne, now: x=-10;
第三行:显示在MyFuncTwo.c源文件的第15行处,即MyFuncTwo函数内打印出:MyFuncTwo, now: x=-9;
第四行:显示在trace.c源文件的第25行处,即main函数内打印出:now: x=-9;

如果程序加多点dump,则程序运行到了哪里出了问题就会一目了然了。
发表于 2005-11-30 12:30:32 | 显示全部楼层
好文章!
不过贴代码最好用[code][/code]括起来阿
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-11-30 18:11:28 | 显示全部楼层

__FILE__,__LINE__等在哪儿定义的?

看了我之前的<利用__FILE__, __LINE__, __FUNCTION__跟踪调试程序>文章,大家可能在想,__FILE__/__LINE__/__FUNCTION__在哪儿找呢?其它都是编译器预定义的宏.
这些都是gcc的预定义宏(Predefined Macros),应该说这是各编程语言要求的,C++的就比C的稍微多一些。所以不论是gcc还是vc还是sun提供的cc等编译器都会有这些预定义宏的。关于gcc的,大家可以到gcc官方网站上看到:http://gcc.gnu.org/onlinedocs/cpp/Predefined-Macros.html
__FILE__/__LINE__/__FUNCTION__/__DATE__/__TIME__/__STDC__/__STDC_VERSION__/__STDC_HOSTED__/__cplusplus/__OBJC__/__ASSEMBLER__这些是gcc的标准预定义宏(Standard Predefined Macros),对我们程序员来说都比较有用的,当然我之前的贴子里只用到了__FILE__/__LINE__/__FUNCTION__。
另外GNU还有一些公用的扩展出来的宏(Common Predefined Macros),比如:__GNUC__/__GNUC_MINOR__/__GNUC_PATCHLEVEL__/__VERSION__等关于gcc版本的宏,另外还有__STRICT_ANSI__/__BASE_FILE__/__INCLUDE_LEVEL__等等一些宏,在gcc官方网站上你可以看到有几十个宏定义(这还不包括那些与系统相关的宏),而且都有明确的说明,我觉得__BASE_FILE__这个宏也比较好,它代码的是你的程序的main函数所在的那个源文件的名称。
具体到各系统,gcc官方网站明确说明你可以用cpp -dM命令来查看。
比如,对于上述程序例子,我输入了命令:
cpp -dM trace.c
结果得到如下几百个宏,其中大多与系统相关的,比如FILENAME_MAX指明文件明的最大长度:

  1. #define _POSIX_LOGIN_NAME_MAX 9
  2. #define __attribute__(xyz)
  3. #define __restrict
  4. #define SHRT_MAX 32767
  5. #define _POSIX_THREAD_THREADS_MAX 64
  6. #define __FDS_BITS(set) ((set)->__fds_bits)
  7. #define __USER_LABEL_PREFIX__
  8. #define NCARGS ARG_MAX
  9. #define _IO_pos_t _G_fpos_t
  10. #define _IO_DONT_CLOSE 0100000
  11. #define __suseconds_t_defined
  12. #define __USE_POSIX199506 1
  13. #define isset(a, i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
  14. #define _G_ssize_t __ssize_t
  15. #define _IO_SHOWBASE 0200
  16. #define _IO_peekc(_fp) _IO_peekc_unlocked (_fp)
  17. #define __STRING(x) #x
  18. #define CLK_TCK ((__clock_t) __sysconf (2))
  19. #define _WCHAR_T_DEFINED_
  20. #define __key_t_defined
  21. #define __SIZE_TYPE__ unsigned int
  22. #define clrbit(a, i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
  23. #define _GCC_WCHAR_T
  24. #define RTSIG_MAX 32
  25. #define _IOS_OUTPUT 2
  26. #define CLOCK_PROCESS_CPUTIME_ID 2
  27. #define __isleap(year) ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
  28. #define __volatile volatile
  29. #define CLOCK_REALTIME 0
  30. #define NOGROUP (-1)
  31. #define _G_stat64 stat64
  32. #define NFDBITS __NFDBITS
  33. #define _IO_USER_BUF 1
  34. #define _POSIX2_LINE_MAX 2048
  35. #define __FDELT(d) ((d) / __NFDBITS)
  36. #define _SYS_CDEFS_H 1
  37. #define _STDIO_USES_IOSTREAM
  38. #define _IO_stdin ((_IO_FILE*)(&_IO_2_1_stdin_))
  39. #define P_tmpdir "/tmp"
  40. #define __LITTLE_ENDIAN 1234
  41. #define _IO_UPPERCASE 01000
  42. #define __USE_SVID 1
  43. #define __WCHAR_T
  44. #define __inline
  45. #define setbit(a, i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
  46. #define __USE_MISC 1
  47. #define _LIMITS_H 1
  48. #define _IO_size_t _G_size_t
  49. #define FD_SET(fd, fdsetp) __FD_SET (fd, fdsetp)
  50. #define _IO_off_t _G_off_t
  51. #define PTHREAD_KEYS_MAX 1024
  52. #define __fsfilcnt_t_defined
  53. #define __clockid_t_defined 1
  54. #define __FD_ISSET(d, set) (__FDS_BITS (set)[__FDELT (d)] & __FDMASK (d))
  55. #define _G_size_t size_t
  56. #define LINE_MAX _POSIX2_LINE_MAX
  57. #define __FD_CLR(d, set) (__FDS_BITS (set)[__FDELT (d)] &= ~__FDMASK (d))
  58. #define _POSIX_MQ_OPEN_MAX 8
  59. #define __PTRDIFF_TYPE__ int
  60. #define _IO_LEFT 02
  61. #define _WCHAR_T
  62. #define _GCONV_H 1
  63. #define _G_HAVE_IO_FILE_OPEN 1
  64. #define _BITS_TYPES_H 1
  65. #define _POSIX_TZNAME_MAX 6
  66. #define minor(dev) ((dev).__val[0] & 0xff)
  67. #define MAX_CANON 255
  68. #define _G_USING_THUNKS 1
  69. #define _G_HAVE_LONG_DOUBLE_IO 1
  70. #define SHRT_MIN (-32767-1)
  71. #define _IO_wint_t _G_wint_t
  72. #define _LIMITS_H___
  73. #define MYFUNC_ONE_H
  74. #define va_arg __builtin_va_arg
  75. #define _POSIX_QLIMIT 1
  76. #define TIMER_MAX 256
  77. #define _IO_peekc_unlocked(_fp) ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end && __underflow (_fp) == EOF ? EOF : *(unsigned char *) (_fp)->_IO_read_ptr)
  78. #define _G_HAVE_IO_GETLINE_INFO 1
  79. #define _IO_UNITBUF 020000
  80. #define _G_BUFSIZ 8192
  81. #define _POSIX2_BC_DIM_MAX 2048
  82. #define _ENDIAN_H 1
  83. #define BIG_ENDIAN __BIG_ENDIAN
  84. #define AIO_PRIO_DELTA_MAX 20
  85. #define _G_NEED_STDARG_H 1
  86. #define CHILD_MAX 999
  87. #define RE_DUP_MAX (0x7fff)
  88. #define __flexarr [1]
  89. #define __ptrvalue
  90. #define _POSIX_AIO_MAX 1
  91. #define __HAVE_BUILTIN_SETJMP__ 1
  92. #define __stub_fexecve
  93. #define __BIG_ENDIAN 4321
  94. #define SEEK_SET 0
  95. #define __i386 1
  96. #define SSIZE_MAX INT_MAX
  97. #define __wchar_t__
  98. #define __gid_t_defined
  99. #define _POSIX_OPEN_MAX 16
  100. #define _WCHAR_T_
  101. #define __need_clockid_t
  102. #define LITTLE_ENDIAN __LITTLE_ENDIAN
  103. #define __va_list__
  104. #define __USE_POSIX 1
  105. #define _T_WCHAR
  106. #define _LIBC_LIMITS_H_ 1
  107. #define __stub_sigreturn
  108. #define _IO_cleanup_region_end(_Doit)
  109. #define _IO_ftrylockfile(_fp)
  110. #define PATH_MAX 4095
  111. #define _POSIX_SOURCE 1
  112. #define _IO_uid_t _G_uid_t
  113. #define _IO_MAGIC 0xFBAD0000
  114. #define PDP_ENDIAN __PDP_ENDIAN
  115. #define powerof2(x) ((((x)-1)&(x))==0)
  116. #define _IO_stderr ((_IO_FILE*)(&_IO_2_1_stderr_))
  117. #define _POSIX_STREAM_MAX 8
  118. #define _POSIX2_COLL_WEIGHTS_MAX 2
  119. #define _POSIX_FD_SETSIZE _POSIX_OPEN_MAX
  120. #define __stub_chflags
  121. #define _IO_stdout ((_IO_FILE*)(&_IO_2_1_stdout_))
  122. #define __GLIBC_MINOR__ 2
  123. #define _IO_NO_READS 4
  124. #define FILENAME_MAX 4095
  125. #define __u_char_defined
  126. #define DEV_BSIZE 512
  127. #define _IO_getwc_unlocked(_fp) ((_fp)->_wide_data->_IO_read_ptr >= (_fp)->_wide_data->_IO_read_end ? __wuflow (_fp) : (_IO_wint_t) *(_fp)->_wide_data->_IO_read_ptr++)
  128. #define _ANSI_STDARG_H_
  129. #define __ELF__ 1
  130. #define _POSIX2_EXPR_NEST_MAX 32
  131. #define _IOS_BIN 128
  132. #define __size_t__
  133. #define MAX(a, b) (((a)>(b))?(a):(b))
  134. #define _SIGSET_H_types 1
  135. #define __stub_fattach
  136. #define __NFDBITS (8 * sizeof (__fd_mask))
  137. #define __restrict_arr
  138. #define __ptr_t void *
  139. #define PIPE_BUF 4096
  140. #define __daddr_t_defined
  141. #define _BSD_SOURCE 1
  142. #define _IO_putwc_unlocked(_wch, _fp) ((_fp)->_wide_data->_IO_write_ptr >= (_fp)->_wide_data->_IO_write_end ? __woverflow (_fp, _wch) : (_IO_wint_t) (*(_fp)->_wide_data->_IO_write_ptr++ = (_wch)))
  143. #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
  144. #define __unbounded
  145. #define _IO_INTERNAL 010
  146. #define _TIME_H 1
  147. #define __WCHAR_TYPE__ long int
  148. #define _POSIX_UIO_MAXIOV 16
  149. #define _PTHREAD_DESCR_DEFINED
  150. #define TIMER_ABSTIME 1
  151. #define __KERNEL_STRICT_NAMES
  152. #define __SIZE_T
  153. #define __attribute_format_arg__(x)
  154. #define _IO_fpos_t _G_fpos_t
  155. #define __NO_INLINE__ 1
  156. #define _SIZE_T_DEFINED
  157. #define _IOLBF 1
  158. #define _IO_BUFSIZ _G_BUFSIZ
  159. #define __time_t_defined 1
  160. #define _IO_funlockfile(_fp)
  161. #define __GNUC_VA_LIST
  162. #define NULL ((void *)0)
  163. #define NBBY CHAR_BIT
  164. #define L_ctermid 9
  165. #define _IO_PENDING_OUTPUT_COUNT(_fp) ((_fp)->_IO_write_ptr - (_fp)->_IO_write_base)
  166. #define _POSIX_SEM_NSEMS_MAX 256
  167. #define __va_copy(d, s) __builtin_va_copy((d),(s))
  168. #define ULONG_MAX (LONG_MAX * 2UL + 1)
  169. #define _G_pid_t __pid_t
  170. #define _IO_HAVE_ST_BLKSIZE _G_HAVE_ST_BLKSIZE
  171. #define _VA_LIST
  172. #define _IO_ssize_t _G_ssize_t
  173. #define _POSIX_NGROUPS_MAX 0
  174. #define _POSIX_MAX_INPUT 255
  175. #define __USE_BSD 1
  176. #define L_cuserid 9
  177. #define __stub___kernel_tanl
  178. #define NOFILE 256
  179. #define _IO_IS_FILEBUF 0x2000
  180. #define __WORDSIZE 32
  181. #define __int8_t_defined
  182. #define CANBSIZ MAX_CANON
  183. #define EXEC_PAGESIZE 4096
  184. #define _IO_LINE_BUF 0x200
  185. #define _IO_STDIO_H
  186. #define _SYS_TYPES_H 1
  187. #define _G_OPEN64 __open64
  188. #define _T_SIZE
  189. #define __WINT_TYPE__ unsigned int
  190. #define MIN(a, b) (((a)<(b))?(a):(b))
  191. #define __timer_t_defined 1
  192. #define _LINUX_PARAM_H
  193. #define _POSIX_SEM_VALUE_MAX 32767
  194. #define _G_IO_IO_FILE_VERSION 0x20001
  195. #define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
  196. #define _PARAMS(protos) __P(protos)
  197. #define _POSIX_ARG_MAX 4096
  198. #define __uid_t_defined
  199. #define __stub_posix_fadvise64
  200. #define __mbstate_t_defined 1
  201. #define _POSIX2_BC_STRING_MAX 1000
  202. #define ARG_MAX 131072
  203. #define _SIZET_
  204. #define __GNU_LIBRARY__ 6
  205. #define _SYS_SELECT_H 1
  206. #define _BITS_POSIX1_LIM_H 1
  207. #define _GCC_SIZE_T
  208. #define __clock_t_defined 1
  209. #define __GLIBC_PREREQ(maj, min) ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
  210. #define _G_LSEEK64 __lseek64
  211. #define LONG_MAX __LONG_MAX__
  212. #define __PMT(args) args
  213. #define EOF (-1)
  214. #define MAXPATHLEN PATH_MAX
  215. #define _IO_SHOWPOINT 0400
  216. #define va_end __builtin_va_end
  217. #define _IO_CURRENTLY_PUTTING 0x800
  218. #define DUMP_H
  219. #define __LONG_LONG_PAIR(HI, LO) LO, HI
  220. #define NAME_MAX 255
  221. #define _OLD_STDIO_MAGIC 0xFABC0000
  222. #define _POSIX_AIO_LISTIO_MAX 2
  223. #define _G_VTABLE_LABEL_PREFIX_ID __vt_
  224. #define _IO_flockfile(_fp)
  225. #define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
  226. #define putc(_ch, _fp) _IO_putc (_ch, _fp)
  227. #define _IO_FIXED 010000
  228. #define _POSIX_THREAD_KEYS_MAX 128
  229. #define _IO_off64_t _G_off64_t
  230. #define __PDP_ENDIAN 3412
  231. #define _IO_va_list __gnuc_va_list
  232. #define __LONG_MAX__ 2147483647L
  233. #define _BITS_WCHAR_H 1
  234. #define _IO_SHOWPOS 02000
  235. #define __LONG_LONG_MAX__ 9223372036854775807LL
  236. #define _WCHAR_T_H
  237. #define _IOS_ATEND 4
  238. #define stderr stderr
  239. #define _IO_TIED_PUT_GET 0x400
  240. #define __tune_i386__ 1
  241. #define _POSIX2_BC_BASE_MAX 99
  242. #define __unix 1
  243. #define unix 1
  244. #define stdout stdout
  245. #define __defined_schedparam 1
  246. #define _POSIX_TIMER_MAX 32
  247. #define __P(args) args
  248. #define _STDIO_H 1
  249. #define __STDC_IEC_559__ 1
  250. #define BYTE_ORDER __BYTE_ORDER
  251. #define __nlink_t_defined
  252. #define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
  253. #define _IO_NO_WRITES 8
  254. #define __sigset_t_defined
  255. #define __UNKNOWN_10646_CHAR ((wchar_t) 0xfffd)
  256. #define __WCHAR_MAX (2147483647l)
  257. #define _IONBF 2
  258. #define __FD_SET(d, set) (__FDS_BITS (set)[__FDELT (d)] |= __FDMASK (d))
  259. #define _IO_SKIPWS 01
  260. #define FD_ZERO(fdsetp) __FD_ZERO (fdsetp)
  261. #define _STDARG_H
  262. #define major(dev) (((dev).__val[0] >> 8) & 0xff)
  263. #define _G_HAVE_MMAP 1
  264. #define _POSIX_SSIZE_MAX 32767
  265. #define MAX_INPUT 255
  266. #define PTHREAD_STACK_MIN 16384
  267. #define __extension__
  268. #define LONG_MIN (-LONG_MAX-1)
  269. #define _G_off_t __off_t
  270. #define __stub_sstk
  271. #define _IO_fpos64_t _G_fpos64_t
  272. #define isclr(a, i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
  273. #define __FILE_defined 1
  274. #define _IO_MAGIC_MASK 0xFFFF0000
  275. #define howmany(x, y) (((x)+((y)-1))/(y))
  276. #define _IO_iconv_t _G_iconv_t
  277. #define _POSIX2_CHARCLASS_NAME_MAX 14
  278. #define _IO_HEX 0100
  279. #define __signed signed
  280. #define GLOBAL_H
  281. #define _SYS_SYSMACROS_H 1
  282. #define __pid_t_defined
  283. #define _SIZE_T
  284. #define FD_SETSIZE __FD_SETSIZE
  285. #define _IO_cleanup_region_start(_fct, _fp)
  286. #define _POSIX2_BC_SCALE_MAX 99
  287. #define _VA_LIST_T_H
  288. #define _IOS_TRUNC 16
  289. #define __stub___kernel_cosl
  290. #define getc(_fp) _IO_getc (_fp)
  291. #define _IO_UNBUFFERED 2
  292. #define _ASMi386_PARAM_H
  293. #define _IO_DELETE_DONT_CLOSE 0x40
  294. #define makedev(major, minor) { ((((unsigned int) (major)) << 8) | ((unsigned int) (minor))), 0 }
  295. #define __BIT_TYPES_DEFINED__ 1
  296. #define FOPEN_MAX 16
  297. #define __attribute_malloc__
  298. #define _IO_RIGHT 04
  299. #define BC_BASE_MAX _POSIX2_BC_BASE_MAX
  300. #define BC_DIM_MAX _POSIX2_BC_DIM_MAX
  301. #define _IO_IS_APPENDING 0x1000
  302. #define __REGISTER_PREFIX__
  303. #define __mode_t_defined
  304. #define _WINT_T
  305. #define _BITS_POSIX2_LIM_H 1
  306. #define __attribute_pure__
  307. #define __HAVE_COLUMN
  308. #define ___int_size_t_h
  309. #define FD_CLR(fd, fdsetp) __FD_CLR (fd, fdsetp)
  310. #define _IO_pid_t _G_pid_t
  311. #define _T_SIZE_
  312. #define _POSIX_C_SOURCE 199506L
  313. #define _POSIX_PATH_MAX 256
  314. #define __STDC_IEC_559_COMPLEX__ 1
  315. #define __stub___kernel_sinl
  316. #define __id_t_defined
  317. #define _G_HAVE_PRINTF_FP 1
  318. #define EXPR_NEST_MAX _POSIX2_EXPR_NEST_MAX
  319. #define _G_HAVE_BOOL 1
  320. #define __FDMASK(d) ((__fd_mask) 1 << ((d) % __NFDBITS))
  321. #define stdin stdin
  322. #define __stub_stty
  323. #define _G_HAVE_SYS_WAIT 1
  324. #define SCHAR_MAX 127
  325. #define __ssize_t_defined
  326. #define _IOS_NOCREATE 32
  327. #define UCHAR_MAX 255
  328. #define _POSIX2_RE_DUP_MAX 255
  329. #define __STDC_ISO_10646__ 200009L
  330. #define _POSIX_MQ_PRIO_MAX 32
  331. #define _G_NAMES_HAVE_UNDERSCORE 0
  332. #define _IO_DEC 020
  333. #define _G_VTABLE_LABEL_HAS_LENGTH 1
  334. #define _SIZE_T_
  335. #define _IO_EOF_SEEN 0x10
  336. #define va_copy(d, s) __builtin_va_copy((d),(s))
  337. #define __linux 1
  338. #define _SIZE_T_DEFINED_
  339. #define _IO_putc_unlocked(_ch, _fp) (((_fp)->_IO_write_ptr >= (_fp)->_IO_write_end) ? __overflow (_fp, (unsigned char) (_ch)) : (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch)))
  340. #define _STRUCT_TIMEVAL 1
  341. #define _G_va_list __gnuc_va_list
  342. #define _POSIX_DELAYTIMER_MAX 32
  343. #define _MACH_MACHLIMITS_H_
  344. #define _G_ARGS(ARGLIST) ARGLIST
  345. #define MAXSYMLINKS 20
  346. #define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
  347. #define _POSIX_SIGQUEUE_MAX 32
  348. #define _POSIX_PIPE_BUF 512
  349. #define __GLIBC__ 2
  350. #define i386 1
  351. #define __BYTE_ORDER __LITTLE_ENDIAN
  352. #define __const const
  353. #define _SVID_SOURCE 1
  354. #define __END_DECLS
  355. #define CHAR_MAX 127
  356. #define _IOFBF 0
  357. #define _G_HAVE_ATEXIT 1
  358. #define __GNUC_PREREQ(maj, min) 0
  359. #define MYFUNC_TWO_H
  360. #define _IO_LINKED 0x80
  361. #define _VA_LIST_DEFINED
  362. #define _IO_OCT 040
  363. #define _SYS_SIZE_T_H
  364. #define _IO_getc_unlocked(_fp) ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end ? __uflow (_fp) : *(unsigned char *) (_fp)->_IO_read_ptr++)
  365. #define __linux__ 1
  366. #define __USE_ANSI 1
  367. #define __CONCAT(x, y) x ## y
  368. #define __VERSION__ "2.96 20000731 (Red Hat Linux 7.1 2.96-98)"
  369. #define _BITS_PTHREADTYPES_H 1
  370. #define __FD_ZERO(set) do { unsigned int __i; fd_set *__arr = (set); for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) __FDS_BITS (__arr)[__i] = 0; } while (0)
  371. #define __USE_POSIX2 1
  372. #define NGROUPS 32
  373. #define __BEGIN_DECLS
  374. #define __blkcnt_t_defined
  375. #define NGROUPS_MAX 32
  376. #define __stub_fchflags
  377. #define __size_t
  378. #define _G_wchar_t wchar_t
  379. #define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0)
  380. #define MAXHOSTNAMELEN 64
  381. #define _G_FSTAT64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
  382. #define _IOS_APPEND 8
  383. #define _IO_BAD_SEEN 0x4000
  384. #define SCHAR_MIN (-128)
  385. #define __off_t_defined
  386. #define L_tmpnam 20
  387. #define _T_WCHAR_
  388. #define __ino_t_defined
  389. #define INT_MAX __INT_MAX__
  390. #define BC_STRING_MAX _POSIX2_BC_STRING_MAX
  391. #define __USE_POSIX199309 1
  392. #define MB_LEN_MAX 16
  393. #define CHAR_BIT 8
  394. #define __FD_SETSIZE 1024
  395. #define __attribute_format_strfmon__(a, b)
  396. #define BUFSIZ _IO_BUFSIZ
  397. #define _POSIX_RTSIG_MAX 8
  398. #define _IO_BOOLALPHA 0200000
  399. #define _LINUX_LIMITS_H
  400. #define _IO_file_flags _flags
  401. #define _G_VTABLE_LABEL_PREFIX "__vt_"
  402. #define __stub_revoke
  403. #define _BITS_TIME_H 1
  404. #define __INT_MAX__ 2147483647
  405. #define PTHREAD_THREADS_MAX 1024
  406. #define _G_off64_t __off64_t
  407. #define ___int_wchar_t_h
  408. #define _IO_USER_LOCK 0x8000
  409. #define __fsblkcnt_t_defined
  410. #define _IO_UNIFIED_JUMPTABLES 1
  411. #define __stub_posix_fadvise
  412. #define _VA_LIST_
  413. #define _POSIX_HIWAT _POSIX_PIPE_BUF
  414. #define va_start(v, l) __builtin_stdarg_start((v),l)
  415. #define _IOS_NOREPLACE 64
  416. #define __dev_t_defined
  417. #define _POSIX_LINK_MAX 8
  418. #define _IOS_INPUT 1
  419. #define UINT_MAX (INT_MAX * 2U + 1)
  420. #define HZ 100
  421. #define __timespec_defined 1
  422. #define _FEATURES_H 1
  423. #define CHAR_MIN (-128)
  424. #define __stub_gtty
  425. #define _POSIX_TTY_NAME_MAX 9
  426. #define __i386__ 1
  427. #define _IO_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0)
  428. #define __stub_setlogin
  429. #define SEEK_CUR 1
  430. #define __INT_WCHAR_T_H
  431. #define _IO_IN_BACKUP 0x100
  432. #define linux 1
  433. #define _POSIX_NAME_MAX 14
  434. #define dump(fp, x...)
  435. #define __WCHAR_MIN (-2147483647l - 1l)
  436. #define _IO_ERR_SEEN 0x20
  437. #define CLOCKS_PER_SEC 1000000l
  438. #define TMP_MAX 238328
  439. #define USHRT_MAX 65535
  440. #define _POSIX_CLOCKRES_MIN 20000000
  441. #define _POSIX_MAX_CANON 255
  442. #define _G_uid_t __uid_t
  443. #define _G_wint_t wint_t
  444. #define __THROW
  445. #define _WCHAR_T_DEFINED
  446. #define INT_MIN (-INT_MAX-1)
  447. #define _SYS_PARAM_H 1
  448. #define FD_ISSET(fd, fdsetp) __FD_ISSET (fd, fdsetp)
  449. #define _IO_SCIENTIFIC 04000
  450. #define __FLOAT_WORD_ORDER __BYTE_ORDER
  451. #define ____FILE_defined 1
  452. #define __unix__ 1
  453. #define COLL_WEIGHTS_MAX 255
  454. #define CHARCLASS_NAME_MAX 2048
  455. #define _BSD_SIZE_T_
  456. #define _GCC_LIMITS_H_
  457. #define __bounded
  458. #define __long_double_t long double
  459. #define SEEK_END 2
  460. #define _POSIX_CHILD_MAX 6
  461. #define _G_HAVE_SYS_CDEFS 1
  462. #define __stub_fdetach
  463. #define _IO_STDIO 040000
  464. #define _G_config_h 1
  465. #define CLOCK_THREAD_CPUTIME_ID 3
  466. #define BC_SCALE_MAX _POSIX2_BC_SCALE_MAX
  467. #define _IO_HAVE_SYS_WAIT _G_HAVE_SYS_WAIT
复制代码
回复 支持 反对

使用道具 举报

发表于 2005-12-1 12:08:24 | 显示全部楼层
好!不过如果是转贴命令行操作,建议用[quote][/quote]
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表