Skip to content

Improved error parsing when using verilator #491

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

Merged
merged 2 commits into from
Jul 30, 2024

Conversation

alex-the-new-guy
Copy link
Contributor

Fixed/improved problem matcher regex, added support for parsing a whole project (theoretically) instead of current file only. Guess that's it.

@mshr-h
Copy link
Owner

mshr-h commented Jul 25, 2024

Thanks! I'll review it in a few days.

@@ -107,42 +107,78 @@ export default class VerilatorLinter extends BaseLinter {
command,
{ cwd: cwd },
(_error: Error, _stdout: string, stderr: string) => {
let diagnostics: vscode.Diagnostic[] = [];
//let diagnostics: vscode.Diagnostic[] = [];
Copy link
Owner

Choose a reason for hiding this comment

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

we don't need to leave the old code in the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed


// basically DiagnosticsCollection but with ability to append diag lists
let filesDiag = {};
let error_warning_counter = 0;
Copy link
Owner

Choose a reason for hiding this comment

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

please use camelCase for variable name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

//let diagnostics: vscode.Diagnostic[] = [];

// basically DiagnosticsCollection but with ability to append diag lists
let filesDiag = {};
Copy link
Owner

Choose a reason for hiding this comment

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

use Map instead of Object

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

}
return;
}
this.logger.warn('[verilator] failed to parse error: ' + line);
});
this.logger.info(`[verilator] ${diagnostics.length} errors/warnings returned`);
this.diagnosticCollection.set(doc.uri, diagnostics);
this.logger.info(`[verilator] ${error_warning_counter} errors/warnings returned`);
Copy link
Owner

@mshr-h mshr-h Jul 26, 2024

Choose a reason for hiding this comment

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

can be something like this instead of counting error/warning.

[...filesDiag.values()].reduce((total, arr) => total + arr.length, 0))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After it's done, Verilator prints something like %Error: Exiting due to 3 error(s) and 2 warning(s), which is passed through to the user (well, console). This message is redundant and less informative, thus has been removed entirely.

  stderr passthrough
  Improved problem matcher regex. Now importaint sections are named
  Added better tagging for output blocks.
  Added changes to changelog
Smaller stuff:
  changed container for messages to be a Map
  fixed regex that replaced slashes in windows paths
  removed old code
@alex-the-new-guy
Copy link
Contributor Author

alex-the-new-guy commented Jul 28, 2024

When / if you look at this, have a look at this, have a look at precise_highlight branch
I've added highlighting based on Verilator-provided messages and parsing for additional messages that elaborate the issue.

It's not production-quality code yet and the whole thing turned into a bit of a mess, but main functionality is there.

@mshr-h mshr-h merged commit b5b9e16 into mshr-h:main Jul 30, 2024
5 checks passed
@mshr-h
Copy link
Owner

mshr-h commented Jul 30, 2024

@alex-the-new-guy LGTM. Thanks!
I'll also check your email later.

@alex-the-new-guy alex-the-new-guy deleted the regex_fix branch July 31, 2024 19:11
@zoomer-k
Copy link
Contributor

zoomer-k commented Feb 4, 2025

@mshr-h
#512
this commit contain problem for windows
could you rollback ?

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