我在 Windows 上使用 gitbash 并尝试调试二进制程序,但是我遇到了在 gdb 中启用 TUI 模式的问题。我之前使用过启用了 TUI 的 gdb,所以我不确定什么时候发生了什么变化。我编译我的程序
g++ -g -O0 -std=c++11 recursive_change.cpp -o recursive_change.o
,然后运行gdb ./recursive-change.o
。在 gdb 对话框中,我通常可以输入 layout next
或 layout src
来显示图形模式,但是当我尝试这样做时,我得到了
Cannot enable the TUI when output is not a terminal
使用
--tui
启动 gdb 会出现相同的错误。
正在编译的程序本身非常简单:
int main() {
int money = 0;
int n_denominations = 0;
std::vector<int> denominations;
std::cout << "enter money: ";
std::cin >> money;
std::cout << "enter number of denominations: ";
std::cin >> n_denominations;
}
在
winpty
之前添加 gdb
解决了问题,按照 David Grayson 的建议: gdb under msys2 on windows 11 can't use layout "not aterminal" windows 下有终端吗?