I have only access to a C executable (no source code/.c code) and I need to use gdb to debug it. But I keep getting a (no debugging symbols found) message. I have seen other questions similar to this but most of them suggest recompiling the source code (something I cannot do because I do not have it) or suggest the following fixes (see below), which have not worked for me.
gdb test
Reading symbols from /usr/bin/test...(no debugging symbols found)...done.
(gdb) b main
Function "main" not defined.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) b 2
No symbol table is loaded. Use the "file" command.
(gdb) file test
Reading symbols from /usr/bin/test...(no debugging symbols found)...done.
(gdb) exec-file test
(gdb) file test
Reading symbols from /usr/bin/test...(no debugging symbols found)...done.
(gdb) b 2
No symbol table is loaded. Use the "file" command.
As a side note, I cannot break at main (strange because I can guarantee this is a C executable).
I'm new to using the gdb and incredibly lost and would really appreciate any help. Many thanks in advance!
EDIT:
As suggested by @Jean-François Fabre, I have changed the executable name to foobar but am still running into the same problems. The output above has been updated:
gdb foobar
Reading symbols from /usr/bin/foobar...(no debugging symbols found)...done.
(gdb) b main
Function "main" not defined.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) b 2
No symbol table is loaded. Use the "file" command.
(gdb) file foobar
Reading symbols from /usr/bin/foobar...(no debugging symbols found)...done.
(gdb) exec-file foobar
(gdb) file foobar
Reading symbols from /usr/bin/foobar...(no debugging symbols found)...done.
(gdb) b 2
No symbol table is loaded. Use the "file" command.
objdump,readelf -s,ldd,fileto tell you about the symbols in the file [which should be present even if the debug info has been stripped]. The failure of [in gdb] ofb maincould have been the/usr/bin/testissue