Hi Roey,
Can you clarify whether this is happening when debugging under optimization
level 0 or 1? You may want to bear in mind that debugging with optimizations
on may produce some weirdness like this i.e. breakpoint lines not appearing
for certain code because the code has been optimized out.
Rgds,
Jun-Kiat Lam
Metrowerks Technical Support
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 21, 1999 3:18 PM
Subject: UPDATE: cw6 fails to generate code in some cases
> Hi,
>
> I have some additional insight to the nature of the problem.
>
> First of all, as the disassembly below shows, code *is* actually generated
> by the compiler. In fact, based on some testing, *correct* code is being
> generated by the compiler.
>
> The problem appears to be the Metrowerks debugger. It does not allow the
> user to put breakpoints in the if-else code in question (no dashes appear
> to the left of the code). Furthermore, the debugger does not display the
> state of the copyLen variable during a debug session.
>
> This is reproducible under different projects on installations of
> CodeWarrior. It happens under POSE as well as on an actual Palm device.
>
> - Roey
>
> Roey Ben-Yoseph <[EMAIL PROTECTED]>
> Globalware Computing
>
> ---------------------- Forwarded by Roey Ben-Yoseph/Globalware on 12/21/99
> 03:09 PM ---------------------------
>
>
> Roey Ben-Yoseph
> 12/21/99 02:23 PM
>
> To: [EMAIL PROTECTED]
> cc:
>
> Subject: Re: cw6 fails to generate code in some cases
>
> >"Neil Rhodes"
> >on 12/20 at 07:54 PM
> >Can you please do a disassembly of this code and post the disassembly
> also.
> >
> >Neil
>
> Sure thing Neil. See below.
>
> - Roey
>
> Roey Ben-Yoseph <[EMAIL PROTECTED]>
> Globalware Computing
>
> ++++++++++++++++++++++++++++++++++++++++
>
> file://===== S O U R C E =====
>
> static Word BuildTextLine(CharPtr dstStr, CharPtr srcStr)
> {
> Word dstStrLen;
> Word srcStrLen;
> Word copyLen;
>
> dstStrLen = StrLen(dstStr);
> srcStrLen = StrLen(srcStr);
>
> if(dstStrLen >= 37)
> return dstStrLen;
>
> //// No code is generated for this source ////
> if( (dstStrLen + srcStrLen) <= 37)
> {
> copyLen = srcStrLen;
> }
> else
> {
> copyLen = (srcStrLen - ( (dstStrLen + srcStrLen) - 37));
> }
> //// No code is generated for this source ////
>
> return copyLen;
>
> }
>
>
> file://===== M I X E D =====
>
> static Word BuildTextLine(CharPtr dstStr, CharPtr srcStr)
> {
> 0003E436: 4E560000 link a6,#0
> 0003E43A: 2F04 move.l d4,-(sp)
> 0003E43C: 2F03 move.l d3,-(sp)
> Word dstStrLen;
> Word srcStrLen;
> Word copyLen;
>
> dstStrLen = StrLen(dstStr);
> 0003E43E: 2F2E0008 move.l 8(a6),-(sp)
> 0003E442: 4E4F trap #15
> 0003E444: A0C7 _StrLen
> 0003E446: 3600 move.w d0,d3
> srcStrLen = StrLen(srcStr);
> 0003E448: 2F2E000C move.l 12(a6),-(sp)
> 0003E44C: 4E4F trap #15
> 0003E44E: A0C7 _StrLen
> 0003E450: 3800 move.w d0,d4
>
> if(dstStrLen >= 37)
> 0003E452: 0C430025 cmpi.w #37,d3
> 0003E456: 504F addq.w #8,sp
> 0003E458: 6504 bcs.s *+6 ; 0x0003e45e
> return dstStrLen;
> 0003E45A: 3003 move.w d3,d0
> 0003E45C: 601C bra.s *+30 ; 0x0003e47a
>
> //// No code is generated for this source ////
> if( (dstStrLen + srcStrLen) <= 37)
> {
> copyLen = srcStrLen;
> }
> else
> {
> copyLen = (srcStrLen - ( (dstStrLen + srcStrLen) - 37));
> }
> //// No code is generated for this source ////
>
> return copyLen;
> 0003E45E: 3003 move.w d3,d0
> 0003E460: D044 add.w d4,d0
> 0003E462: 0C400025 cmpi.w #37,d0
> 0003E466: 6204 bhi.s *+6 ; 0x0003e46c
> 0003E468: 3004 move.w d4,d0
> 0003E46A: 600E bra.s *+16 ; 0x0003e47a
> 0003E46C: 3003 move.w d3,d0
> 0003E46E: D044 add.w d4,d0
> 0003E470: 0640FFDB addi.w #-37,d0
> 0003E474: 3204 move.w d4,d1
> 0003E476: 9240 sub.w d0,d1
> 0003E478: 3001 move.w d1,d0
>
> 0003E47A: 261F move.l (sp)+,d3
> 0003E47C: 281F move.l (sp)+,d4
> 0003E47E: 4E5E unlk a6
> 0003E480: 4E75 rts
> 0003E482: 8D427569 pack d2,d6,#0x7569
> 0003E486: 6C64 bge.s *+102 ; 0x0003e4ec
> 0003E488: 5465 addq.w #2,-(a5)
> 0003E48A: 7874 moveq #116,d4
> 0003E48C: 4C696E650000 divs.l 0(a1),d5:d6
>
>
>
>