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

fix confusing status messages during resume #1031

Merged
merged 1 commit into from
Apr 27, 2024

Conversation

aap-sc
Copy link
Collaborator

@aap-sc aap-sc commented Mar 21, 2024

Recently, (after b503fde) OpenOCD started to notify user about hart state updates. This causes confusion in some cases since some internal updates to the hart state should not be visible to the user as these are implementation details. For example situation like this:

> reset halt
JTAG tap: riscv.tap tap/device found: 0xdeadbeef ...
> resume
[riscv.cpu0] Found 4 triggers
riscv.cpu0 halted due to single-step.
[riscv.cpu1] Found 4 triggers
riscv.cpu1 halted due to single-step.
[riscv.cpu2] Found 4 triggers
riscv.cpu2 halted due to single-step.
[riscv.cpu3] Found 4 triggers
riscv.cpu3 halted due to single-step.

likely confuse people.

There is no issue with the resume functionality. It`s just that resume internally causes single-step that causes hart state to change.

This commit disable calling of user-specified (and default) callbacks during the "hidden" step operation disabling these confusing messages

Change-Id: I3412a089e2abdcd315d86cec7ee732fdd18c1601

@aap-sc
Copy link
Collaborator Author

aap-sc commented Mar 21, 2024

NOTE: this is more like a temporary solution to hide the problem. The situation with these "hidden" step and user-specified callbacks is not quite obvious. I'm going to clarify this with openocd maintainers in upstream.

Also, this commit only fixes 0.13 implementations. 0.11 is still affected. Will address this in future

en-sc
en-sc previously approved these changes Mar 25, 2024
Copy link
Collaborator

@en-sc en-sc left a comment

Choose a reason for hiding this comment

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

@JanMatCodasip, @MarekVCodasip, please, take a look at the patch.
I have already reviewed it internally.

Copy link
Collaborator

@MarekVCodasip MarekVCodasip left a comment

Choose a reason for hiding this comment

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

Thank you for the patch.

I have commented my opinion on the TODO, please take a look.

Otherwise it looks good to me.

@@ -3361,7 +3373,8 @@ int riscv_openocd_step(struct target *target, int current,
LOG_TARGET_ERROR(target, "Unable to restore the disabled breakpoint.");
}

if (success) {
// TODO: should we update debug_reason if no callback was called?
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that we should update the debug reason even if callbacks are not to be handled.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

addressed

Copy link
Collaborator

@JanMatCodasip JanMatCodasip Apr 25, 2024

Choose a reason for hiding this comment

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

@MarekVCodasip Marek, can you please quickly re-check this PR now that your suggestion has been addressed. Thanks.

Recently, (after b503fde) OpenOCD started to notify user about hart
state updates. This causes confusion in some cases since some internal
updates to the hart state should not be visible to the user as these are
implementation details. For example situation like this:

```
> reset halt
JTAG tap: riscv.tap tap/device found: 0xdeadbeef ...
> resume
[riscv.cpu0] Found 4 triggers
riscv.cpu0 halted due to single-step.
[riscv.cpu1] Found 4 triggers
riscv.cpu1 halted due to single-step.
[riscv.cpu2] Found 4 triggers
riscv.cpu2 halted due to single-step.
[riscv.cpu3] Found 4 triggers
riscv.cpu3 halted due to single-step.
```
likely confuse people.

There is no issue with the resume functionality. It`s just that
resume internally causes single-step that causes hart state
to change.

This commit disable calling of user-specified (and default)
callbacks during the "hidden" step operation disabling these
confusing messages

Change-Id: I3412a089e2abdcd315d86cec7ee732fdd18c1601
Signed-off-by: Parshintsev Anatoly <[email protected]>
@aap-sc aap-sc force-pushed the aap-sc/hart_status_info_fixup branch from e3f60f2 to 665fbf6 Compare April 23, 2024 23:35
@aap-sc aap-sc requested review from MarekVCodasip and en-sc April 23, 2024 23:35
Copy link
Collaborator

@en-sc en-sc left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@MarekVCodasip MarekVCodasip left a comment

Choose a reason for hiding this comment

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

LGTM

@en-sc en-sc merged commit 687f00c into riscv-collab:riscv Apr 27, 2024
4 checks passed
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.

4 participants