forked from aniani/vim
* Fix some Termdebug issues after #12403 Problem: Cleanup for :Var and :Asm buffers did not apply to prompt mode, and E86 was possible if they were hidden. Solution: Move cleanup to s:EndDebugCommon. Check that the buffers exist before switching. * Fix :Asm in Termdebug prompt mode Problem: :Asm does not work in prompt mode. Solution: Make it work by handling disassembly-related messages properly. The previous implementation depended on the typed or sent (via s:SendCommand()) "disassemble ..." message being visible to s:CommOutput(), but this was only true for the terminal-based job. A more robust solution would be to use GDB MI's -data-disassemble command. I may implement this in a future PR. * Fix Termdebug s:DecodeMessage escaping logic Problem: Termdebug does not escape gdb messages properly. Solution: Improve the logic. Do not mangle messages if they have inner escaped quotes. Use line continuation comments properly. Interestingly, due to the missing line continuation comments (`"\`), most of these substitutions were ignored. Presumably, this logic still isn't exact. For example, if a message ends in `\\"`, the quote may be preserved, even though it's the `\` being escaped (similar issues may exist for the other escapes). This may not be a problem in practice, though.