Search code examples
cprintfglibctrace

Tracing code of printf() in glibc


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?


Solution

  • I see no such at calls, printf quickly jumps into vfprintf which does the real work I'd say your source code browser is acting up, glibc is pretty macro intensive.