Mail Archives: djgpp/2000/06/20/08:45:42
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.
That shouldn't usually happen. Not unless you compile with some of the
explicitly debugging-unfriendly options of gcc active, like
-fomit-frame-pointer. That one may make debugging hard, or even
impossible.
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.
> 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. Instruction scheduling, esp. in newer
compilers, may easily cause things to happen in somewhat unexpected
order, jumping back and forth among several source lines, and similar
'peculiarities'.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -