Now I am really confused and I am not sure we are talking about the same thing. In bash-4.3.30 on
ftp://ftp.gnu.org/gnu/bash at line 723 of shell.c there is:
if (debugging_mode && locally_skip_execution == 0 && running_setuid == 0 && dollar_vars[1])
start_debugger ();
Shouldn't dollar_vars[1] be dollar_vars[0] (the name of the script to be debugged)?
It might be a good idea to add an else branch to give a warning, but that warning would warn about the fact that suid was set, or no debugged script was given, or even -n (skip_execution) was given so debugger main file is getting read. But this is different from the problem encountered.