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: debug info print with depth #5903

Merged
merged 1 commit into from
Aug 28, 2023

Conversation

JesseCodeBones
Copy link
Contributor

Split from #5547.
Focus on debug info print optimization.

@JesseCodeBones
Copy link
Contributor Author

@kripken
Hi Alon,
the PR is ready, please kindly review, thank you.
Regards

Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good with some comments, see the suggestion. Is what I wrote there correct?

@@ -170,6 +170,8 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> {

std::vector<HeapType> heapTypes;

unsigned lastPrintIndent = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Please add a comment explaining the motivation for tracking the print indent, maybe with an example? I am imagining something like this:

//  Track the print indent so that we can see when it changes. That affects how we print debug annotations. In particular, we don't want to print repeated debug locations for children, like this:
//
//  ;;@ file.cpp:20:4
// (block
//    ;; no need to annotate here
//    (nop)
//
// But we do want to print an annotation even if it repeats if it is not a child:
//
//  ;;@ file.cpp:20:4
// (block
// )
// ;;@ file.cpp:20:4 - this is worth annotating
// (nop)

Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

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

Actually let me land this - I have a followup to this code, and there would just be merge conflicts etc. I'll add a comment in my PR.

@kripken kripken merged commit 0598939 into WebAssembly:main Aug 28, 2023
kripken added a commit that referenced this pull request Aug 29, 2023
In general, full print mode should print out all the things to avoid confusion. It
already did so for blocks (that the text format sometimes elides), types, etc. Doing
it for debug info can avoid confusion when debugging (in fact, this was one of the
main reasons I've been confused about how source maps work in Binaryen...).

Also add a comment to the code just landed in #5903
radekdoulik pushed a commit to dotnet/binaryen that referenced this pull request Jul 12, 2024
Skip repeated identical debug info only of more-nested nodes. Before this PR we
skipped sibling nodes and even parent nodes, which could be confusing. After
this PR there is a more clear connection: child nodes have the same debug location
as the parent, by default, and so there is no need to print it again.
radekdoulik pushed a commit to dotnet/binaryen that referenced this pull request Jul 12, 2024
In general, full print mode should print out all the things to avoid confusion. It
already did so for blocks (that the text format sometimes elides), types, etc. Doing
it for debug info can avoid confusion when debugging (in fact, this was one of the
main reasons I've been confused about how source maps work in Binaryen...).

Also add a comment to the code just landed in WebAssembly#5903
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