Opened 13 years ago
Closed 13 years ago
#5341 closed enhancement (fixed)
[patch]Add global function symbols for debugging
Reported by: | Adam Peller | Owned by: | James Burke |
---|---|---|---|
Priority: | high | Milestone: | 1.1 |
Component: | BuildTools | Version: | 0.9 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description (last modified by )
An optional build step to insert function symbols as global references so that anonymous functions will show up in all debuggers (esp. IE which does not attempt to infer function names from the context of their definition)
see discussion here:
Attachments (1)
Change History (5)
Changed 13 years ago by
Attachment: | function-symbol.patch added |
---|
comment:1 Changed 13 years ago by
Description: | modified (diff) |
---|
notes from Kamiyama-san:
I added a new command line option, "symbol", to the build command.
If you specify symbol=long to the build command, long descriptive function symbols are added as below. Those symbols are preserved even if you obfuscate the code with shrinksafe. Sometimes generated symbols cause conflict, especially when multiple classes are defined in one js file, but so far I see no problem with the conflicts. No script errors occur. Pattern matching cannot resolve every possibility of those conflicts. But I don't think this is a problem. Those symbols are just debugging info.
_Widget.js.....
postscript: function dijit__Widget_postscript(params, srcNodeRef){ this.create(params, srcNodeRef); }, create: function dijit__Widget_create(params, srcNodeRef){ .....
If you specify symbol=short to the build command, short symbols are generated for each function. Those short symbols never have conflicts. Also, a symbol table to retrieve descriptive names is generated.
_Widget.js.....
postscript: function NV_(params, srcNodeRef){ this.create(params, srcNodeRef); }, create: function NW_(params, srcNodeRef){ .....
symtable.txt
Lu_: "dijit__editor_RichText_queryCommandValue" MV_: "dijit__Templated__attachTemplateNodes" Io_: "dijit_Tree__onExpandoClick" JP_: "dijit__place" K1_: "dijit__editor_range_setStartBefore" Fi_: "dijit_layout_ContentPane_destroy" GJ_: "dijit_layout_SplitContainer__updateSize" Cc_: "dijit_form_CurrencyTextBox_postMixInProperties" DD_: "dijit_form_InlineEditBox__onBlur" Ni_: "dijit__Widget_connect" Kc_: "dijit__editor_plugins_FontChoice__initButton" LD_: "dijit__editor_range_getRangeAt" Dv_: "dijit_form_TextBox_setDisplayedValue" EW_: "dijit_form_ValidationTextBox_toString" ......
I used '_' as a path separator, but '$' may be a good idea since sometimes '_' is used in package names or class names.
Also, there might be more appropriate way of generating short unique symbols.
comment:2 Changed 13 years ago by
Summary: | Add global function symbols for debugging → [patch]Add global function symbols for debugging |
---|
comment:3 Changed 13 years ago by
Milestone: | → 1.1 |
---|
comment:4 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [11907]) Fixes #5341. Allow a build option for adding global function symbolds for debugging. Changes I did to the patch: I moved more code into buildUtil.insertSymbols, put two variables under buildUtil, and prefixed the short names with . Otherwise, the short names caused rhino errors when trying to shrinksafe the offline.js layer in the standard.profile.js. Thanks for the patch. !strict (complaints about redeclarations for some things in build.js -- will fix later)
from Yoshiroh Kamiyama, IBM (CCLA)