Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WRD_DebugOut breaks code debugging #43

Open
darksotmoon opened this issue Jul 3, 2024 · 1 comment
Open

WRD_DebugOut breaks code debugging #43

darksotmoon opened this issue Jul 3, 2024 · 1 comment

Comments

@darksotmoon
Copy link

Test script

debug::print("debug out");
str::printf("end");

The first single step will stop on line 1 as expected. Client sends WRD_RequestStepInto, server executes script and sends back WRD_Ok.

Then the next single step will fail. What happens is that the client WRDebugClientInterfacePrivate::trapRunOutput will send WRD_RequestStepInto, then the server executes the code, which involves sending back WRD_DebugOut then WRD_Ok.

WRDebugClientInterfacePrivate::trapRunOutput will receive WRD_DebugOut in the loop and then send the WRD_RequestStepInto again. The server executes this and sends back WRD_Ok so the client ends up with three WRD_Ok replies. Not sure where the third WRD_Ok comes from.

The problem is that WRDebugClientInterfacePrivate::transmit is really transmit_receive so it can't receive two packets ( WRD_DebugOut then WRD_Ok) without transmitting again.

I renamed transmit to transmit_receive and then added transmit and receive functions. Then WRDebugClientInterfacePrivate::trapRunOutput looks like:

if(transmit( WrenchPacketScoped(WrenchPacket::alloc(packet)) ))
{
	bool done = false;
	while(!done)
	{
		WrenchPacket *reply = receive();
		if(reply)
		{
			if( reply->_type == WRD_DebugOut )
			{
				printf( "%s", (char*)reply->payload() );
			}
			else
				done = true;
			g_free( reply );
		}
	}
}
@jingoro2112
Copy link
Owner

jingoro2112 commented Jul 3, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants