Skip to content
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

Node.js v12 + master support #318

Closed
wants to merge 16 commits into from
Closed

Conversation

mmarchini
Copy link
Contributor

Just opening the PR to share the working version of v12.x (and master) fixes. I still have to clean up several of those commits (and rewrite their commit messages) and the idea is to open them as separate PRs. IIRC they do not depend on each other (but several depend on #303, which is why I haven't opened their PRs yet).

It's also worth noting that v12 won't work without https://chromium-review.googlesource.com/c/v8/v8/+/1847783 and https://chromium-review.googlesource.com/c/v8/v8/+/1832311.

If a test case would use Promises for linesUntil, sometimes we would emit
lines events while there was no listener attached to it. This commit
changes SessionOutput to make it a little more resilient: now line
events will only be emitted when the SessionOutput is waiting. When wait
is called (via linesUntil, for example), it'll retrieve all lines (via
line events) on the buffer until it reaches a line matching the regexp.
If no lines match the regexp, we'll continue as before waiting for data
from lldb and buffering it.
Apparently, sometimes the FunctionName slot on ScopeInfo is filled with
the empty string instead of not existing. This commit changes our
heuristic to search for the first non-empty string on the first 3 slots
after the last context info slot on the ScopeInfo. This should be enough
to cover most (all?) cases.

Also updated frame-test to add frames to the stack which V8 will infer
the name instead of storing it directly, and changed this particular
test to use Promises instead of callbacks. We should be able to upgrade
tests to primise-based API gradually with this approach. When all tests
are promisified, we can change the api on test/common.js to be
promise-based instead of callback-based.
a501635 changed the behavior of Check()
so that it could be properly used to determine if an object was loaded
successfully from memory. In the past we used raw != -1 to perform the
same check. Some places were still using the old approach, which has
less guarantees than Check(). This commit changes those places to use
the new approach. Also added a few RETURN_IF_THIS_INVALID guards on the
functions touched by this commit.
Same idea as CheckedType: instead of relying on the default value for
constants to determine if they were loaded correctly or not (default
value usually was -1), have a class which will have information about
the loaded constant. This can help us:

  - Check if a constant was properly loaded before using it (otherwise
    we'd get into undefined behavior, and there are a lot of places
    where this happens.
  - Check if a constant value was loaded or if we're looking at the
    default value.
  - Explicitly define a constant as optional (constants which are not
    relevant except for specific V8 versions).

This will help us improve reliability and debugability of llnode.
V8 7.5 changed how it caches the stringified stack on Error objects
after the first access. Instead of replacing the accessor Error.stack
with the stringified stack, the stringified stack is stored in the same
Symbol which was used to store the FrameArray stack.

Ref: v8/v8@c820604
@codecov-io
Copy link

Codecov Report

Merging #318 into master will decrease coverage by 0.12%.
The diff coverage is 81.61%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #318      +/-   ##
==========================================
- Coverage   79.02%   78.89%   -0.13%     
==========================================
  Files          33       33              
  Lines        4247     4388     +141     
==========================================
+ Hits         3356     3462     +106     
- Misses        891      926      +35
Impacted Files Coverage Δ
src/llv8-constants.cc 84.45% <100%> (+1.38%) ⬆️
src/llv8-constants.h 100% <100%> (ø) ⬆️
src/llscan.cc 61.25% <100%> (ø) ⬆️
test/common.js 86.55% <100%> (-0.45%) ⬇️
src/constants.h 87.5% <100%> (+20.83%) ⬆️
src/llv8.h 83.72% <100%> (+0.38%) ⬆️
src/error.h 87.5% <100%> (+1.78%) ⬆️
src/llv8.cc 73.29% <64.1%> (+0.31%) ⬆️
src/printer.cc 75.89% <64.58%> (-1.81%) ⬇️
src/constants.cc 80.59% <77.77%> (-0.76%) ⬇️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ec01604...581dde8. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants