knurling-rs / probe-run

Run embedded programs just like native ones
Apache License 2.0
645 stars 75 forks source link

Simplify canary #410

Closed Urhengulas closed 1 year ago

Urhengulas commented 1 year ago

This PR simplifies our canary system. This is possible now, because our stack-painting and stack-measuring got blazingly fast due to #302 #327 #331.

Adds work around for #323.

What

Before this PR there were two modes. By default probe-run would only paint 10% of stack and use that to detect potential stack-overflows. If a user would pass --measure-stack, probe-run would paint the whole stack (which was slow) and report the percentage of stack used, but don't notify about potential stack-overflows.

After this PR there is only a single mode. probe-run always paints the whole stack (which is fast), always reports the percentage of stack used and always reports potential stack-overflows.

The --measure-stack option is not completely removed to avoid a breaking change. But it does not do anything anymore except emitting a deprecation warning.

Some other drive-by changes:

Testing

The unit testing[^1] and on-device tests[^2] succeed

Note to reviewer

While the whole PR got kinda big, the individual commits should be rather self-contained and therefore easier to review.

[^1]: cargo test [^2]: cargo test -- --ignored

jonathanpallant commented 1 year ago

Left some notes, but good job! Looks great!