# Learning gdb (gdb, breakpoint and shared library)



## Ishayahu (Oct 12, 2014)

I'm trying to debug the following program:

```
#include <stdio.h>
#include <string.h>

int main() {
   char str_a[20];

   strcpy(str_a, "Hello World!\n");
   printf(str_a);
}
```

I set a breakpoint in strcpy, but I can't reach it. Why?


```
ishayahu@zabbix-agent-9:~ % gdb -q ca2
(gdb) break strcpy
Function "strcpy" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (strcpy) pending.
(gdb) r
Starting program: /usr/home/ishayahu/ca2
Breakpoint 2 at 0x28168800
Pending breakpoint "strcpy" resolved
Hello World!

Program exited with code 015.
(gdb)
```

Thanks for the help!


----------



## mag (Oct 22, 2014)

Try compiling using gcc -fno-builtin. In this way, it will not use strcpy as __builtin_strcpy. Look here for more info.


----------

