Skip to content

[debug] Misc debug fixes#632

Merged
aswaterman merged 7 commits intoriscv-software-src:masterfrom
hirooih:misc-debug-fixes
Nov 25, 2025
Merged

[debug] Misc debug fixes#632
aswaterman merged 7 commits intoriscv-software-src:masterfrom
hirooih:misc-debug-fixes

Conversation

@hirooih
Copy link
Copy Markdown
Contributor

@hirooih hirooih commented Nov 1, 2025

This PR includes several minor fixes for the debug tests.

See the commit log for details of each commit.

Thank you for these great test suites!

Copy link
Copy Markdown
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.

Thank you for the fixes!
I have a few concerns. Please, take a look.

Set MCONTROL_S and/or MCONTROL_U bits only if the hart supports S-mode
and/or U-mode.

Signed-off-by: Hiroo HAYASHI <24754036+hirooih@users.noreply.github.com>
TranslateTest depends on the S extension being supported.
Without this change, the test fails on targets that do not support S
extension.

Signed-off-by: Hiroo HAYASHI <24754036+hirooih@users.noreply.github.com>
@hirooih hirooih force-pushed the misc-debug-fixes branch 2 times, most recently from 68aee20 to 9cdb00f Compare November 9, 2025 15:01
@hirooih hirooih requested a review from en-sc November 21, 2025 13:50
@en-sc
Copy link
Copy Markdown
Collaborator

en-sc commented Nov 21, 2025

@hirooih, let's separate debug: enhance set_pmp_deny to support alignment checks and debug: test implements_page_virtual_memory before executing sfence.vma instruction into a different PR, so that this one can be merged?

debug/testlib.py Outdated
size = max(size, self.get_minimum_pmp_granularity(), 8)

if 2**self.ctz(address) < size:
raise TestNotApplicable(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

size is based on the result of communication with the target -- it can change sporadically.
Therefore this test can sporadically be marked as not applicable.

Consider the following alternative:

  1. minimum_pmp_granularity is a target property specified in the config.
  2. There is a test that checks that get_minimum_pmp_granularity() returns the same value as in the config.
  3. This check is moved to early_applicable() and is based on the value from the config.

This is for the dmode bit in tdata1.

Signed-off-by: Hiroo HAYASHI <24754036+hirooih@users.noreply.github.com>
This suppresses warnings like:
  Warning: Command 'gdb_port' is deprecated, please use 'gdb port' instead.
  Warning: Command 'tcl_port' is deprecated, please use 'tcl port' instead.
  Warning: Command 'telnet_port' is deprecated, please use 'telnet port' instead.

from debug/README.md:

> openocd ..., which should be the latest from https://github.com/riscv/riscv-openocd.git.

Signed-off-by: Hiroo HAYASHI <24754036+hirooih@users.noreply.github.com>
This change makes debug/testlib.py not throw an exception
when an expected error occurs while creating the logs/ directory.

Fixing this is useful when debugging with python
debugger not to break at the exception every time.

Signed-off-by: Hiroo HAYASHI <24754036+hirooih@users.noreply.github.com>
U500Sim.py is the only example of a target that uses VcsSim class.
It does not work without this fix.

Signed-off-by: Hiroo HAYASHI <24754036+hirooih@users.noreply.github.com>
example: for https://github.com/fjullien/jtag_vpi/blob/master/jtag_common.c#L80

    def create(self):
        return testlib.VcsSim(..., server_stared="^Starting jtag_vpi server:.*, port (\d+)/tcp")

Signed-off-by: Hiroo HAYASHI <24754036+hirooih@users.noreply.github.com>
@hirooih
Copy link
Copy Markdown
Contributor Author

hirooih commented Nov 21, 2025

let's separate debug: enhance set_pmp_deny to support alignment checks and debug: test implements_page_virtual_memory before executing sfence.vma instruction into a different PR, so that this one can be merged?

I did.

I've opened #636 for "debug: test implements_page_virtual_memory before executing sfence.vma instruction".
I will open another one for "debug: enhance set_pmp_deny to support alignment checks", tomorrow.

@aswaterman aswaterman merged commit 6ca449c into riscv-software-src:master Nov 25, 2025
2 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.

3 participants