src: add rudimentary Promise support by mmarchini · Pull Request #272 · nodejs/llnode

@mmarchini

This patch allows llnode to list Promise objects with findjsobjects,
findjsinstances and findrefs. We can investigate more fancy Promise
features in the future (such as listing handlers, Promise status, etc.).

For Node.js v10.x, since we don't have the JS_PROMISE type as postmortem
metadata, we assume JS_PROMISE is the next type after
JS_MESSAGE_OBJECT_TYPE. This is a safe assumption for Node.js v10.x,
v12.x has the JS_PROMISE type, and v8.x is not supported anymore.

```console
$ git log v10.0.0..v10.17.0 -L :InstanceType:deps/v8/src/objects.h | grep -C2 "JS_PROMISE"
   JS_MAP_VALUE_ITERATOR_TYPE,
   JS_MESSAGE_OBJECT_TYPE,
   JS_PROMISE_TYPE,
   JS_REGEXP_TYPE,
   JS_REGEXP_STRING_ITERATOR_TYPE,
--
   JS_MAP_VALUE_ITERATOR_TYPE,
   JS_MESSAGE_OBJECT_TYPE,
   JS_PROMISE_TYPE,
   JS_REGEXP_TYPE,
+  JS_REGEXP_STRING_ITERATOR_TYPE,
```

mmarchini added a commit to mmarchini/node that referenced this pull request

Jan 14, 2020
type_JSPromise__JS_PROMISE_TYPE and
type_JSMessageObject__JS_MESSAGE_OBJECT_TYPE will be used on llnode to
identify Promises in memory and core dumps:
nodejs/llnode#272. Add these to our postmortem
test so we're aware of any changes to this metadata.

mmarchini added a commit to nodejs/node that referenced this pull request

Jan 16, 2020
type_JSPromise__JS_PROMISE_TYPE and
type_JSMessageObject__JS_MESSAGE_OBJECT_TYPE will be used on llnode to
identify Promises in memory and core dumps:
nodejs/llnode#272. Add these to our postmortem
test so we're aware of any changes to this metadata.

PR-URL: #31357
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>

codebytere pushed a commit to nodejs/node that referenced this pull request

Feb 17, 2020
type_JSPromise__JS_PROMISE_TYPE and
type_JSMessageObject__JS_MESSAGE_OBJECT_TYPE will be used on llnode to
identify Promises in memory and core dumps:
nodejs/llnode#272. Add these to our postmortem
test so we're aware of any changes to this metadata.

PR-URL: #31357
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>

mmarchini added a commit that referenced this pull request

Mar 25, 2020
This patch allows llnode to list Promise objects with findjsobjects,
findjsinstances and findrefs. We can investigate more fancy Promise
features in the future (such as listing handlers, Promise status, etc.).

For Node.js v10.x, since we don't have the JS_PROMISE type as postmortem
metadata, we assume JS_PROMISE is the next type after
JS_MESSAGE_OBJECT_TYPE. This is a safe assumption for Node.js v10.x,
v12.x has the JS_PROMISE type, and v8.x is not supported anymore.

```console
$ git log v10.0.0..v10.17.0 -L :InstanceType:deps/v8/src/objects.h \
    | grep -C2 "JS_PROMISE"
   JS_MAP_VALUE_ITERATOR_TYPE,
   JS_MESSAGE_OBJECT_TYPE,
   JS_PROMISE_TYPE,
   JS_REGEXP_TYPE,
   JS_REGEXP_STRING_ITERATOR_TYPE,
--
   JS_MAP_VALUE_ITERATOR_TYPE,
   JS_MESSAGE_OBJECT_TYPE,
   JS_PROMISE_TYPE,
   JS_REGEXP_TYPE,
+  JS_REGEXP_STRING_ITERATOR_TYPE,
```

PR-URL: #272