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

Add Expression::dump for use while debugging #2912

Merged
merged 2 commits into from
Jun 16, 2020

Conversation

tlively
Copy link
Member

@tlively tlively commented Jun 15, 2020

I have found that similar dump functions have been extremely helpful
while debugging LLVM. Rather than re-implement this locally whenever I
need it, it would be better have this utility upstream.

I have found that similar dump functions have been extremely helpful
while debugging LLVM. Rather than re-implement this locally whenever I
need it, it would be better have this utility upstream.
@tlively tlively requested review from kripken and aheejin June 15, 2020 19:58
Copy link
Member

@aheejin aheejin left a comment

Choose a reason for hiding this comment

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

Nice! I actually implemented something like this for my own debugging but stopped short of actually submitting it. By the way, does it print colors or color codes? They are very helpful in the console but sometimes annoying when we direct it to text output (because it is printed as not colors but some ascii codes), so I'm wondering what it looks like from gdb or something.

src/wasm.h Outdated
@@ -588,6 +588,9 @@ class Expression {
assert(int(_id) == int(T::SpecificId));
return (const T*)this;
}

// Print the expression to stderr. Meant for use from debuggers.
Copy link
Member

Choose a reason for hiding this comment

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

Nit: We can use this for printf-style debugging too, so it might not be strictly necessary to say this is for debuggers.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I'll change it say "Meant for use while debugging."

@tlively
Copy link
Member Author

tlively commented Jun 15, 2020

By the way, does it print colors or color codes? They are very helpful in the console but sometimes annoying when we direct it to text output (because it is printed as not colors but some ascii codes), so I'm wondering what it looks like from gdb or something.

In my terminal under gdb it doesn't print colors or color codes, but I'm not sure whether it would print colors in other situations.

@tlively tlively merged commit 139d020 into WebAssembly:master Jun 16, 2020
@tlively tlively deleted the debug-dump branch June 16, 2020 00:22
@tlively
Copy link
Member Author

tlively commented Jun 16, 2020

@aheejin, it turns out that this does indeed use colors in some situations.

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