Tente isto:
shopt -s extdebug
declare -F gem
De man builtins
:
extdebug
If set, behavior intended for use by debuggers is enabled:
1. The -F option to the declare builtin displays the source file
name and line number corresponding to each function name sup‐
plied as an argument.