so im trying to debug this simple c program
#include<stdio.h>
#include<string.h>
int main(){
char str_a[20];
strcpy(str_a,"Hello, world!\n");
printf(str_a);
return 0;}
gcc -g -o prog prog.c
gdb -q ./prog
(gdb) list
1 #include<stdio.h>
2 #include<string.h>
3
4 int main(){
5
6 char str_a[20];
7
8 strcpy(str_a,"Hello, world!\n");
9 printf(str_a);
10
(gdb) break 7
Breakpoint 1 at 0x757: file char_array.c, line 7.
(gdb) break strcpy
Function "strcpy" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 2 (strcpy) pending.
(gdb) break 9
Breakpoint 3 at 0x76a: file char_array.c, line 9.
(gdb) r
Starting program: /home/pinguino/Desktop/char_array
Breakpoint 1, main () at char_array.c:8
8 strcpy(str_a,"Hello, world!\n");
(gdb) c
Continuing.
Breakpoint 3, main () at char_array.c:9
9 printf(str_a);
As u can see it entirely skips the strcpy breakpoint... This question has already been posted on sites like stackoverflow but none of the answers there helped me: I've tried adding -fno-builtin but no results whatsoever. Help, I'm lost.
Some more info: uname --all Linux 4.10.0-33-generic #37-Ubuntu SMP Fri Aug 11 10:55:28 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux