[comp.os.msdos.programmer] MSC 6.0 does not execute lines of C code

srini@ultra.com (S. Srinivasan) (08/04/90)

This is a posting for a friend who does not have net access
-----------------------------------------------------------

System: MSC 6.0, Medium Model, Multi-module(i.e. LINK used)
	on a '286-clone

There are occasions when writing 'C' code that a line of
code is just not executed at all.  For example, 

    *stepping in Codeview simply jumps over the source line!

    *cannot set breakpoint on source line in Codeview,
     it beeps back!!

Looking at the .COD file (produced by /Fc option?), 
which has both the 'C' source and 'ASM' lines, the correct 
ASM lines are generated.  So the culprit could be the
LINK-er, but there seems to be no way around the problem.
Sometimes retyping the whole function makes the problem go
away.  There is no pattern to this: it happens at the start
of a function, or in the middle of a function.

Once it was a call to an assembly routine:

	result = asm_routine();

and the problem went away when the routine was coded to work as:

	asm_routine(&result);

Another time it was a simple 'C' operation:

	variable = ~variable;

which refused to go away regardless of re-typing or anything else

-----------------------------------------------------------
Totally baffled !
Please respond to this account, and I will convince my friend
that USENET access is something worth shouting about.

Thanks a bunch,

srini@ultra.com
    -or-
...!ames!ultra.com!srini

t-joels@microsoft.UUCP (Avram SPOLSKY) (08/06/90)

In article <1990Aug3.172039.250@ultra.com> srini@ultra.com (S. Srinivasan) writes:
>
>    *stepping in Codeview simply jumps over the source line!
>

The source line may have been optimized away. Try turning off all
optimizations when debugging.

>    *cannot set breakpoint on source line in Codeview,
>     it beeps back!!
>

Same reason. I seem to remember that this is well documented...

Joel Spolsky
(disclaimer: I don't speak for anybody, and certainly not
for my employer).
spolsky@cs.yale.edu

mac@idacrd.UUCP (Robert McGwier) (08/06/90)

From article <1990Aug3.172039.250@ultra.com>, by srini@ultra.com (S. Srinivasan):
> 
>     *stepping in Codeview simply jumps over the source line!
> 
>     *cannot set breakpoint on source line in Codeview,
>      it beeps back!!
> 
> Totally baffled !
>



It is extremely well documented in the manuals for codeview (or most other
debuggers for that matter), you MUST turn off ALL optimizations when
doing source level debugging.

Bob
 
-- 
____________________________________________________________________________
    My opinions are my own no matter	|	Robert W. McGwier, N4HY
    who I work for! ;-)			|	CCR, AMSAT, etc.
----------------------------------------------------------------------------