Skip to content
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

dart2js call stacks too hard to understand #3232

Closed
rakudrama opened this issue May 25, 2012 · 2 comments
Closed

dart2js call stacks too hard to understand #3232

rakudrama opened this issue May 25, 2012 · 2 comments
Assignees

Comments

@rakudrama
Copy link
Member

Breaking into the Clock sample running on Chrome, the stack trace is of almost no use.

Developers will have to debug code on Chrome, Safari, IE, Opera and whatever else. Basic information needs to be in the JS stacktrace.
dart2js+Chrome: No class names appear in the stack trace at all.

dart2js stack:

Isolate.$defineClass.newDistanceSquared$3 (Clock.dart.js:768)
Isolate.$defineClass.$call$1 (Clock.dart.js:1134)
$.forEach2 (Clock.dart.js:2280)
$.forEach (Clock.dart.js:2250)
Isolate.$defineClass.$call$1 (Clock.dart.js:1124)
$.forEach2 (Clock.dart.js:2280)
$.forEach (Clock.dart.js:2250)
Isolate.$defineClass.collideBalls$1 (Clock.dart.js:779)
Isolate.$defineClass.tick$0 (Clock.dart.js:787)
Isolate.$defineClass.$call$0 (Clock.dart.js:1053)
Isolate.$defineClass.$call$0 (Clock.dart.js:1158)
$.invokeClosure (Clock.dart.js:1656)
function0 (Clock.dart.js:1478)

dart2js code:
Isolate.$defineClass("Balls", "Object", ["balls?", "lastTime", "root?"], {
 ...
 newDistanceSquared$3: function(delta, b0, b1) {
[*] var nb0x = $.add(b0.get$x(), $.mul(b0.get$vx(), delta));
  var nb0y = $.add(b0.get$y(), $.mul(b0.get$vy(), delta));
  var nb1x = $.add(b1.get$x(), $.mul(b1.get$vx(), delta));
  var nb1y = $.add(b1.get$y(), $.mul(b1.get$vy(), delta));
  var ndx = $.abs($.sub(nb0x, nb1x));
  var ndy = $.abs($.sub(nb0y, nb1y));
  return $.add($.mul(ndx, ndx), $.mul(ndy, ndy));
 },

Frog is somewhat better, but still inadequate.
At least it is not substantially worse than debugging in JavaScript using Closure.
Example: class name 'Balls' appears:

frog stack:
Balls.newDistanceSquared (Clock.dart.js_:3117)
(anonymous function) (Clock.dart.js_:3094)
ListIterator.hasNext (Clock.dart.js_:545)
(anonymous function) (Clock.dart.js_:3089)
ListIterator.hasNext (Clock.dart.js_:545)
Balls.collideBalls (Clock.dart.js_:3088)
Balls.tick (Clock.dart.js_:3084)
f (Clock.dart.js_:2971)

frog code at breakpoint:

Balls.prototype.newDistanceSquared = function(delta, b0, b1) {
[*] var nb0x = b0.x + b0.vx * delta;
  var nb0y = b0.y + b0.vy * delta;
  var nb1x = b1.x + b1.vx * delta;
  var nb1y = b1.y + b1.vy * delta;
  var ndx = (nb0x - nb1x).abs();
  var ndy = (nb0y - nb1y).abs();
  var nd2 = ndx * ndx + ndy * ndy;
  return nd2;
}

@kasperl
Copy link

kasperl commented May 25, 2012

Set owner to @floitschG.
Added Accepted label.

@floitschG
Copy link
Contributor

This should be fixed with r8460.


Added Fixed label.

copybara-service bot pushed a commit that referenced this issue Oct 31, 2022
Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/4902bea..3273437):
  32734372  2022-10-30  Sam Rawlins  Move Warnable.enclosingElement to ModelElement (#3236)
  1ff17d8e  2022-10-28  Sam Rawlins  Make ContainerMember.canonicalEnclosingContainer late final (#3234)
  c32e09ee  2022-10-28  Sam Rawlins  Support displaying record types (#3233)
  9d194476  2022-10-26  Sam Rawlins  Update the text in test/README (#3232)

mockito (https://github.com/dart-lang/mockito/compare/02ad6c7..094d07c):
  094d07c  2022-10-25  Sam Rawlins  Require analyzer 5.2.0

test (https://github.com/dart-lang/test/compare/f704d5a..b82fc0b):
  b82fc0b5  2022-10-27  Jacob MacDonald  Experimental wasm support (#1777)
  262bc7bd  2022-10-26  Nate Bosch  Bump to the latest matcher and prepare to publish (#1778)
  fa81b45d  2022-10-26  Nate Bosch  Expand test_api pubspec description (#1775)

web_socket_channel (https://github.com/dart-lang/web_socket_channel/compare/4b46c0c..eba1541):
  eba1541  2022-10-27  Siva  Remove language version from spawnHybrid code (#232)

webdriver (https://github.com/google/webdriver.dart/compare/f56cc6a..c28cf51):
  c28cf51  2022-10-26  Devon Carew  misc updates and rev in prep for publishing (#256)

Change-Id: I3876e957ffa21333ced4ad3f6df4ef35103674a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266720
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants