This enhancement suggestion is the same as what was done for JDK-8210118, but in this case it is applied to the test/jdk version of waitForPrompt() instead of the nsk/jdb version.
Note for JDK-8210118 the dumping of the pending reply was done in receiveReply() after waitForPrompt() timed out, but it might be more appropriate to do it in waitForPrompt(). I had considered this for JDK-8210118, but only after having already implemented and extensively tested the fix in receiveReply(), so I just left the code there.