-
Notifications
You must be signed in to change notification settings - Fork 745
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
Conversation
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.
There was a problem hiding this 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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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."
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. |
@aheejin, it turns out that this does indeed use colors in some situations. |
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.