Mail Archives: djgpp/1996/09/18/04:13:53
On Tue, 17 Sep 1996, Ian Romanick wrote:
> Is there any way to use GDB to debug a program before main is called?
Just put a breakpoint in the startup code, like so:
> gdb prog
b __crt1_startup
r args ...
Note that if you want to step through the startup source code, you will
have to get the library sources, compile the appropriate functions (in
the src/libc/crt0 directory) with -g and link with these recompiled
startup code; also copy the sources of these startup functions into the
directory where you debug, to prevent complicated multi-directory setup.
> superior. Is this another of those cases where GDB just won't work? If
> it is, it might should be added to the FAQ.
I works for me. The startup code is just a piece of code, there's nothing
special about the functions there. Nothing special to be said about this
in the FAQ.
- Raw text -