I have the strangest thing I've ever seen going on. I have the
following function:
void keyTable::add_key( u_short wc, u_char key )
{
// dont rebind a character
if( table[wc] == -1 )
table[wc] = key;
}
When I run the program and step into this function, the only line the
debugger shows as executable is the comment. There is no tick mark
beside the other lines for setting a breakpoint and the breakpoint I
set while the program was not running is dimmed.
I haven't examined the disassembly in detail, but it looks OK to me
when the program is not running:
void keyTable::add_key( u_short wc, u_char key )
{
00000000: 5480043E clrlwi r0,r4,16 ; rlwinm
r0,r4,0,16,31
00000004: 7C430214 add r2,r3,r0
00000008: 88020004 lbz r0,4(r2)
0000000C: 2C00FFFF cmpwi r0,$ffff
00000010: 40820010 bne *+16 ; $00000020
// dont rebind a character
if( table[wc] == -1 )
table[wc] = key;
00000014: 5480043E clrlwi r0,r4,16 ; rlwinm
r0,r4,0,16,31
00000018: 7C430214 add r2,r3,r0
0000001C: 98A20004 stb r5,4(r2)
00000020: 4E800020 blr
}
However, the moment I step into the function, I end up at the blr
statement (if in source view, my PC is pointing at the comment).
I have removed all objects from all targets and rebuilt.
All optimizations are off.
Anyone ever seen anything like this?
Thanks,
Wade
Gregory Weston - 30 Dec 2004 00:51 GMT
> I have the strangest thing I've ever seen going on. I have the
> following function:
[quoted text clipped - 5 lines]
> table[wc] = key;
> }
Is table an array of _unsigned_ values? And you're comparing an element
in that array to a negative number?
G

Signature
Change account to gw when responding by mail.
Scott Ribe - 30 Dec 2004 00:51 GMT
> Anyone ever seen anything like this?
Yes, all the time. It seemed to start at about the time I starting mixing in
a little Cocoa and using Objective-C++, but occurs in plain C++ files.
You'll probably find that if you add a second function identical except for
the name, such as add_key2, and call that, you'll be able to debug it
properly.
Removing object code, rebuilding, removing preferences, disabling debugger's
symbol caching--all seem to have no effect on this problem.