0

I am playing with gdb to debug and analyze simple C programs, e.g.

#include <stdio.h>
#include <stdlib.h>

int main() {
   int i = 8;

   printf("Your lucky number is %d\n", i);
}

When I debug in dbg and stop at printf call, gdb sees only the first argument, but not the second:

(gdb) break "printf"
Breakpoint 1 at 0x4004c0
(gdb) run
Starting program: /tmp/sq/a.out 

Breakpoint 1, __printf (format=0x4006f4 "Your lucky number is %d\n") at printf.c:28
28      printf.c: No such file or directory.

Why is that? And how to see the rest? Is it specific to printf?

(glibc 2.23, gcc 5.4, gdb 7.11.1 if that's relevant)

Grzegorz Oledzki
  • 23,614
  • 16
  • 68
  • 106

0 Answers0