首页 > 解决方案 > c++ 调试不会立即开始运行程序,但重新启动调试器使其再次工作

问题描述

我正在通过调试器运行 C++ 程序,我可能遗漏了一些东西,但这是事件的顺序

gdb bin/COL_sep
copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin19.4.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from bin/COl_sep...
(gdb) run arg1.txt
Starting program: /Users/morph/Code/bin/COL_sep arg1.txt
[New Thread 0x2403 of process 45643]

然后什么都不会永远发生。

但是如果我按退出CTRL+Z然后再次执行完全相同的操作,程序运行良好。

gdb bin/COL_sep
GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin19.4.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from bin/COL_sep...
(gdb) run arg1.txt
Starting program: /Users/morph/Code/bin/COL_sep arg1.txt
[New Thread 0x2803 of process 45665]
[New Thread 0x1b03 of process 45665]
warning: unhandled dyld version (16)
Problem Statistics: 
num  Nodes: 30
num  Arcs: 120
num  weights: 20

我不确定为什么它第一次没有运行。每次我重新编译它都不会第一次运行。有人可以让我知道如何纠正这个问题吗?

标签: c++gdb

解决方案


推荐阅读