阻止 gdb 将命令回显到带有“+”前缀的提示符

Stop gdb from echoing commands to the prompt with a "+" prefix

加载 .gdbinit 时,gdb 打印出带有“+”前缀的配置行,并回显我键入的带有“+”前缀的任何命令。如何阻止它打印这些行?请参阅下面的示例。

当我使用编辑器集成时——特别是尝试使用 emacs——它在后台调用“信息中断”时,这就成了一个问题。它在控制台上连续打印为“+info break”,使 gdb 提示符无法使用。

+set history remove-duplicates 1
+set history filename ~/.gdb_history
+set disassembly-flavor intel
+set print pretty on
+skip file allocator.h
File allocator.h will be skipped when stepping.
+skip file auto_ptr.h
File auto_ptr.h will be skipped when stepping.
+skip file basic_string.h
File basic_string.h will be skipped when stepping.
+skip file basic_string.tcc
File basic_string.tcc will be skipped when stepping.
+skip file move.h
File move.h will be skipped when stepping.
+skip file range_access.h
File range_access.h will be skipped when stepping.
+skip file shared_ptr.h
...
(gdb) s
+s

When loading .gdbinit, gdb prints out the config lines with a "+" prefix, as well as echos any command I type with a "+" prefix. How do I stop it from printing these lines?

GDB 默认情况下不会这样做。您的 ~/.gdbinit 中有一些设置导致 GDB 执行此操作(很可能:set trace-commands on)。

解决方案:删除该设置。