Fix hardcoded source ID in bugc debug info#177
Merged
Conversation
The compiler was hardcoding source ID as "0" in three places when generating ethdebug/format debug info. Now threads the sourcePath from compilation input through the IR generation state and into the final Format.Program output. - Add sourceId field to Ir.Module and State.Module - IR gen pass accepts sourcePath, defaults to "0" if absent - process.ts code contexts use sourceId instead of module name - program-builder.ts reads sourceId from IR module - Update all test module constructions with sourceId field - Add tests verifying sourceId default and sourcePath threading
Contributor
|
Member
Author
|
Review (debugger agent): Approve. The fix correctly threads
The This matters for pointer dereferencing — when programs-react resolves variables, the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The compiler was hardcoding source ID as
"0"in three places when generating ethdebug/format debug info:irgen/generate/module.ts— variable declaration source rangesirgen/generate/process.ts— code context source ranges (was using module name instead of source ID)evmgen/program-builder.ts— contract definition source rangeThis PR threads
sourcePathfrom the compilation input through the IR generation state (State.Module.sourceId) and intoIr.Module.sourceId, which is then used consistently across all debug info output. When nosourcePathis provided (e.g. in tests), it falls back to"0".Changes:
sourceIdfield toIr.ModuleandState.ModulesourcePathfrom sequence state, defaults to"0"process.tscode contexts usesourceIdinstead of module nameprogram-builder.tsreadssourceIdfrom IR modulesourceIdfield