Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
- name: Set Cargo.toml version
run: |
sed -i "s/^version = .*/version = \"${{ steps.version.outputs.version }}\"/g" Cargo.toml
sed -i "s/.version\(".*\)/.version(\"${{ steps.version.outputs.version }}\")/g" src/bin.rs
# github actions email from here: https://github.community/t/github-actions-bot-email-address/17204
- name: Commit changes
run: |
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ jobs:
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Copy and rename binary
run: cp target/${{ matrix.target }}/release/esp_exception_decoder esp_exception_decoder_${{ matrix.bin_suffix }}
run: cp target/${{ matrix.target }}/release/esp_stacktrace_decoder esp_stacktrace_decoder_${{ matrix.bin_suffix }}

- name: Release
uses: softprops/[email protected]
with:
files: esp_exception_decoder_${{ matrix.bin_suffix }}
files: esp_stacktrace_decoder_${{ matrix.bin_suffix }}

publish-exe-to-github:
name: Publish exe tool to Github
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
- name: Release
uses: softprops/[email protected]
with:
files: target/x86_64-pc-windows-gnu/release/esp_exception_decoder.exe
files: target/x86_64-pc-windows-gnu/release/esp_stacktrace_decoder.exe

publish-web-to-github:
name: Publish web tool to GitHub
Expand All @@ -137,15 +137,15 @@ jobs:
- name: Run wasm-pack
run: wasm-pack build --target web --out-dir web/
- name: Make an archive for web deployment
run: tar czf esp_exception_decoder_wasm.tar.gz -C web index.html esp_exception_decoder_rs.js esp_exception_decoder_rs_bg.wasm
run: tar czf esp_stacktrace_decoder_wasm.tar.gz -C web index.html esp_stacktrace_decoder_rs.js esp_stacktrace_decoder_rs_bg.wasm

- name: Release
uses: softprops/[email protected]
with:
files: esp_exception_decoder_wasm.tar.gz
files: esp_stacktrace_decoder_wasm.tar.gz

- name: Copy files for GitHub Pages deployment
run: mkdir -p public; cp web/index.html web/esp_exception_decoder_rs.js web/esp_exception_decoder_rs_bg.wasm public/
run: mkdir -p public; cp web/index.html web/esp_stacktrace_decoder_rs.js web/esp_stacktrace_decoder_rs_bg.wasm public/

- uses: actions/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
[package]
name = "esp-exception-decoder"
name = "esp-stacktrace-decoder"
description = "An ESP stack trace decoder"
version = "1.3.2"
edition = "2018"
authors = ["Maxime Borges <[email protected]>"]
repository = "https://github.com/esphome/esp-stacktrace-decoder"
license = "MIT"

[lib]
name = "esp_exception_decoder_rs"
name = "esp_stacktrace_decoder_rs"
path = "src/lib.rs"
crate-type = ["cdylib", "rlib"]

[[bin]]
name = "esp_exception_decoder"
name = "esp_stacktrace_decoder"
path = "src/bin.rs"

[dependencies]
Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ Everything run in your browser, ✨just like that✨.

![screenshot](https://user-images.githubusercontent.com/159235/136428494-4fdb6c69-74ca-42ab-8bf7-e26d1d625a28.png)

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](https://github.com/esphome/esp-stacktrace-decoder/releases), or by compiling the library in WebAssembly using `wasm-pack`:
You can also deploy it yourself by hosting the content of the pre-compiled package `esp_stacktrace_decoder_wasm.tar.gz` on the [release page](https://github.com/esphome/esp-stacktrace-decoder/releases), 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.
Note that only the `index.html`, `esp_stacktrace_decoder_rs.js` and `esp_stacktrace_decoder_rs_bg.wasm` from the `web/` directory are necessary.

Then you can host the content of the `web/` directory on any HTTP server.
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

Expand All @@ -33,7 +33,7 @@ Opening the `index.html` file from your filesystem in your browser will not work

A bit more boring command line tool is also available:

![esp_exception_decoder_rs_cli](https://user-images.githubusercontent.com/159235/136429806-48b82e04-cc55-4dda-84de-d143001165c3.png)
![esp_stacktrace_decoder_rs_cli](https://user-images.githubusercontent.com/159235/136429806-48b82e04-cc55-4dda-84de-d143001165c3.png)

Get the latest binary release here: [Releases](https://github.com/esphome/esp-stacktrace-decoder/releases)

Expand All @@ -45,20 +45,19 @@ Or build it yourself:

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

chmod +x esp_exception_decoder
chmod +x esp_stacktrace_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
./esp_stacktrace_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
cat stack_trace.txt | ./esp_stacktrace_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
./esp_stacktrace_decoder firmware.elf
# The program is executing but not displaying anything
# Paste the stack trace here
# Then press CTRL+D

12 changes: 6 additions & 6 deletions src/bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::fs::File;
use std::io::{Read, Stdin};

use clap::{App, Arg};
use esp_exception_decoder_rs::decode;
use esp_stacktrace_decoder_rs::decode;
use colored::*;

enum DumpSource<'a> {
Expand All @@ -12,8 +12,8 @@ enum DumpSource<'a> {

fn main() {
let matches = App::new("hardliner")
.version("0.1")
.about("ESP8266 exception decoder")
.version("1.3.2")
.about("ESP stacktrace decoder")
.arg(
Arg::with_name("elf")
.value_name("binary_file")
Expand All @@ -31,7 +31,7 @@ fn main() {

let binary_file = matches.value_of("elf").unwrap();
let mut binary_file = File::open(binary_file).unwrap();
let mut binary_buf = Vec::<u8>::new();
let mut binary_buf = Vec::<u8>::new();
let _ = binary_file.read_to_end(&mut binary_buf);

let stdin = std::io::stdin();
Expand All @@ -57,8 +57,8 @@ fn main() {

let decoded_addresses = decode(&binary_buf, &stack_trace);
for address in decoded_addresses {
println!("0x{:04x}: {} at {}",
address.address,
println!("0x{:04x}: {} at {}",
address.address,
address.function_name.bold(),
address.location.blue()
);
Expand Down