How to debug and set break points for a big phoenix project, i.e, Blockscout?

Project link: GitHub - blockscout/blockscout: Blockchain explorer for Ethereum based network and a tool for inspecting and analyzing EVM based blockchains.

which includes four umbrella applications:

  • block_scout_web
  • ethereum_jsonrpc
  • explorer
  • indexer

My environment:

  • MacOs 14.4.1
  • VS Code / Elixir-ls extension
  • elixir 1.14.5-otp-25
  • erlang 25.3.2.8
  • nodejs 18.17.1
  • phoenix == 1.5.14

My problem:
It will cost about 10 minutes to compile the project. I set launch.json and configure it as below:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "mix_task",
            "name": "mix (Default task)",
            "request": "launch",
            "projectDir": "${workspaceRoot}"
        },
        {
            "type": "mix_task",
            "name": "mix test",
            "request": "launch",
            "task": "test",
            "taskArgs": [
                "--trace"
            ],
            "startApps": true,
            "projectDir": "${workspaceRoot}",
            "requireFiles": [
                "test/**/test_helper.exs",
                "test/**/*_test.exs"
            ]
        }
    ]
}

It doesn’t work at all even if I add “task”: “phx.server” to the configure.
Could you teach me how to debug such big project and set break points if possible.
For now, the only method I use is IO.inspect(). It’s okay, but not good enough.
Thank you so much.

What does it do? Are there error messages?

There’s no top-level test directory in that repo; do you get different results if you list locations that exist, like apps/block_scout_web/test/test_helper.exs?

3 Likes