GoogleChromeLabs / ndb

ndb is an improved debugging experience for Node.js, enabled by Chrome DevTools
Apache License 2.0
10.9k stars 231 forks source link

Blackboxing node internal libraries not working #294

Open tonywoode opened 5 years ago

tonywoode commented 5 years ago

Steps to reproduce

Tell us about your environment:

What steps will reproduce the problem?

Please include code that reproduces the issue.

  1. download and install ndb
  2. make a breakpoint and start debugging a node file, stepping into lines of code
  3. quickly I end up in a file from outside the CWD, usually one of node's own modules

What is the expected result? From https://github.com/GoogleChromeLabs/ndb/blob/master/README.md

By default, ndb blackboxes all scripts outside current working directory to improve focus. This includes node internal libraries (like _stream_wrap.js, async_hooks.js, fs.js) This behaviour may be changed by "Blackbox anything outside working dir" setting.

What happens instead? I do remember that setting in a version some time ago, but its been gone from any settings page for a long time.

So, instead by default all that's in my blackboxing regexes whenever I uninstall && reinstall ndb is: ^internal[\/].*|bin/npm-cli.js$|bin/yarn.js$

and that's exactly what I get, so modules like fs needs to be manually blackboxed. And how to even alleviate this? Even an exhaustive list or regex of node's modules to paste in as a replacement for the missing setting, doesn't seem to be easily obtainable...

tonywoode commented 4 years ago

it seems this is relevant: https://github.com/nodejs/node/issues/11893, so what's the relationship between the node-internal:// prefix, the internal prefix as per the setting in ndb: 'Blackbox Internal/* nodejs scripts', and the exclusion of core nodejs scripts like the fs module or events.js in the chrome debugger?

I don't get how exclusions could ever have worked if there's no way to distinguish node's internal files to the chrome debugger, nor do i get how i can work around this in anything but the most manual rudementary debugger ways

Re-reading again the original blackboxing statement above, instead of being able to target node's scripts, ndb used to just exclude everything but the cwd. So why did that setting: 'Blackbox anything outside working dir', dissappear, and why is the setting 'Blackbox Internal/* nodejs scripts' present, but seems to not achieve the goal of blackboxing core nodejs scripts?

I tried pickaxing the git history to see if i could replicate the old behaviour, i can find cwd being setup as a fn but not being used by a setting. The best i can manually do to replicate the old behaviour in the meantime is to exclude everything in the blackboxer but the current script as in ^((?!theFileBeingDebugged).)*$, but that feels unsatisfactory

To whit: it does seem as if ndb/anyone still can't use chrome's blackbox to help filter out just node's internal scripts en masse - am i right, or wrong, please?