-
Notifications
You must be signed in to change notification settings - Fork 18
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
want better support for bound functions #88
Comments
Although this is simple in principle, this turned out to be a little nasty. Fetching the bindings is as straightforward as described. Reliably determining whether a function is bound in the first place is trickier (and it's important, since the bindings field is also used for other things). On Node versions 0.10.47, 0.12.16, and 4.6.0, you can check a particular bit of the "compiler_hints" field on the SharedFunctionInfo. However, the bit to check is different across all three versions, and we don't have postmortem metadata for it. On Node version 6.8.1, this is all completely different. There's no bit to determine if a JSFunction has bindings because there's a separate class, JSBoundFunction, that implements this behavior. I've got changes that:
As with all the other new work, I've extended the API in mdb_v8_dbg.h. The goal is to more cleanly separate reconstructing JS state from printing it out with mdb. This will make mdb_v8 much easier to fix and extend. In doing this, we have to decide how much callers should have to know about bound functions. I concluded that callers have to know that bound functions exist (as a first-class type, alongside regular functions, strings, regular expressions, and so on) because there's no other way to inspect them. (This is different than, say, node-once, which also wraps functions, but does so in a way that can be observed with existing tools (namely, I don't think it's worth adding postmortem metadata to V8 for the bit because it's gone in modern versions anyway. |
Draft change: https://cr.joyent.us/#/c/2350/ This is
For 6.11.2, both 32-bit and 64-bit failed in tst.postmortem_jsstack.js because there's an extra stack frame present ("loadavg"). That's correct, though. We probably need to update this test to accept that frame. Although it's basically ready for review, there are a few things I'd still like to fix in this change:
I'd also welcome input on which other Node versions are worth testing. |
Memory leaks are probably less likely than I thought because although the
Then I saved a core file of mdb and ran
This looks like a potentially legit leak in findjsobjects_range() when we fail to read from the range. But it's not related to this change. |
Having addressed the items I mentioned above, patchset 2 is now ready for review. |
Although I'm running into #38 a lot, after a few trials, I got the same runtests results on patchset 2:
And the v6 failures are the same as before. |
Patchset 3 includes a few changes from code review. I've run |
Related to #87, when we ultimately found the function we were looking for, it was a bound function:
But there's no great way (with mdb_v8) of finding the underlying function and the arguments that have been bound. According to @arekinath, the values are in the "literals_or_bindings" field:
The text was updated successfully, but these errors were encountered: