Date: Wed, 18 Sep 1996 10:49:17 +0200 (IST) From: Eli Zaretskii To: Ian Romanick Cc: djgpp AT delorie DOT com Subject: Re: Debug before main? In-Reply-To: <323ED3B1.3174@cs.pdx.edu> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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.