This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: Debugging a gdb source
- From: Eli Zaretskii <eliz at elta dot co dot il>
- To: "Kotian, Deepak" <Deepak dot Kotian at patni dot com>
- Cc: gdb at sources dot redhat dot com
- Date: 09 Mar 2004 08:51:22 +0200
- Subject: Re: Debugging a gdb source
- References: <374639AB1012AA4C840022842AA95BC2016D1514@ruby.patni.com>
- Reply-to: Eli Zaretskii <eliz at elta dot co dot il>
> Date: Tue, 9 Mar 2004 11:23:25 +0530
> From: "Kotian, Deepak" <Deepak.Kotian@patni.com>
>
> 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.