RESOLVED FIXED 163493
Add a $vm.getpid() method.
https://bugs.webkit.org/show_bug.cgi?id=163493
Summary Add a $vm.getpid() method.
Mark Lam
Reported 2016-10-15 16:20:51 PDT
This is especially useful when we need to know the pid of an instance of jsc in the foreground that we're trying to attach a debugger to while the JSC tests are running in the background with a gazillion other jsc processes live at the same time.
Attachments
proposed patch. (1.83 KB, patch)
2016-10-15 16:24 PDT, Mark Lam
mark.lam: review-
mark.lam: commit-queue-
proposed patch. (2.42 KB, patch)
2016-10-15 17:10 PDT, Mark Lam
no flags
Mark Lam
Comment 1 2016-10-15 16:24:07 PDT
Created attachment 291730 [details] proposed patch.
JF Bastien
Comment 2 2016-10-15 16:41:05 PDT
Comment on attachment 291730 [details] proposed patch. View in context: https://bugs.webkit.org/attachment.cgi?id=291730&action=review Test that it returns a non-0 and non-1 integer? > Source/JavaScriptCore/tools/JSDollarVMPrototype.cpp:416 > + return JSValue::encode(JSValue(getpid())); Does that work on Windows? Docs say deprecated, but I don't see why they'd remove it.
Mark Lam
Comment 3 2016-10-15 16:48:16 PDT
(In reply to comment #2) > Comment on attachment 291730 [details] > proposed patch. > > View in context: > https://bugs.webkit.org/attachment.cgi?id=291730&action=review > > Test that it returns a non-0 and non-1 integer? I don't think it matters. This is just a debugging tool, and we just want whatever int value getpid() returns. > > Source/JavaScriptCore/tools/JSDollarVMPrototype.cpp:416 > > + return JSValue::encode(JSValue(getpid())); > > Does that work on Windows? Docs say deprecated, but I don't see why they'd > remove it. Good catch. Let me fix.
Mark Lam
Comment 4 2016-10-15 17:10:10 PDT
Created attachment 291731 [details] proposed patch.
JF Bastien
Comment 5 2016-10-15 17:46:00 PDT
(In reply to comment #3) > (In reply to comment #2) > > Comment on attachment 291730 [details] > > proposed patch. > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=291730&action=review > > > > Test that it returns a non-0 and non-1 integer? > > I don't think it matters. This is just a debugging tool, and we just want > whatever int value getpid() returns. Yeah but broken debugging is worst debugging. Unlikely to fail given the posix spec, but getting just 0 is really annoying. I don't care much about it, just seems weird, so lgtm either way.
Saam Barati
Comment 6 2016-10-15 18:23:56 PDT
Comment on attachment 291731 [details] proposed patch. r=me
WebKit Commit Bot
Comment 7 2016-10-15 18:46:57 PDT
Comment on attachment 291731 [details] proposed patch. Clearing flags on attachment: 291731 Committed r207387: <http://trac.webkit.org/changeset/207387>
WebKit Commit Bot
Comment 8 2016-10-15 18:47:01 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.