In bash 4.4.12, if I have some 'library' like functions that I read in at login time, and then later call them -- under trace or under bashdb, no source is shown, as bashdb (and for trace, bash) doesn't seem to be able to retrieve the original source file name and line number where the function was defined.
I'm attaching/including 2 files that demonstrate this: The first I will call 'lib.sh' that is sourced from my /etc/profile and my /etc/bashrc if bashrc can't find the function. ---'lib.sh'--- #!/bin/bash # add numbers passed in and print result to stdout addnums() { declare -i sum=0 while (($#)); do [[ $1 =~ [-0-9]+ ]] || return -1 sum+=$1; shift done printf "%d\n" "$sum" return 0 } declare -fxr addnums ---'prog.sh'--- #!/bin/bash # prog: calls addnums on each line read from stdin while read ln; do addnums $ln done --------------- After lib.sh has been sourced, then either trace prog.sh or try bashdb and single stepping through 'addnums'.