From 3516f35b77fa232a40da267926e3ea53b4f55494 Mon Sep 17 00:00:00 2001 From: Cristian Cavalli Date: Wed, 18 Jan 2017 08:21:02 -0800 Subject: [PATCH] deps: backport 7c3748a from upstream V8 Original commit message: [debug] load correct stack slot for frame details. R=bmeurer@chromium.org BUG=v8:5071 Review URL: https://codereview.chromium.org/2045863002 . Cr-Commit-Position: refs/heads/master@{#36769} PR-URL: https://github.com/nodejs/node/pull/10873 Reviewed-By: bnoordhuis - Ben Noordhuis Reviewed-By: jasnell - James M Snell Reviewed-By: ofrobots - Ali Ijaz Sheikh --- deps/v8/include/v8-version.h | 2 +- deps/v8/src/runtime/runtime-debug.cc | 3 ++- deps/v8/test/mjsunit/regress/regress-5071.js | 27 ++++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 deps/v8/test/mjsunit/regress/regress-5071.js diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 89cf41c1f70d52..fc3292b05ff939 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -11,7 +11,7 @@ #define V8_MAJOR_VERSION 4 #define V8_MINOR_VERSION 5 #define V8_BUILD_NUMBER 103 -#define V8_PATCH_LEVEL 45 +#define V8_PATCH_LEVEL 46 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/src/runtime/runtime-debug.cc b/deps/v8/src/runtime/runtime-debug.cc index e7aaed1f6fbed7..adc2449c4559e1 100644 --- a/deps/v8/src/runtime/runtime-debug.cc +++ b/deps/v8/src/runtime/runtime-debug.cc @@ -670,7 +670,8 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) { // Use the value from the stack. if (scope_info->LocalIsSynthetic(i)) continue; locals->set(local * 2, scope_info->LocalName(i)); - locals->set(local * 2 + 1, frame_inspector.GetExpression(i)); + locals->set(local * 2 + 1, + frame_inspector.GetExpression(scope_info->StackLocalIndex(i))); local++; } if (local < local_count) { diff --git a/deps/v8/test/mjsunit/regress/regress-5071.js b/deps/v8/test/mjsunit/regress/regress-5071.js new file mode 100644 index 00000000000000..c69d8a78f2c2e3 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-5071.js @@ -0,0 +1,27 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-debug-as debug + +'use strict'; +var Debug = debug.Debug; + +function listener(event, exec_state, event_data, data) { + assertEquals(2, exec_state.frameCount()); + assertEquals("a", exec_state.frame(0).localName(0)); + assertEquals("1", exec_state.frame(0).localValue(0).value()); + assertEquals(1, exec_state.frame(0).localCount()); +} + +Debug.setListener(listener); + +function f() { + var a = 1; + { + let b = 2; + debugger; + } +} + +f();