Skip to content

feat(backtraces): resolve modifiers, internal calls and libs using solar #11652

@yash-atreya

Description

@yash-atreya

Component

Forge

Describe the feature you would like

#11547 introduces backtraces to forge in case of a failure but it does not display BacktraceFrame's for modifiers, internal calls / libraries (these get inlined in the bytecode) as this requires TraceMode::Debug and solc ast analysis which was causing OOM issues, See: #11648

We can detect internal calls using solar. Ref: #11612

// Initialize and configure the solar compiler.
let mut analysis = solar::sema::Compiler::new(
solar::interface::Session::builder().with_stderr_emitter().build(),
);
let dcx = analysis.dcx_mut();
dcx.set_emitter(Box::new(
solar::interface::diagnostics::HumanEmitter::stderr(Default::default())
.source_map(Some(dcx.source_map().unwrap().clone())),
));
dcx.set_flags_mut(|f| f.track_diagnostics = false);
// Populate solar's global context by parsing and lowering the sources.
analysis.enter_mut(|compiler| -> Result<()> {
let mut pcx = compiler.parse();
configure_pcx(&mut pcx, &config, Some(&project), Some(&analysis_files))?;
pcx.parse();
let _ = compiler.lower_asts();
Ok(())
})?;

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Blocked

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions