www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/18/04:13:53

Date: Wed, 18 Sep 1996 10:49:17 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Ian Romanick <idr AT cs DOT pdx DOT edu>
Cc: djgpp AT delorie DOT com
Subject: Re: Debug before main?
In-Reply-To: <323ED3B1.3174@cs.pdx.edu>
Message-Id: <Pine.SUN.3.91.960918104353.403C-100000@is>
Mime-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019