Here's the first backtrace, which resulted from typing `C-c C-c' (comint-interrupt-subjob) in shell-mode, from which I ran gdb.