Previous Thread
Next Thread
Print Thread
Writing registers from Debugger Watchpoints #115255
05/10/19 11:49 AM
05/10/19 11:49 AM
Joined: Feb 2014
Posts: 251
G
Golden Child Offline OP
Senior Member
Golden Child  Offline OP
Senior Member
G
Joined: Feb 2014
Posts: 251

I was trying to get the debugger to respond to a watchpoint and change the value returned in a register, but it didn't work as expected.

The Apple II code would LDA $C0F0 (an i/o address) and I wanted it to return a specific value in the 6502 accumulator, say 0xFF.

So my debugger watchpoint would look like this:

wp c0f0,1,r,1,{a=ff; g}

but what's interesting is that the a=ff gets executed immediately when you enter the wp command from the debugger console, which is definitely unexpected.

When it hits the actual watchpoint, doesn't actually change the accumulator's value.



If you add a printf to the watchpoint to see the value of the accumulator, you get:

wp c0f0,1,r,1,{printf "%x",a;a=ff;printf "%x",a; }

It will print what you expect, but it doesn't seem to actually change the accumulator as execution continues.

Re: Writing registers from Debugger Watchpoints [Re: Golden Child] #115289
05/13/19 04:51 PM
05/13/19 04:51 PM
Joined: Jun 2014
Posts: 83
P
peter ferrie Offline
Member
peter ferrie  Offline
Member
P
Joined: Jun 2014
Posts: 83
If you "wp c0f0,1,r,{a=0xff}" (i.e. drop the trailing '1') then it will do the expected thing.
The trailing '1' is causing the watchpoint to be evaluated immediately because it's always true, but that it activates immediately looks like a bug since the watchpoint itself isn't hit yet.

Re: Writing registers from Debugger Watchpoints [Re: Golden Child] #115290
05/13/19 07:01 PM
05/13/19 07:01 PM
Joined: May 2012
Posts: 504
S
shattered Online content
Senior Member
shattered  Online Content
Senior Member
S
Joined: May 2012
Posts: 504
Originally Posted by Golden Child

but what's interesting is that the a=ff gets executed immediately when you enter the wp command from the debugger console, which is definitely unexpected.


And feels like a bug. Interesting unexpected stuff may happen if you change pc in the expression smile


Who's Online Now
1 registered members (Lord Nightmare), 25 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Shout Box
Forum Statistics
Forums9
Topics8,654
Posts113,414
Members4,846
Most Online324
Dec 20th, 2018
Powered by UBB.threads™ PHP Forum Software 7.6.1.1
(Release build 20180111)
Page Time: 0.024s Queries: 14 (0.009s) Memory: 5.5949 MB (Peak: 5.7596 MB) Zlib enabled. Server Time: 2019-05-26 07:19:46 UTC