Skip to content

Conversation

@mmarchini
Copy link
Contributor

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.

@mmarchini
Copy link
Contributor Author

I wonder if the failing tests are happening because I changed the test to use Primises... llnode is printing v8 source list and v8 source list -l 2 correctly, but the test suite is not receiving it sometimes...

@mmarchini mmarchini force-pushed the fix-inferred-name-fn-lookup branch from fb87eec to c547181 Compare October 3, 2019 22:28
let fnInferredName;
fnInferredName = (() => function () {
crasher(); // # args < # formal parameters inserts an adaptor frame.
})();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

V8 is not inferring this on Node.js v12... We'll probably need to skip the check for this function on 12.

Upstream bug: https://bugs.chromium.org/p/v8/issues/detail?id=9807

@mmarchini mmarchini added author ready PRs that have at least one approvals, no pending requests for changes, and a CI started. priority labels Oct 7, 2019
@mmarchini
Copy link
Contributor Author

cc @nodejs/llnode

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.
@mmarchini mmarchini force-pushed the fix-inferred-name-fn-lookup branch from c547181 to 67e6e32 Compare December 9, 2019 23:20
@codecov-io
Copy link

codecov-io commented Dec 9, 2019

Codecov Report

Merging #311 into master will increase coverage by 0.66%.
The diff coverage is 93.54%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #311      +/-   ##
==========================================
+ Coverage   78.29%   78.96%   +0.66%     
==========================================
  Files          33       33              
  Lines        4262     4278      +16     
==========================================
+ Hits         3337     3378      +41     
+ Misses        925      900      -25
Impacted Files Coverage Δ
src/llv8-inl.h 93.18% <100%> (+1.3%) ⬆️
test/common.js 86.26% <100%> (-0.75%) ⬇️
test/plugin/frame-test.js 88.88% <91.83%> (+1.38%) ⬆️
src/llv8-constants.cc 83.01% <0%> (+0.96%) ⬆️
src/llv8-constants.h 100% <0%> (+1.51%) ⬆️
src/llv8.h 83.33% <0%> (+2.38%) ⬆️
src/llv8.cc 73.05% <0%> (+2.43%) ⬆️

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 37b3c26...67e6e32. Read the comment docs.

@mmarchini
Copy link
Contributor Author

cc @nodejs/llnode

@mmarchini
Copy link
Contributor Author

Ping @nodejs/llnode, we need this for v12 support.

mmarchini added a commit that referenced this pull request Jan 14, 2020
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.

PR-URL: #311
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
mmarchini added a commit that referenced this pull request Jan 14, 2020
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.

PR-URL: #311
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@mmarchini
Copy link
Contributor Author

Landed in fd9d2b0...8068cda

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

Labels

author ready PRs that have at least one approvals, no pending requests for changes, and a CI started.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants