seL4 / microkit

Microkit - A simple operating system framework for the seL4 microkernel
Other
70 stars 37 forks source link

tool: Add `__str__` and `__repr__` methods to `Sel4Aarch64Regs` #78

Closed nspin closed 5 months ago

nspin commented 8 months ago

Sel4Aarch64Regs are appended to reports using str(). Without these methods, the report doesn't contain any useful information about them.

lsf37 commented 8 months ago

It looks like the style checker is crashing on this, which I haven't seen before:

CRITICAL:root:['tool/microkit/sel4.py'] failed with error code 1
b'Traceback (most recent call last):\n  File "/home/runner/.local/bin/autopep8", line 8, in <module>\n    sys.exit(main())\n  File "/home/runner/.local/lib/python3.10/site-packages/autopep8.py", line 4161, in main\n    ret = fix_multiple_files(args.files, args, sys.stdout)\n  File "/home/runner/.local/lib/python3.10/site-packages/autopep8.py", line 4063, in fix_multiple_files\n    ret = _fix_file((name, options, output))\n  File "/home/runner/.local/lib/python3.10/site-packages/autopep8.py", line 4043, in _fix_file\n    return fix_file(*parameters)\n  File "/home/runner/.local/lib/python3.10/site-packages/autopep8.py", line 3423, in fix_file\n    fixed_source = fix_lines(fixed_source, options, filename=filename)\n  File "/home/runner/.local/lib/python3.10/site-packages/autopep8.py", line 3403, in fix_lines\n    fixed_source = fix.fix()\n  File "/home/runner/.local/lib/python3.10/site-packages/autopep8.py", line 587, in fix\n    self._fix_source(filter_results(source=\'\'.join(self.source),\n  File "/home/runner/.local/lib/python3.10/site-packages/autopep8.py", line 531, in _fix_source\n    modified_lines = fix(result)\n  File "/home/runner/.local/lib/python3.10/site-packages/autopep8.py", line 717, in fix_e225\n    pycodestyle.missing_whitespace_around_operator(fixed, ts))\nAttributeError: module \'pycodestyle\' has no attribute \'missing_whitespace_around_operator\'. Did you mean: \'whitespace_around_operator\'?\n'

Fine to ignore for this PR, but we should probably look into this at some point.

nspin commented 8 months ago

For reference, here it is formatted:

Traceback (most recent call last):
  File "/home/runner/.local/bin/autopep8", line 8, in <module>
    sys.exit(main())
  File "/home/runner/.local/lib/python3.10/site-packages/autopep8.py", line 4161, in main
    ret = fix_multiple_files(args.files, args, sys.stdout)
  File "/home/runner/.local/lib/python3.10/site-packages/autopep8.py", line 4063, in fix_multiple_files
    ret = _fix_file((name, options, output))
  File "/home/runner/.local/lib/python3.10/site-packages/autopep8.py", line 4043, in _fix_file
    return fix_file(*parameters)
  File "/home/runner/.local/lib/python3.10/site-packages/autopep8.py", line 3423, in fix_file
    fixed_source = fix_lines(fixed_source, options, filename=filename)
  File "/home/runner/.local/lib/python3.10/site-packages/autopep8.py", line 3403, in fix_lines
    fixed_source = fix.fix()
  File "/home/runner/.local/lib/python3.10/site-packages/autopep8.py", line 587, in fix
    self._fix_source(filter_results(source=''.join(self.source),
  File "/home/runner/.local/lib/python3.10/site-packages/autopep8.py", line 531, in _fix_source
    modified_lines = fix(result)
  File "/home/runner/.local/lib/python3.10/site-packages/autopep8.py", line 717, in fix_e225
    pycodestyle.missing_whitespace_around_operator(fixed, ts))
AttributeError: module 'pycodestyle' has no attribute 'missing_whitespace_around_operator'. Did you mean: 'whitespace_around_operator'?

A quick search suggests its due to packages with incompatible versions.

Ivan-Velickovic commented 7 months ago

What about something like https://github.com/Ivan-Velickovic/microkit/commit/ac3032c45238114c993a5f3577fc1bf2a2de9499 instead? This PR prints the registers without what each register corresponds to which makes it difficult to know what's going on.

The patch I just linked is a bit more verbose but at the benefit of showing to the user what each value corresponds to.

Ivan-Velickovic commented 5 months ago

@nspin, are you okay if I close this and replace it with https://github.com/Ivan-Velickovic/microkit/commit/ac3032c45238114c993a5f3577fc1bf2a2de9499?

nspin commented 5 months ago

@Ivan-Velickovic yes! I think the more verbose output is better than just the raw value.