当某个断点命中时终止程序

Kill program when a certain breakpoint hits

我正在使用 gdb 调试我的程序,我需要尝试多种输入组合。所以为了让我更容易,如果某个断点命中,有没有办法终止调试,这样我就可以 运行 使用不同的输入再次进行调试?

is there a way to kill the debug if a certain breakpoint hits

您可以将命令附加到断点。 Documentation。你想要这样的东西:

break foo        # creates breakpoint 1
commands 1
  call _exit(1)  # causes inferior process to exit. 
end