2022-03-09 01:47:24 -08:00
---
2022-11-04 10:06:45 -07:00
id: stacktraces
title: Stacktraces
sidebar_label: Stacktraces
2024-06-18 13:53:25 -07:00
sidebar_position: 5
2022-03-09 01:47:24 -08:00
---
2022-11-04 10:06:45 -07:00
## Decoding Stacktraces
2022-03-09 01:47:24 -08:00
You may encounter a situation where your device crashes and are left with a stacktrace, below are two methods of decoding them.
2022-11-07 20:53:52 -08:00
### Manually
2022-03-09 01:47:24 -08:00
:::info
This method uses the symbols of the `firmware.elf` file generated from your latest build, you may wish to rebuild to get up-to-date symbols.
:::
2023-01-19 05:01:57 -08:00
1. Save the backtrace string to a text file:
```text title="backtrace.txt"
Backtrace: 0x....
```
2022-03-09 04:10:04 -08:00
2022-11-07 20:53:52 -08:00
2. Run the exception decoder:
2023-01-19 05:01:57 -08:00
```shell
bin/exception_decoder.py backtrace.txt
```
2022-03-09 01:47:24 -08:00
2022-11-07 20:53:52 -08:00
### In Real-Time
2022-03-09 01:47:24 -08:00
2022-11-07 20:53:52 -08:00
In order to decode stack traces in real time, keep the following command (replacing `DEVICE_PORT` with your device's port) running in your terminal with the target device connected:
2023-01-19 05:01:57 -08:00
2022-04-01 06:34:49 -07:00
```shell
2022-03-09 01:47:24 -08:00
pio device monitor --port DEVICE_PORT -f esp32_exception_decoder
```