Skip to content

Commit

Permalink
Revert "chore: remove forge debug as standalone command, access throu…
Browse files Browse the repository at this point in the history
…gh `--debug` on `forge script` and `forge test` instead" (#1381)

Revert "chore: remove forge debug as standalone command, access through `--de…"

This reverts commit 0ef1fbb.
  • Loading branch information
zerosnacks authored Jan 6, 2025
1 parent 0ef1fbb commit 6f42d2b
Show file tree
Hide file tree
Showing 7 changed files with 474 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
- [`forge config`](./reference/cli/forge/config.md)
- [`forge coverage`](./reference/cli/forge/coverage.md)
- [`forge create`](./reference/cli/forge/create.md)
- [`forge debug`](./reference/cli/forge/debug.md)
- [`forge doc`](./reference/cli/forge/doc.md)
- [`forge eip712`](./reference/cli/forge/eip712.md)
- [`forge flatten`](./reference/cli/forge/flatten.md)
Expand Down Expand Up @@ -285,6 +286,7 @@
- [forge verify-check](./reference/forge/forge-verify-check.md)
- [forge flatten](./reference/forge/forge-flatten.md)
- [Utility Commands](./reference/forge/utility-commands.md)
- [forge debug](./reference/forge/forge-debug.md)
- [forge bind](./reference/forge/forge-bind.md)
- [forge cache](./reference/forge/forge-cache.md)
- [forge cache clean](./reference/forge/forge-cache-clean.md)
Expand Down
18 changes: 17 additions & 1 deletion src/forge/debugger.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Forge ships with an interactive debugger.

The debugger is accessible on [`forge test`](../reference/forge/forge-test.md) and on [`forge script`](../reference/forge/forge-script.md)
The debugger is accessible on [`forge debug`](../reference/forge/forge-debug.md) and on [`forge test`](../reference/forge/forge-test.md).

Using `forge test`:

Expand All @@ -20,6 +20,22 @@ If you have multiple contracts with the same function name, you need to limit th

If the matching test is a fuzz test, the debugger will open the first failing fuzz scenario, or the last successful one, whichever comes first.

Using `forge debug`:

```sh
$ forge debug --debug $FILE --sig $FUNC
```

Where `$FILE` is the path to the contract you want to debug, and `$FUNC` is the signature of the function you want to debug. For example:

```sh
$ forge debug --debug src/SomeContract.sol --sig "myFunc(uint256,string)" 123 "hello"
```

You can also specify raw calldata using `--sig` instead of a function signature.

If your source file contains more than one contract, specify the contract you want to debug using the `--target-contract` flag.

### Debugger layout

![An image of the debugger UI](../images/debugger.png)
Expand Down
2 changes: 2 additions & 0 deletions src/reference/cli/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [`forge config`](./forge/config.md)
- [`forge coverage`](./forge/coverage.md)
- [`forge create`](./forge/create.md)
- [`forge debug`](./forge/debug.md)
- [`forge doc`](./forge/doc.md)
- [`forge eip712`](./forge/eip712.md)
- [`forge flatten`](./forge/flatten.md)
Expand Down Expand Up @@ -171,3 +172,4 @@
- [`chisel view`](./chisel/view.md)
- [`chisel clear-cache`](./chisel/clear-cache.md)
- [`chisel eval`](./chisel/eval.md)

Loading

0 comments on commit 6f42d2b

Please sign in to comment.