Skip to content

Restore globals scope for 5.2 and above#92

Open
tmcgilchrist wants to merge 3 commits into
hackwaly:masterfrom
tmcgilchrist:restore_globals
Open

Restore globals scope for 5.2 and above#92
tmcgilchrist wants to merge 3 commits into
hackwaly:masterfrom
tmcgilchrist:restore_globals

Conversation

@tmcgilchrist

Copy link
Copy Markdown
Collaborator

Fixes #74

Stacked on top of #91

Since 5.2 the SYMB section of a bytecode executable numbers globals by
Symtable.Global.t (compilation units and predefined exceptions) rather
than by Ident.t. Marshal is untyped, so reading the table as an
int Ident.Map.t kept working silently, the names still decode, but every
key looks like a local ident rather than a persistent one, so the
is_structure_module filter in Value_scope rejected all of them and the
Globals scope came out empty. Eval.value_path could no longer resolve
globals either.

Read the table with the compiler's own key type on 5.2 and later, and
map compunits back to persistent idents and predefs to predef idents,
which is what the table held before 5.2. A future change to the
representation is now a compile error rather than a silently empty scope.
The tests spawn the real adapter, launch a bytecode program over the
debug adapter protocol, stop at a breakpoint and diff a transcript of
what they find against a recorded file.

test_scopes covers the Globals scope regression from hackwaly#74. test_frames
stops inside a function and walks the call stack.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Globals" scope empty since OCaml 5.2

1 participant