Debugger shows wrong values and step over doesn't work

8 views
Skip to first unread message

Riv

unread,
Nov 12, 2015, 12:10:28 PM11/12/15
to Google Chrome Developer Tools
I'm trying to debug a function that seems to freeze the debugger:

var _dp = new Uint32Array(256 * 256);
function StrDist(a, b) {
  for (var i = 1; i <= a.length; ++i) _dp[i * 256] = i;
  for (var j = 1; j <= b.length; ++j) _dp[j] = j;
  for (var i = 0; i < a.length; ++i) {
    for (var j = 0; j < b.length; ++j) {
      var c = i * 256 + j;
      _dp[c + 257] = Math.min(_dp[c + 1] + 1, _dp[c + 256] + 1, _dp[c] + (a[i] != b[j]));
    }
  }
  return _dp[a.length * 256 + b.length];
}

If I press 'pause', it stops at either of the loops (lines 5 or 6). If I press F10/F11, instead of going to the next line, it just resumes execution as if I pressed F8.
The values of a and b are reported as 2 and 14, respectively, even though they were passed as strings and are never assigned to.
Reply all
Reply to author
Forward
0 new messages