solana/programs/bpf/rust/dump.sh

22 lines
659 B
Bash
Raw Normal View History

2019-05-21 11:22:33 -07:00
#!/usr/bin/env bash
2019-05-21 13:39:27 -07:00
if [ "$#" -ne 1 ]; then
2019-06-10 11:15:28 -07:00
echo "Error: Must provide the name of the project to dump"
2019-05-21 13:39:27 -07:00
exit 1
fi
2019-05-21 11:22:33 -07:00
./clean.sh "$1"
./build.sh "$1"
cd "$1"
cp ./target/dump.txt ./targetdump-last.txt 2>/dev/null
set -ex
2019-06-10 11:15:28 -07:00
ls -la ./target/bpfel-unknown-unknown/release/solana_bpf_rust_"${1%/}".so > ./target/dump_mangled.txt
greadelf -aW ./target/bpfel-unknown-unknown/release/solana_bpf_rust_"${1%/}".so >> ./target/dump_mangled.txt
llvm-objdump -print-imm-hex --source --disassemble ./target/bpfel-unknown-unknown/release/solana_bpf_rust_"${1%/}".so >> ./target/dump_mangled.txt
2019-05-21 11:22:33 -07:00
sed s/://g < ./target/dump_mangled.txt | rustfilt > ./target/dump.txt