-
Notifications
You must be signed in to change notification settings - Fork 514
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
Stack traces loaded through require() always show duk_bi_global.c as source file #58
Comments
This is definitely an improvement over the current solution which results in very confusing backtraces. |
Looks definitely like something to fix, thanks for reporting it. |
Technically it might be useful if the Unfortunately this isn't easily fixable for 1.x because but we can look into changing the contract (@creationix had also some issues with the current one, specifically re: giving a fully resolved ID to modSearch) in 2.0. |
Ah, I see. The
The proposed change fixes the issue and also removes the unnecessary forcing of the fileName, which is nice. I'll merge a fix soon. |
Fix fileName for functions defined by modules loaded using require(). Although the fileName for the (Duktape internal) module function was set to the resolved module ID, any functions defined in the module woult not be affected by this and fileName would default to "duk_bi_global.c" which is highly misleading. See GH-58.
The merge should fix the issue, and the following testcase was added to check for the preferred behavior at this point: |
@emil-e It'd be nice to hear if the merge (in master) fixed this issue for you. Quite probably so because the fix is practically the one you suggested originally, but still :) |
I'll check it out :) On Thursday, October 30, 2014, Sami Vaarala notifications@github.com
|
This is now also fixed in 1.0.1 release. |
Awesome thanks. I wanted this patch, but I'm trying to be good and stick to released versions. |
FWIW, I use 1.0.1 in https://github.com/andoma/showtime/ and there it now prints backtraces as it should. |
@emil-e I'll close this now because it seems to be fixed - if not, please reopen. |
Sorry for the delay, I haven't had time to test it since I've been On Friday, November 7, 2014, Sami Vaarala notifications@github.com wrote:
|
duk_bi_global_object_require
uses the functionduk_eval
(duk_bi_global.c:1079) to compile the source returned by the modSearch function. Since duk_eval is defined as,the stack frames for functions loaded through
require(...)
will show the source file as duk_bi_global.c.I came up with the following fix (replace duk_bi_global.c:1079) but I don't know if this is the "right" solution or not:
This uses the resolved module ID as the filename for duk_eval_raw instead.
The text was updated successfully, but these errors were encountered: