Skip to content

Conversation

@xujuntwt95329
Copy link
Collaborator

No description provided.

* in the cluster, otherwise ignore this event */
status = 0;

/* By design, all the other threads should stopped at this
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should stop or should have been stopped?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 999 to 1001
/* Resume all threads so they can receive the TERM signal */
exec_env->current_status->running_status = STATUS_RUNNING;
os_cond_signal(&exec_env->wait_cond);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we wrap os_cond_signal with os_mutex_lock(&exec_env->wait_lock) and os_mutex_unlock(&exec_env->wait_lock)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 148 to 149
request = inbuf[0];
payload = (char *)&inbuf[1];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the inbuf's length be no smaller than 2? Shall we check the length here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a check for request. If it's '\0', that means this is an empty request, and we ignore it

payload = (char *)&inbuf[1];

LOG_VERBOSE("receive request:%c %s\n", request, payload);
handler_packet(server, request, payload);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about changing handle_packet?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

{
if (ctx->receive_index >= sizeof(ctx->receive_buffer)) {
LOG_ERROR("RSP message buffer overflow");
bh_assert(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had better add return?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

tid = wasm_debug_instance_wait_thread(
(WASMDebugInstance *)server->thread->debug_instance, tid, &status);
/* Waiting for the stop event */
while (!debug_inst->stopped_thread) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dead loop occupies a lot CPU resource, is it possible to wait a signal? Or add a timeout wait inside the loop?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

/* lock the debug_inst->wait_lock so
other threads can't fire stop events */
os_mutex_lock(&cluster->debug_inst->wait_lock);
while (cluster->debug_inst->stopped_thread == exec_env) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, can we add os_cond_timedwait(&cluster->debug_inst->wait_cond, ..) inside loop?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks!

Comment on lines +151 to +154
if (request == '\0') {
LOG_VERBOSE("ignore empty request");
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should move these lines before L149? If inbuf[0] is '\0', we should not read inbuf[1] in L149?

@wenyongh wenyongh merged commit 3fe191b into bytecodealliance:main Feb 16, 2022
vickiegpt pushed a commit to vickiegpt/wamr-aot-gc-checkpoint-restore that referenced this pull request May 27, 2024
…codealliance#989)

Allow to set break point again when all break points are removed and
wasm app starts running.
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

Successfully merging this pull request may close these issues.

2 participants