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

refactor(debugger): rewrite draw code #6522

Merged
merged 14 commits into from
Dec 6, 2023
15 changes: 5 additions & 10 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
[alias]
cheats = "test -p foundry-cheatcodes-spec --features schema tests::"
test-debugger = "test -p forge --test cli manual_debug_setup -- --include-ignored --nocapture"

# Increase the stack size to 10MB for Windows targets, which is in line with Linux
# (whereas default for Windows is 1MB).
[target.x86_64-pc-windows-msvc]
rustflags = [
# Increases the stack size to 10MB, which is
# in line with Linux (whereas default for Windows is 1MB)
"-Clink-arg=/STACK:10000000",
]
rustflags = ["-Clink-arg=/STACK:10000000"]

[target.i686-pc-windows-msvc]
rustflags = [
# Increases the stack size to 10MB, which is
# in line with Linux (whereas default for Windows is 1MB)
"-Clink-arg=/STACK:10000000",
]
rustflags = ["-Clink-arg=/STACK:10000000"]
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/cli/src/utils/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use foundry_compilers::{
Artifact, ProjectCompileOutput,
};
use foundry_config::{error::ExtractConfigError, figment::Figment, Chain, Config, NamedChain};
use foundry_debugger::DebuggerBuilder;
use foundry_debugger::Debugger;
use foundry_evm::{
debug::DebugArena,
executors::{DeployResult, EvmError, ExecutionErr, RawCallResult},
Expand Down Expand Up @@ -404,7 +404,7 @@ pub async fn handle_traces(

if debug {
let sources = etherscan_identifier.get_compiled_contracts().await?;
let mut debugger = DebuggerBuilder::new()
let mut debugger = Debugger::builder()
.debug_arena(&result.debug)
.decoder(&decoder)
.sources(sources)
Expand Down
3 changes: 2 additions & 1 deletion crates/debugger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ homepage.workspace = true
repository.workspace = true

[dependencies]
foundry-common.workspace = true
foundry-compilers.workspace = true
foundry-evm-core.workspace = true
foundry-evm-traces.workspace = true
foundry-common.workspace = true

alloy-primitives.workspace = true

Expand Down
2 changes: 1 addition & 1 deletion crates/debugger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! Interactive Solidity TUI debugger.

#![warn(unused_crate_dependencies)]
#![warn(unused_crate_dependencies, unreachable_pub)]

#[macro_use]
extern crate tracing;
Expand Down
8 changes: 4 additions & 4 deletions crates/debugger/src/op.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/// Named parameter of an EVM opcode.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct OpcodeParam {
pub(crate) struct OpcodeParam {
/// The name of the parameter.
pub name: &'static str,
pub(crate) name: &'static str,
/// The index of the parameter on the stack. This is relative to the top of the stack.
pub index: usize,
pub(crate) index: usize,
}

impl OpcodeParam {
/// Returns the list of named parameters for the given opcode.
#[inline]
pub fn of(op: u8) -> &'static [Self] {
pub(crate) fn of(op: u8) -> &'static [Self] {
MAP[op as usize]
}
}
Expand Down
Loading