A Rust ESP stack trace decoder that can also runs in your browser thanks to WebAssembly

Overview

ESP Stack Trace Decoder

A Rust ESP stack trace decoder that can also runs in your browser thanks to WebAssembly.

It is composed of a ⌨️ Rust library, a 💻 Rust command line tool, and a 🌏 WebAssembly library with a HTML interface.

Web tool

The web tool is hosted on Github Pages here.

It is taking your .elf firmware and the stack trace, and outputs the list of functions and their locations, without uploading any of your data anywhere.

Everything run in your browser, just like that.

screenshot

You can also deploy it yourself by hosting the content of the pre-compiled package esp_exception_decoder_wasm.tar.gz on the release page, or by compiling the library in WebAssembly using wasm-pack:

# Install the Rust toolchain by following the latest instructions from here: https://www.rust-lang.org/tools/install
# Install wasm-pack by following the latest instructions from here: https://rustwasm.github.io/wasm-pack/installer
# Build the WebAssembly library
wasm-pack build --target web --out-dir web/

Note that only the index.html, esp_exception_decoder_rs.js and esp_exception_decoder_rs_bg.wasm from the web/ directory are necessary.

Then you can host the content of the web/ directory on any HTTP server.

Here you can find a lot of different ways of starting a simple HTTP server that can be used to serves the web/ folder: http://gist.github.com/willurd/5720255

Opening the index.html file from your filesystem in your browser will not work since we can't include JavaScript files without a HTTP server due to default CORS policy.

Command line tool

A bit more boring command line tool is also available:

esp_exception_decoder_rs_cli

Get the latest binary release here: Releases

Or build it yourself:

# Install the Rust toolchain by following the latest instructions here: https://www.rust-lang.org/tools/install
# Build the command line binary    
cargo build --release

To run the command line tool, make sure that the binary is executable:

chmod +x esp_exception_decoder

Then execute it like this, replacing firmware.elf with your .elf firmware and stack_trace.txt with the stack trace from your ESP:

./esp_exception_decoder firmware.elf stack_trace.txt

You can also ommit the stack trace file and use the standard input instead:

cat stack_trace.txt | ./esp_exception_decoder firmware.elf

Or even use the tool semi-interactively by running the program without the stack trace file parameter, pasting the stack trace and pressing CTRL+D:

./esp_exception_decoder firmware.elf
# The program is executing but not displaying anything
# Paste the stack trace here
# Then press CTRL+D
You might also like...
WebAssembly serialization/deserialization in rust

parity-wasm Low-level WebAssembly format library. Documentation Rust WebAssembly format serializing/deserializing Add to Cargo.toml [dependencies] par

This is a webpack loader that loads Rust code as a WebAssembly module

rust-native-wasm-loader This is a webpack loader that loads Rust code as a WebAssembly module. It uses the native Rust support for compiling to wasm32

Zaplib is an open-source library for speeding up web applications using Rust and WebAssembly.

⚡ Zaplib Zaplib is an open-source library for speeding up web applications using Rust and WebAssembly. It lets you write high-performance code in Rust

A template for kick starting a Rust and WebAssembly project using wasm-pack.

A template for kick starting a Rust and WebAssembly project using wasm-pack.

Client for integrating private analytics in fast and reliable libraries and apps using Rust and WebAssembly

TelemetryDeck Client Client for integrating private analytics in fast and reliable libraries and apps using Rust and WebAssembly The library provides

Rust-based WebAssembly bindings to read and write Apache Parquet files

parquet-wasm WebAssembly bindings to read and write the Parquet format to Apache Arrow. This is designed to be used alongside a JavaScript Arrow imple

A simple Rust and WebAssembly real-time implementation of the Vigénere Cipher utilizing the Sycamore reactive library.
A simple Rust and WebAssembly real-time implementation of the Vigénere Cipher utilizing the Sycamore reactive library.

WebAssembly Vigenère Cipher A simple Rust and WebAssembly real-time implementation of the Vigenère Cipher utilizing the Sycamore reactive library, Tru

A prototype WebAssembly linker using module linking.

WebAssembly Module Linker Please note: this is an experimental project. wasmlink is a prototype WebAssembly module linker that can link together a mod

WebAssembly modules that use Azure services

This is an experimental repository containing WebAssembly modules running on top of WAGI (WebAssembly Gateway Interface, which allows you to run WebAssembly WASI binaries as HTTP handlers) and using Azure services.

Comments
  • Decoding code crashes

    Decoding code crashes

    The decoding code is full of unwraps, which means that even the smallest decoding failure will result in a crash, instead of (at least) partially decoded stack trace.

    For me, it crashes here.

    I can provide you with an .ELF file and a stacktrace if necessary, but in general I believe (a) some of these errors (like unable to find a line and file) should be recoverable and (b) the others should probably be errors instead of panics.

    opened by ivmarkov 10
An Intermediate Representation which can be compiled into WebAssembly

WebAssembly Intermediate Representation This is an Intermediate Representation which can be compiled into WebAssembly. The source code is in an experi

Blue Forest 2 Dec 7, 2022
Sealed boxes implementation for Rust/WebAssembly.

Sealed boxes for Rust/WebAssembly This Rust crate provides libsodium sealed boxes for WebAssembly. Usage: // Recipient: create a new key pair let reci

Frank Denis 16 Aug 28, 2022
A console and web-based Gomoku written in Rust and WebAssembly

?? rust-gomoku A console and web-based Gomoku written in Rust and WebAssembly Getting started with cargo & npm Install required program, run # install

namkyu1999 2 Jan 4, 2022
darkforest is a console and web-based Roguelike written in Rust and WebAssembly.

darkforest darkforest is a console and web-based Roguelike written in Rust and WebAssembly. Key Features TBA Quick Start TBA How To Contribute Contrib

Chris Ohk 5 Oct 5, 2021
Simple file sharing with client-side encryption, powered by Rust and WebAssembly

Hako Simple file sharing with client-side encryption, powered by Rust and WebAssembly Not feature-packed, but basic functionalities are just working.

Jaehyeon Park 30 Nov 25, 2022
bn.js bindings for Rust & WebAssembly with primitive-types support

bn.rs bn.js bindings for Rust & WebAssembly with primitive-types support Write Rust code that uses BN use std::str::FromStr; use primitive_types::{H1

Alexey Shekhirin 23 Nov 22, 2022
A handy calculator, based on Rust and WebAssembly.

qubit ?? Visit Website To Use Calculator Example ?? Visit Website To Use Calculator 2 + 2

Abhimanyu Sharma 55 Dec 26, 2022
A simple compile-to-WebAssembly language rewritten in Rust

chasm A very simple compile-to-WebAssembly language You can play with chasm online. This is a rewrite in Rust of the compiler for the language chasm.

null 11 Nov 27, 2022
Stylist is a CSS-in-Rust styling solution for WebAssembly Applications.

Stylist Stylist is a CSS-in-Rust styling solution for WebAssembly Applications. This is a fork of css-in-rust. Install Add the following to your Cargo

Kaede Hoshikawa 190 Dec 30, 2022
Rust WebGL2 wrapper with a focus on making high-performance WebAssembly graphics code easier to write and maintain

Limelight Limelight is a WebGL2 wrapper with a focus on making high-performance WebAssembly graphics code easier to write and maintain. demo.mov live

drifting in space 27 Dec 30, 2022