trace2line.sh 482 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. set -eu
  3. common_gem5="$1"
  4. shift
  5. common_trace_txt_file="$1"
  6. shift
  7. common_addr2line="$1"
  8. shift
  9. common_vmlinux="$1"
  10. shift
  11. common_run_dir="$1"
  12. shift
  13. (
  14. if "$common_gem5"; then
  15. sed -r 's/^.* (0x[^. ]*)[. ].*/\1/' "$common_trace_txt_file"
  16. else
  17. sed -r 's/.*pc=//' "$common_trace_txt_file"
  18. fi
  19. ) | \
  20. xargs "${common_addr2line}" -e "${common_vmlinux}" -fp | \
  21. sed -E "s|at ${common_vmlinux}/(\./\|)||" | \
  22. uniq -c \
  23. > "${common_run_dir}/trace-lines.txt"