You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d1238c8
Browse filesBrowse the repository at this point in the historyBrowse files
Graft "[SH] Fix debug info source location leakage of generator prologue"
Summary:
Setting a breakpoint inside a generator and inspecting variables
returned nothing -- hdb `exec` evaluated to `undefined` and the CDP
Scope panel showed only the global scope -- while the identical
code in a normal function worked.
Root cause: LowerGeneratorFunction builds the generator's state
machine resume prologue (parameter loads, generator_state checks,
and the resume dispatch switch) using an IRBuilder whose source
location had leaked from previously processed user instructions,
namely the last `yield`. Those synthetic entry instructions sit at
the lowest bytecode offsets and run on every resume, yet carry no
scoping info. Because they claimed a real user line, a breakpoint
on that line resolved to the scope-less function entry instead of
the actual user code, so the debugger found no lexical scope and
reported no variables. Only the line matching the last yield broke;
every other line resolved to genuine user code.
Fix: stamp the synthetic resume/dispatch scaffolding with the inner
function's own declaration location (as a normal function's
prologue already does) rather than the leaked user line, at the
three entry/resume-path creation sites. Breakpoints on user lines
now resolve to real user code with intact scoping info, restoring
variable inspection in both hdb (`exec`, `info variables`) and CDP
(the DevTools Scope panel).
Grafted 6a9118a0b5cc1d630d1cdf4b3fceee60dda560ae (D114104972)
- Grafted xplat/static_h to xplat/shermes/stable
Reviewed By: lavenzg
Differential Revision: D115460651
fbshipit-source-id: 0b79bce3c5efbb34996af53f8767937f5f94681d
0 commit comments