dbg-support.sub 661 B

123456789101112131415161718192021222324252627
  1. # This file is intended to be sourced from one of the bashdb test programs
  2. sourced_fn() {
  3. name="fn2"
  4. echo "SOURCED FN LINENO $LINENO"
  5. # Print a stack trace
  6. declare -i n
  7. n=${#FUNCNAME[@]}
  8. for (( i=0 ; (( i < $n )) ; i++ )) ; do
  9. local -i j=i+1
  10. [ $j -eq $n ] && j=i # main()'s file is the same as the first caller
  11. echo "FUNCNAME[$i]: ${FUNCNAME[$i]} called from ${BASH_SOURCE[$j]}" \
  12. "at line ${BASH_LINENO[$i]}"
  13. done
  14. }
  15. echo "SOURCED LINENO $LINENO"
  16. echo "SOURCED BASH_SOURCE[0]" ${BASH_SOURCE[0]}
  17. sourced_fn
  18. #;;; Local Variables: ***
  19. #;;; mode:shell-script ***
  20. #;;; eval: (sh-set-shell "bash") ***
  21. #;;; End: ***