GDB No line in file error

Hi, I have a c program i compile with gcc4.5. This elf, if I use gdb and put a breakpoint on main, instead has a breakpoint in a function other than main or says no line in file.

I verified the elf is 1 to 1 with source, have all debug symbols for compilation etc.

The problem I think is the gdb version is older one on the target filesystem. Because If I use an older gcc to compile the program instead, gdb on target just works fine.

So the question is, are there any compile flags needed with gcc4.5 to support debugging on older gdb's?

First of all you must know which symbols you use. Is program limited with some kind of object or machine capabilities. So you can user readelf(1) command to get all symbols.
After that create mapfile and define local binding symbols and remove all other symbols which are machine or software capabilities using auto-remove directive (*), than run your gnu linker and provide new mapfile to link your program :smiley:

Hi,
i am not able to see the listing of code in the gdb. i tried to use the directory command to give the soure directory tree but it is not working :wall:any suggestion