Changeset 207387 in webkit


Ignore:
Timestamp:
Oct 15, 2016 6:44:18 PM (8 years ago)
Author:
mark.lam@apple.com
Message:

Add a $vm.getpid() method.
https://bugs.webkit.org/show_bug.cgi?id=163493

Reviewed by Saam Barati.

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.

Currently, $vm.getpid() is only supported on non-Windows platforms.
According to https://msdn.microsoft.com/en-us/library/ms235372.aspx, getpid() is
deprecated. According to https://msdn.microsoft.com/en-us/library/t2y34y40.aspx,
_getpid() cannot be used in applications that execute in the Windows Runtime.

Since this is only a debugging tool and is not a required feature, I'll defer
the Windows implementation of this function till the time when someone actually
needs it.

  • tools/JSDollarVMPrototype.cpp:

(JSC::functionGetPID):
(JSC::JSDollarVMPrototype::finishCreation):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r207377 r207387  
     12016-10-15  Mark Lam  <mark.lam@apple.com>
     2
     3        Add a $vm.getpid() method.
     4        https://bugs.webkit.org/show_bug.cgi?id=163493
     5
     6        Reviewed by Saam Barati.
     7
     8        This is especially useful when we need to know the pid of an instance of jsc in
     9        the foreground that we're trying to attach a debugger to while the JSC tests are
     10        running in the background with a gazillion other jsc processes live at the same
     11        time.
     12
     13        Currently, $vm.getpid() is only supported on non-Windows platforms.
     14        According to https://msdn.microsoft.com/en-us/library/ms235372.aspx, getpid() is
     15        deprecated.  According to https://msdn.microsoft.com/en-us/library/t2y34y40.aspx,
     16        _getpid() cannot be used in applications that execute in the Windows Runtime.
     17
     18        Since this is only a debugging tool and is not a required feature, I'll defer
     19        the Windows implementation of this function till the time when someone actually
     20        needs it.
     21
     22        * tools/JSDollarVMPrototype.cpp:
     23        (JSC::functionGetPID):
     24        (JSC::JSDollarVMPrototype::finishCreation):
     25
    1262016-10-15  Saam Barati  <sbarati@apple.com>
    227
  • trunk/Source/JavaScriptCore/tools/JSDollarVMPrototype.cpp

    r206386 r207387  
    412412}
    413413
     414#if !PLATFORM(WIN)
     415static EncodedJSValue JSC_HOST_CALL functionGetPID(ExecState*)
     416{
     417    return JSValue::encode(jsNumber(getpid()));
     418}
     419#endif
     420
    414421void JSDollarVMPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
    415422{
     
    435442
    436443    addFunction(vm, globalObject, "value", functionValue, 1);
     444#if !PLATFORM(WIN)
     445    addFunction(vm, globalObject, "getpid", functionGetPID, 0);
     446#endif
    437447}
    438448
Note: See TracChangeset for help on using the changeset viewer.