Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!saxony!dgil From: dgil@pa.reuter.COM (Dave Gillett) Newsgroups: comp.os.msdos.programmer Subject: Re: Turbo C++ Message-ID: <626@saxony.pa.reuter.COM> Date: 11 Dec 90 23:03:23 GMT References: <25804@uflorida.cis.ufl.EDU> Distribution: na Organization: Reuter:file Inc (A Reuter Company) Palo Alto, CA Lines: 30 In <25804@uflorida.cis.ufl.EDU> jdb@reef.cis.ufl.edu (Brian K. W. Hook) writes: >I have Turbo C++ 1.00 but have noticed that it has a couple of errors, ie. >bugs. Has anyone encountered the fact that the debugger REALLY screws up >when tracing code? It seems that it arbitrarily jumps to come code at >times that resembles other code. For example: >....code... >return (0) >.....code.... >return (0) >When it should hit the first return (0) it instead jumps to the other, >completely unrelated, but syntactically similar, piece of code. The debugger works by cross-referencing locations in the source to locations in the machine language. (Use "View CPU" to see this level.) So what happens when the compiler doesn't generate any object code for the source line? The trace and breakpoints get redirected to where the actual code is. In your example, "return (0)" appears twice. This is pretty trivial, but it's not inconceivable that the compiler, as an optimization, generated the code for the second instance and a jump to it for the first instead of two copies of the code. The debugger is torn between stepping through what you wrote, and following the actual path of execution, and has opted for the latter. Dave