This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Debugging a gdb source


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]