Look at edit distance for variable names?

75 views
Skip to first unread message

Richard Wallis

unread,
Dec 27, 2014, 10:25:56 AM12/27/14
to sd...@googlegroups.com
At the moment com.github.sdbg.debug.core.internal.util.DebuggerUtils provides demangleVmName(String name) to strip out unwanted special characters in field names.

It doesn't work very well which is why the variable names in the debugger don't match the variable names in the file.

If you're able to get a set of the original variable names (maybe from the source file?) then returning the name from the set that has the smallest levenshtein distance from the vmName will most likely completely solve the variable name problem.

Noticed while fixing #91 but I'm not sure how to get the set of original variable names.

Ivan Markov

unread,
Dec 27, 2014, 11:03:18 AM12/27/14
to
DebuggerUtils.demangleVmName() is specific for the DART VM and won't help us in demangling method/variable names generated by the GWT compiler so you are right, we have to come up with something on our own.

The best, most clean solution would be to store the original variable names <-> compiled variable names' mapping in the sourcemaps in the first place. However, the current sourcemap specification (V3) does not support mapping variable names. Of course, rather than waiting for sourcemaps V4, we can put in the sourcemap our own, non-standard extensions for mapping variable names. The problem with that is that the GWT compiler has to be patched to output these nonstandard extensions - this would require a bit of work... Further on, there are some scoping issues as well (JavaScript 'this' is not working like Java 'this' reg. scopes) which also have to be resolved.  Check https://github.com/sdbg/sdbg/issues/6 for more information.



Ivan Markov

unread,
Dec 27, 2014, 11:07:52 AM12/27/14
to sd...@googlegroups.com
With the above said, I agree - doing something for the shorter term using some sort of demangling heuristics may work, however I'm afraid that if it works in only, say, 90% of the cases, there would be an avalanche of bug reports for the remaining 10%.
I think I would rather pursue the original direction, even if this requires changing the GWT compiler itself...

Ivan Markov

unread,
Dec 27, 2014, 11:16:27 AM12/27/14
to sd...@googlegroups.com
Also see this: https://code.google.com/p/chromium/issues/detail?id=327092 for the identical problem for Chrome DevTools.
I think I can get by with minimal/no changes to the Sourcemap spec. However, GWT has to be altered, and it is a whole new codebase for me...
On the other hand, if I go far enough, I may even implement something that would allow for on-the-fly compilation of Java expressions by the CodeServer, which would open the door for conditional breakpoints and the Display window in Eclipse...

Reply all
Reply to author
Forward
0 new messages