RESOLVED FIXED 186947
Add more debugging features to $vm.
https://bugs.webkit.org/show_bug.cgi?id=186947
Summary Add more debugging features to $vm.
Mark Lam
Reported 2018-06-22 16:21:42 PDT
Patch coming.
Attachments
proposed patch. (12.88 KB, patch)
2018-06-22 18:17 PDT, Mark Lam
keith_miller: review+
Mark Lam
Comment 1 2018-06-22 18:17:51 PDT
Created attachment 343406 [details] proposed patch.
Keith Miller
Comment 2 2018-06-22 22:39:52 PDT
Comment on attachment 343406 [details] proposed patch. View in context: https://bugs.webkit.org/attachment.cgi?id=343406&action=review r=me with some comments. > Source/JavaScriptCore/ChangeLog:12 > + // We now have println in addition to print. > + // println automatically adds a '\n' at the end. > + $vm.println("Hello"); Nit: I think this is what print should do by default... it's also what print does in jsc.cpp > Source/JavaScriptCore/tools/JSDollarVM.cpp:103 > + addProperty(vm, "codeBlock", codeBlock); > + addProperty(vm, "unlinkedCodeBlock", codeBlock->unlinkedCodeBlock()); > + addProperty(vm, "executable", codeBlock->ownerExecutable()); I think this will crash for Wasm. Can we add these only if codeBlock is non-null. > Source/JavaScriptCore/tools/JSDollarVM.cpp:1351 > + return JSValue::encode(codeBlock); I think you need a null check here for Wasm.
Mark Lam
Comment 3 2018-06-22 23:23:54 PDT
Comment on attachment 343406 [details] proposed patch. View in context: https://bugs.webkit.org/attachment.cgi?id=343406&action=review Thanks for the review. >> Source/JavaScriptCore/ChangeLog:12 >> + $vm.println("Hello"); > > Nit: I think this is what print should do by default... it's also what print does in jsc.cpp Per our offline discussion, I'll rename print to dataLog, and println to print with the justification that most people would probably expect print to append the \n. I still think it's sad that we have to do this, but I'll go with it only because most the scripting languages (as you pointed out) like adopts this (bad, IMHO) convention of making print append \n and make their users jump thru hoops to print without the \n. >> Source/JavaScriptCore/tools/JSDollarVM.cpp:103 >> + addProperty(vm, "executable", codeBlock->ownerExecutable()); > > I think this will crash for Wasm. Can we add these only if codeBlock is non-null. I'll add a null check and not populate these (which makes them undefined). >> Source/JavaScriptCore/tools/JSDollarVM.cpp:1351 >> + return JSValue::encode(codeBlock); > > I think you need a null check here for Wasm. Will do and return undefined if codeBlock is null.
Mark Lam
Comment 4 2018-06-23 08:34:40 PDT
(In reply to Mark Lam from comment #3) > Comment on attachment 343406 [details] > proposed patch. > > View in context: > https://bugs.webkit.org/attachment.cgi?id=343406&action=review > > Thanks for the review. > > >> Source/JavaScriptCore/ChangeLog:12 > >> + $vm.println("Hello"); > > > > Nit: I think this is what print should do by default... it's also what print does in jsc.cpp > > Per our offline discussion, I'll rename print to dataLog, and println to > print with the justification that most people would probably expect print to > append the \n. I still think it's sad that we have to do this, but I'll go > with it only because most the scripting languages (as you pointed out) like > adopts this (bad, IMHO) convention of making print append \n and make their > users jump thru hoops to print without the \n. On second thought, I'll defer this to a follow up patch to go with other renaming that I think should be done for consistency.
Mark Lam
Comment 5 2018-06-23 08:49:09 PDT
Radar WebKit Bug Importer
Comment 6 2018-06-23 08:50:30 PDT
Note You need to log in before you can comment on or make changes to this bug.