From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11139 invoked by alias); 9 Mar 2004 06:49:20 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 11132 invoked from network); 9 Mar 2004 06:49:19 -0000 Received: from unknown (HELO monty-python.gnu.org) (199.232.76.173) by sources.redhat.com with SMTP; 9 Mar 2004 06:49:19 -0000 Received: from [207.232.27.5] (helo=WST0054) by monty-python.gnu.org with asmtp (Exim 4.30) id 1B0b2v-00016h-7h; Tue, 09 Mar 2004 01:48:57 -0500 Date: Tue, 09 Mar 2004 06:49:00 -0000 Message-Id: From: Eli Zaretskii To: "Kotian, Deepak" CC: gdb@sources.redhat.com In-reply-to: <374639AB1012AA4C840022842AA95BC2016D1514@ruby.patni.com> (Deepak.Kotian@patni.com) Subject: Re: Debugging a gdb source Reply-to: Eli Zaretskii References: <374639AB1012AA4C840022842AA95BC2016D1514@ruby.patni.com> X-SW-Source: 2004-03/txt/msg00065.txt.bz2 > Date: Tue, 9 Mar 2004 11:23:25 +0530 > From: "Kotian, Deepak" > > I am trying to debug gdb source on Linux using already installed > dedugger ddd or gdb. > The source code text does not seem to be in sync with the > execution when we do step. How do I get it in sync, please > let me know. The -g option seems to be set in the Makefile. Most probably, this happens because GDB is compiled with optimizations. I usually find this not to be much of a nuisance, I just need to remember stepping a couple of times more until the line I'm interested in stops being printed by GDB as the current line; then I know that this line's code finished being executed, and the variables whose values it modifies can be examined. If you are annoyed by this, I suggest to rebuild GDB without optimizations. Caveat emptor: doing so might cause the problems you are debugging to go away. That is why I suggest to get used to debugging the optimized code.