A weird problem with x64sc, using the binary monitor interface.
VICE version shows: 3.5 (GTK3 3.24.24, GLib 2.66.3)
Windows 10
x86_64 (64-bit)
Running VICE with this command:
Calling x64sc.exe with +truedrive -virtualdev -initbreak 0xa871 -binarymonitor -binarymonitoraddress 127.0.0.1:6510 -moncommands "tmpC901.tmp" "noobtrackerdisassemblytest.prg"
moncommands only has three add_labels.
The initial breakpoint is hit ($a871), should be deleted and resumed, however the monitor stops right away again at address $0811 for no reason (request in the MON_RESPONSE_STOPPED is FFFFFFFF)
Attached is the code, the assembled file and the dialog protocol.
The order in the protocol looks a bit off between sending and processing/receiving, but that shouldn't result in stopping at some seemingly random address?
what is the content of tmpC901.tmp?
In case the mailing list didn't show, it's:
add_label $0815 .getnewblock
add_label $081F .loop
add_label $082F .empty
I'm digging deeper into this, one thing that stands out, I receive four packages when the initial break point is hit, even before I send anything towards VICE:
MON_RESPONSE_CHECKPOINT_INFO - expected, shows breakpoint got hit
MON_RESPONSE_REGISTER_INFO - expected, current register info
MON_RESPONSE_STOPPED - expected, debugger stopped here
MON_RESPONSE_RESUMED <- NOT expected, why resume?
Will VICE auto-resume on the initial breakpoint?
That's something I didn't expect, so the rest may be a symptom of me sending in more messages.
FWIW: Someone gave me a preview version (3.4-something) to test the binary interface, and back then that MON_RESPONSE_RESUMED was not sent.
I'm not sure what's happening here, but the behavior with moncommands and autostart has changed a few times before 3.5 release and I had to make some changes to my debugger to work with it. Hopefully it has stabilized now. I'll look at this though because the resume doesn't make any sense. It would make sense for the last command to be a stop.
It shouldn't
Actually, important question, are you connecting before the breakpoint gets hit? If not you may miss it, I think.
I wrote a test to verify your scenario. It looks like this:
void i_love_georg(CuTest *tc) {
int length;
uint32_t response_id = 0x00000000;
}
This is the result:
BLAHPORT=6511 ; while ! nc -z localhost $BLAHPORT ; do echo -n . ; done ; ./remotetest $BLAHPORT i_love_georg
..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................i_love_georg: request 1: CID ffffffff RID ffffffff length 34 type 11 error 0
i_love_georg: request 2: CID 2b16d2cc RID ffffffff length 54 type 31 error 0
i_love_georg: request 3: CID 2b16d2cc RID ffffffff length 14 type 62 error 0
i_love_georg: request 4: CID 2b16d2cc RID 2b16d2cc length 12 type 13 error 0
i_love_georg: request 5: CID 3d23e9af RID 3d23e9af length 12 type aa error 0
i_love_georg: request 6: CID ffffffff RID ffffffff length 14 type 63 error 0
F
There was 1 failure:
1) i_love_georg: main.c:123: assert failed
!!!FAILURES!!!
Runs: 1 Passes: 0 Fails: 1
It doesn't seem to randomly stop after the exit. It just keeps going. Does my code seem to reflect your scenario accurately? Let me know as I'm dealing with some pain and mental fog at the moment.
1) Yes, I am connecting before hitting the breakpoint.
2)
That seems to be the issue, yes.
It’s as if hits the breakpoint, but then simply continues on its merry way.
I had that also happen with a few other programs, at different addresses.
The fourth message (resume) is not sent from VICE in the 3.4.WIP version you sent me before the 3.5 release.
This resume is also sent if I disable all sending from my client.
I can't reproduce your issue with the code I posted. The code I posted stops at the breakpoint and doesn't resume until the exit, so it seems to be working correctly. The failure is expected because it's just testing for the stop, which doesn't occur. Do you have any other ideas?
I'll whip up a small sample in C, using -initbreak and connecting should be enough for the resume message to appear. This is the actual problem, everything else is a followup problem (client side issue).
Has a few Windows-isms, but the intent should be clear. I'm starting VICE, connecting and only receive. I'd expect the last message be the STOPPED, but there's a followup RESUMED. Which I think is the issue at hand, it shouldn't resume.
Hope that helps :)
What happens if you wait for VICE's connection to become active before creating the socket? I was using netcat to test for the connection before running the test program. Not sure if that would change anything.
Could you help me understand how to build your test program on Windows? I'm not well experienced with C on Windows.
To build you'd just create an empty C++ console project (Visual Studio), paste the file inside and hit compile. If you want here's the binary.
What do you mean with "becomes active"? Check whether the listen socket is open? How would I do that without trying to connect?
Last edit: Georg 2021-02-06
I was able to compile your program with cl.exe after fiddling around a little bit. I changed it to try to connect in a loop. I tried using netcat as I did on Linux, but it was too slow to be effective. I am seeing the issue you noted now. I assume it's a Windows specific issue. I will look at this more after some sleep.
Awesome, if you need any further help or testing, I'm at your service!
This should be fixed, but would it be possible to use the autostart command through the interface instead of passing it at the command line? You might get a better result that way.
You also wouldn't have to worry about race conditions from not connecting fast enough.
Which autostart command are you referring to? MON_CMD_AUTOSTART ?
I'm using the command line to remote control VICE for debugging via C64Studio.
I'm using the initial breakpoint as a first step to add all other breakpoints, since I want to avoid triggering all data (store/fetch) breakpoints during the RAM initialisiation.
I'll look into MON_CMD_AUTOSTART, thanks for the hint!
Can I confirm that you're still seeing this? Your test code doesn't present the issue anymore.
Is there a temporary Windows build of the latest changes somewhere I can use to double check?
The latest experimental binary is from december.
you can always get a fresh automatic build here:
https://github.com/VICE-Team/svn-mirror/releases
Rats, I keep forgetting. I tried with the latest available, build 40225. I see you updated the version. For testing I simply allowed version 02 as well.
With the sample code everything's fine.
Using C64Studio I still receive that breakpoint. Can it be that a MON_CMD_MEMORY_GET request enters the monitor state?
The thread 0x2ec4 has exited with code 0 (0x0).
The thread 0x3e38 has exited with code 0 (0x0).
<<<<<<< OnDataReceived 12 bytes received
<<<<<<< OnDataReceived 0202160000001100FFFFFFFF
<<<<<<< OnDataReceived 104 bytes received
<<<<<<< OnDataReceived 010000000171A871A80101040001000000000000000002022A0000003100FFFFFFFF0A00030371A803003A0003010500030214000304F80003372F0003383700030523000335C90003361F000202020000006200FFFFFFFF71A80202020000006300FFFFFFFF71A8
============ Response is MON_RESPONSE_CHECKPOINT_INFO
Processing package 0202160000001100FFFFFFFF010000000171A871A801010400010000000000000000 for request FFFFFFFF
Breakpoint 1 hit
Remove initial breakpoint 1
QueueRequest - sending data directly? Queue has 0 entries, request is DELETE_BREAKPOINT, current request type is NONE, current incoming data is 0202160000001100FFFFFFFF010000000171A871A80101040001000000000000000002022A0000003100FFFFFFFF0A00030371A803003A0003010500030214000304F80003372F0003383700030523000335C90003361F000202020000006200FFFFFFFF71A80202020000006300FFFFFFFF71A8
-no
QueueRequest - sending data directly? Queue has 1 entries, request is ADD_BREAKPOINT, current request type is NONE, current incoming data is 0202160000001100FFFFFFFF010000000171A871A80101040001000000000000000002022A0000003100FFFFFFFF0A00030371A803003A0003010500030214000304F80003372F0003383700030523000335C90003361F000202020000006200FFFFFFFF71A80202020000006300FFFFFFFF71A8
-no
QueueRequest - sending data directly? Queue has 2 entries, request is EXIT, current request type is NONE, current incoming data is 0202160000001100FFFFFFFF010000000171A871A80101040001000000000000000002022A0000003100FFFFFFFF0A00030371A803003A0003010500030214000304F80003372F0003383700030523000335C90003361F000202020000006200FFFFFFFF71A80202020000006300FFFFFFFF71A8
-no
============ Response is MON_RESPONSE_REGISTER_INFO
Processing package 02022A0000003100FFFFFFFF0A00030371A803003A0003010500030214000304F80003372F0003383700030523000335C90003361F00 for request FFFFFFFF
Register 03 = A871
Register 00 = 003A
Register 01 = 0005
Register 02 = 0014
Register 04 = 00F8
Register 37 = 002F
Register 38 = 0037
Register 05 = 0023
Register 35 = 00C9
Register 36 = 001F
============ Response is MON_RESPONSE_STOPPED
Processing package 0202020000006200FFFFFFFF71A8 for request FFFFFFFF
============ Response is MON_RESPONSE_RESUMED
Processing package 0202020000006300FFFFFFFF71A8 for request FFFFFFFF
------> StartNextRequest:DELETE_BREAKPOINT
Can you clarify what you mean by "enters the monitor state"? I thought I replied to this but I forgot that SF emails aren't replyable.
I mean VICE halts the emulation and enters the break state. Does it do that when a get memory request is sent? (I understand that sending a get memory request is wrong when emulation is running, just asking out of curiousity)
Yes, any data sent to VICE will cause emulation to stop.