Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace the current source map implementation with the source maps produced from the compiler. #6733

Open
JoshuaBatty opened this issue Nov 19, 2024 · 0 comments
Assignees
Labels
forc-debug Everything related to forc-debug

Comments

@JoshuaBatty
Copy link
Member

forc-debug currently defines and works with the source map as below

pub type Line = i64;
pub type Instruction = u64;
pub type FileSourceMap = HashMap<Line, Vec<Instruction>>;
pub type SourceMap = HashMap<PathBuf, FileSourceMap>;

We should replace this with the source maps that are now being produced by the compiler since #5521

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct SourceMap {
    /// Paths of dependencies in the `~/.forc` directory, with the prefix stripped.
    /// This makes inverse source mapping work on any machine with deps downloaded.
    pub dependency_paths: Vec<PathBuf>,
    /// Paths to source code files, defined separately to avoid repetition.
    pub paths: Vec<PathBuf>,
    /// Mapping from opcode index to source location
    // count of instructions, multiply the opcode by 4 to get the byte offset
    pub map: BTreeMap<usize, SourceMapSpan>,
}
@JoshuaBatty JoshuaBatty added the forc-debug Everything related to forc-debug label Nov 19, 2024
@JoshuaBatty JoshuaBatty self-assigned this Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
forc-debug Everything related to forc-debug
Projects
None yet
Development

No branches or pull requests

1 participant