# Start the Fuchsia debugger

The [`ffx debug connect`](https://fuchsia.dev/reference/tools/sdk/ffx#connect) command starts the Fuchsia debugger
(which is called [`zxdb`](https://fuchsia.dev/docs/development/debugger/README)) for debugging Fuchsia components
on a device.

> [!IMPORTANT]
> **Important:** `zxdb` only supports C++ and Rust at the moment.

## Concepts

`zxdb` is Fuchsia's own debugger that allows you to attach a Fuchsia component
running on a device. Once a component is attached to `zxdb`, you can perform
interactive debugging operations, such as adding breakpoints, stepping through
code, and inspecting stack traces and variables of the component.

For `zxdb` to understand and unpack the code of a Fuchsia component,
the component's debug symbols must be available in your development
environment. (For more information on debug symbols, see
[Register debug symbols](https://fuchsia.dev/docs/development/tools/ffx/workflows/register-debug-symbols).)

When you run the `ffx debug connect` command, it establishes a connection to
the Fuchsia device and starts the `zxdb` terminal on the host machine.
In this terminal, you can use the [`zxdb` commands](https://fuchsia.dev/docs/development/debugger/README) to
interactively debug Fuchsia components running on the device.

## Run the Fuchsia debugger

To start the Fuchsia debugger, run the following command:

    ffx debug connect

Once successfully connected to a Fuchsia device, this command starts the
`zxdb` terminal, for example:

    $ ffx debug connect
    Connecting (use "disconnect" to cancel)...
    Connected successfully.
    👉 To get started, try "status" or "help".
    [zxdb]

In the `zxdb` terminal, you can start performing interactive debugging
operations. The example below shows that `zxdb` is attached to the
`memory_monitor` component and a breakpoint is created at the
component's `main` function:

    [zxdb] attach memory_monitor.cm
    Waiting for process matching "memory_monitor.cm".
    Type "filter" to see the current filters.
    Attached Process 1 state=Running koid=47467 name=memory_monitor.cm
    [zxdb] process
      # State    Koid Name
    ▶ 1 Running 47467 memory_monitor.cm
    [zxdb] break $main
    Created Breakpoint 1 @ $main
       48
     ◉ 49 int main(int argc, const char** argv) {
       50   auto command_line = fxl::CommandLineFromArgcArgv(argc, argv);
    [zxdb]

To exit the `zxdb` terminal, type `exit` or press `Ctrl-D`.

For more information on usages and best practices on `zxdb`,
see the [`zxdb` user guide](https://fuchsia.dev/docs/development/debugger/README).
[](https://issues.fuchsia.dev/issues/new?component=1439230&template=1881640&description=Issue+on:+https://fuchsia.dev/docs/development/tools/ffx/workflows/start-the-fuchsia-debugger.md "Report a bug or suggest improvements on this page") [](https://cs.opensource.google/fuchsia/fuchsia/+/main:docs/development/tools/ffx/workflows/start-the-fuchsia-debugger.md "View the source code of this page") [](https://ci.android.com/edit?repo=fuchsia/fuchsia/main&file=docs/development/tools/ffx/workflows/start-the-fuchsia-debugger.md&cloneRepo=fuchsia/fuchsia:refs/heads/main&fullPath=fuchsia/docs/development/tools/ffx/workflows/start-the-fuchsia-debugger.md "Edit the source code of this page")