Home > front end >  Why does `__vfprintf_internal` (`printfn` from the `stdio.h`) force the `$rbp` to jump 6313864 bytes
Why does `__vfprintf_internal` (`printfn` from the `stdio.h`) force the `$rbp` to jump 6313864 bytes

Time:10-18

I am having hard times to figure out what's happening.

Here is what I see in the gdb session when dive deeper into a printfn from the stdio.h on Linux:

#1 0x00007ffff7ddb81f in __printf (format=) at ./st
dio-common/printf.c:33

488 (gdb) p $rbp

489 $39 = (void *) 0x7ffff798fff8

So far so good.

Let's step into the next call (which is the __vfprintf_internal) and see what the %rbp will be then:

(gdb) p $rbp

504 $41 = (void *) 0x7ffff7f95780 <IO_2_1_stdout

The difference between both values is 6313864 bytes. How is that possible? What is happening?!

P.S. I explicitly use -fno-omit-frame-pointer to ensure the %rbp preservation.

CodePudding user response:

You might be compiling with -fno-omit-frame-pointer, but it looks like the libc was not. So rbp could have been used as a general purpose register inside the glibc.

  • Related