Zxdb is a console-mode debugger for native code running on Fuchsia.
It primarily supports C, C++ and Rust code, but any language that compiles natively and exports DWARF symbols should work to some extent.
Interpreted code such as Dart and JavaScript is not supported.
Run zxdb
There are several ways to attach zxdb
to a component through
ffx component debug
:
ffx component debug component-identifier
For example, this command attaches to the component called cobalt.cm
:
ffx component debug cobalt.cm
This shows an output like:
Waiting for process matching "job 20905".
Type "filter" to see the current filters.
👉 To get started, try "status" or "help".
Attached Process 1 state=Running koid=21057 name=cobalt.cm component=cobalt.cm
Loading 15 modules for cobalt.cm ...Done.
[zxdb]
You can also use other types of component identifiers such as a component moniker.
For example, this example attaches to the core/cobalt
component moniker:
ffx component debug core/cobalt
Additionally, you can also use shorter component identifiers, such
as cobalt
:
ffx component debug cobalt
However, if zxdb
can't figure out which component you are referring
to, you may see an output like:
The query "cobalt" matches more than one component instance:
core/cobalt
core/cobalt_system_metrics
To avoid ambiguity, use one of the above monikers instead.
In this case make sure to be specific as to which component you want zxdb
to
attach to.
Using a Fuchsia package URL
You can also use the full Fuchsia package URL:
ffx component debug fuchsia-pkg://fuchsia.com/cobalt#meta/cobalt.cm
This shows an output like:
Waiting for process matching "job 20905".
Type "filter" to see the current filters.
👉 To get started, try "status" or "help".
Attached Process 1 state=Running koid=21057 name=cobalt.cm component=cobalt.cm
Loading 15 modules for cobalt.cm ...Done.
[zxdb]
See available components
You can see a full list of available components:
ffx component list
You should see an output like:
...
bootstrap
bootstrap/archivist
bootstrap/archivist/archivist-pipelines
...
core/brightness_manager
core/build-info
core/cobalt
...
Working with zxdb
Once you have successfully connected to the zxdb
debugger, you may want to:
- Get started with zxdb
- Use breakpoints
- Debug tests using zxdb
- Control thread execution (pausing, stepping, and resuming)
- Evaluate expressions
- Inspect memory
- List handles and kernel objects
- Work with assembly language
- Look at handles
- Understand how symbols are loaded
- Work with exceptions
- See advanced zxdb topics
You can also follow the zxdb tutorials:
Additionally, if you are interested in contributing to zxdb: