glibc中printf()的跟踪代码
我已经下载了 glibc
(GNU c
库)的源代码,版本 - 2.15.90。我正在跟踪 printf() 函数的代码。我正在使用工具 cscope
和 ctags
浏览代码。以下是我理解 printf() 函数的路径。 (在这里,我只是提到函数调用):-
1. Opening file "glibc/stdio-common/printf.c"
2. int __printf (const char *format, ...)
3. __extern_always_inline int vfprintf (FILE *__restrict __stream, const char *__restrict __fmt, _G_va_list __ap)
4. int attribute_hidden __vfprintf_chk (FILE *s, int flag, const char *fmt, va_list ap)
5. int attribute_compat_text_section __nldbl___vfprintf_chk (FILE *s, int flag, const char *fmt, va_list ap)
一旦我到达函数 \__nldbl___vfprintf_chk()
,就会调用 __vfprintf_chk()
,因此最后两个函数(提到第 4 点和第 5 点)互相调用。我哪里做错了?
I have downloaded source code of glibc
(GNU c
library), version - 2.15.90. I was tracing the code of printf()
function. I am using tools cscope
and ctags
to browse through code. Following is the path I traverse to understand printf()
function. (Here, am just mentioning function calls) :-
1. Opening file "glibc/stdio-common/printf.c"
2. int __printf (const char *format, ...)
3. __extern_always_inline int vfprintf (FILE *__restrict __stream, const char *__restrict __fmt, _G_va_list __ap)
4. int attribute_hidden __vfprintf_chk (FILE *s, int flag, const char *fmt, va_list ap)
5. int attribute_compat_text_section __nldbl___vfprintf_chk (FILE *s, int flag, const char *fmt, va_list ap)
Once I reached upto function \__nldbl___vfprintf_chk()
, there is a call to __vfprintf_chk()
and thus last 2 functions (mentioned in point 4 and 5) calls each other. Where did I go wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在调用中没有看到这样的内容,
printf
快速跳转到vfprintf
真正起作用 我想说你的源代码浏览器正在运行,glibc 是相当宏密集的。I see no such at calls,
printf
quickly jumps intovfprintf
which does the real work I'd say your source code browser is acting up, glibc is pretty macro intensive.