v8/tools/v8windbg/src
Seth Brenith 607ad422be Fix v8windbg Locals pane behavior
Background:

In order to show custom content in the "Locals" pane in WinDbg, v8windbg
replaces the getter function for a built-in debug model property named
"Debugger.Models.StackFrame.LocalVariables". This is the property that
the debugger fetches when determining what to display in "Locals". The
new implementation of that getter, V8LocalVariables::GetValue, can
either call the original getter (so that WinDbg displays the usual
content for normal C++ frames) or produce a custom result (for builtins
and JIT-compiled JS frames).

The current problem:

In new builds of WinDbg, users of v8windbg no longer see any content in
the Locals pane for stack frames that correspond to builtins or
JIT-compiled code. This is because of a behavior change in WinDbg:
previously, attempting to get Debugger.Models.StackFrame.LocalVariables
would eagerly attempt to find the symbols for the frame and return an
error code if symbols were not found, but now it returns a lazy object
which does not perform symbol lookup until you iterate its properties.
V8LocalVariables::GetValue currently starts with an early-exit path
based on checking whether the original getter succeeded, so the new lazy
implementation causes us to always take that early exit.

Proposed fix:

Rather than relying on the return value from the original getter, which
is not guaranteed to work consistently, we can base our decisions on the
instruction pointer. If it points outside any module, or if it points to
within a function in the module containing V8 whose name starts with
"Builtins_", then we can build a custom result for the Locals pane.

Change-Id: I6644071d5d83a25b964d9f4018265532528cc85c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3759228
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#81856}
2022-07-20 15:57:01 +00:00
..
cur-isolate.cc
cur-isolate.h [v8windbg] Fix dx @$curisolate() 2021-03-25 15:52:23 +00:00
js-stack.cc [v8windbg] Fix jsstack command to skip unavailable fields 2021-07-14 00:01:52 +00:00
js-stack.h [v8windbg] Add jsstack command 2021-04-07 23:56:07 +00:00
local-variables.cc Fix v8windbg Locals pane behavior 2022-07-20 15:57:01 +00:00
local-variables.h
object-inspection.cc [v8windbg] Skip undefined types in Torque structs 2022-05-18 15:24:09 +00:00
object-inspection.h [v8windbg] Display js function only for js frame 2020-09-21 07:50:14 +00:00
v8-debug-helper-interop.cc [config] Add V8_NODISCARD for Scope classes 2020-11-26 11:08:45 +00:00
v8-debug-helper-interop.h [v8windbg] Display js function only for js frame 2020-09-21 07:50:14 +00:00
v8windbg-extension.cc [tools] Make v8windbg more resilient to inlining 2021-11-18 15:29:00 +00:00
v8windbg-extension.h [v8windbg] Show bitset name of compiler type 2020-06-23 19:36:36 +00:00