When gdb calls error it fails to switch the terminal away from the inferior, causing it to be stopped by the kernel. For example, the error in symbol_file_add_from_memory happens while the inferior owns the terminal.
Fixed by commit 766f883622.
*** Bug 24928 has been marked as a duplicate of this bug. ***