Skip to content

Commit

Permalink
dump_asm.sh improvements
Browse files Browse the repository at this point in the history
log if no panics were found

trim debug sections from asm

add EXTRA_TRIM to dump_asm
  • Loading branch information
daniel5151 committed Apr 30, 2023
1 parent 5fed446 commit 2cf3299
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions example_no_std/dump_asm.sh
Expand Up @@ -8,13 +8,22 @@ then
cargo install rustfilt
fi

rm -rf ./target
cargo rustc --release -- --emit asm -C "llvm-args=-x86-asm-syntax=intel"
cat ./target/release/deps/gdbstub_nostd-*.s | rustfilt > asm.s
sed -i -E '/\.(cfi_def_cfa_offset|cfi_offset|cfi_startproc|cfi_endproc|size)/d' asm.s

if [ -n "$EXTRA_TRIM" ]; then
sed -i -E '/\.(Ltmp|file|loc)/d' asm.s
sed -i -E '/.section\t.debug_loc/,$d' asm.s
fi

echo "asm emitted to asm.s"

if grep "core::panicking::panic_fmt" asm.s
then
echo "found panic in example_no_std!"
exit 1
else
echo "no panics in example_no_std"
fi

0 comments on commit 2cf3299

Please sign in to comment.