rungdb-user 977 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env bash
  2. . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
  3. gem5_opt=
  4. parsed=$(getopt -o "h${common_getopt_flags}" -l "$common_getopt_flags_long" -- "$@")
  5. eval set -- "$parsed"
  6. while true; do
  7. case "$1" in
  8. h)
  9. echo "$0 <exec-relative-path> [<brk-symbol>]" 2>&1
  10. exit
  11. ;;
  12. *)
  13. common_getopt_case "$@"
  14. ;;
  15. esac
  16. done
  17. executable_rel="$1"
  18. shift
  19. if [ "$#" -gt 0 ]; then
  20. brk="'$1'"
  21. shift
  22. else
  23. brk=
  24. fi
  25. common_setup
  26. if "$common_gem5"; then
  27. gem5_opt=-g
  28. fi
  29. executable="${common_build_dir}/${executable_rel}"
  30. addr="$("${common_root_dir}/runtc" readelf -h "$executable" | awk '/Entry/{ print $NF }' )"
  31. ex="-ex \"add-symbol-file $executable $addr\""
  32. # -X or else lx-symbols throws for arm:
  33. # gdb.MemoryError: Cannot access memory at address 0xbf0040cc
  34. # TODO understand better.
  35. #
  36. # Also, lx-symbols overrides the add-symbol-file commands.
  37. cmd="./rungdb -a '${common_arch}' -b '${ex}' ${gem5_opt} -X ${brk}"
  38. echo "$cmd"
  39. eval "$cmd"