Mail Archives: djgpp/2000/06/20/10:15:42
Hello.
Hans-Bernhard Broeker wrote:
>
> batchex <thedark1NOthSPAM AT phreaker DOT net DOT invalid> wrote:
>
> > The reason I'm asking this cause in one of my project, one (only
> > one) of the source file, when compiled with optimation, then try
> > to debug a function contained in that file in gdb, it will give
> > errorneous results.
[snip]
> Or was that function an inline assembly one, by any chance? If so,
> it's probably just plain buggy if optimization prevents you to run the
> debugger over it.
When I have done debugging on libsocket, I found that normal breakpoints
failed to work sometimes. I found that hardware breakpoints were much more
successful - e.g. "hb lsck_init". Otherwise gdb would not stop in the
routine that I asked it to. I guessed that this was some problem due to
libsocket calling in Windows virtual device drivers. It might be worth
trying a hardware breakpoint instead of a software breakpoint.
> > I forgot if gdb crashed while debugging it or not, but I remember
> > peculiar flow of my program.
>
> 'Peculiar flow' of control may not mean anything bad, while you're
> debugging an optimized program.
I've found that looking at the disassembly can be helpful to see if
anything weird is going on. The peculiar flow is a little distracting. It
seems to occur more at the start of a function, in my experience. In the
middle of functions things generally seem to be "smoother".
Bye,
--
Richard Dawe
[ mailto:richdawe AT bigfoot DOT com | http://www.bigfoot.com/~richdawe/ ]
- Raw text -