Search code examples
gdbgit-bash

Cannot enable the TUI when output is not a terminal - GDB with GitBash


I am using gitbash on windows and trying to debug a binary program however I am running into an issue with enabling TUI mode in gdb. I've previously used gdb with TUI enabled so I'm not sure what changed when. I compile my program g++ -g -O0 -std=c++11 recursive_change.cpp -o recursive_change.o and then run gdb ./recursive-change.o. From the gdb dialogue I am usually able to type layout next or layout src to get the graphical mode to show up however when I try this I get

Cannot enable the TUI when output is not a terminal

Launching gdb with --tui gives the same error.

Program being compiled is itself very simple:

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;
}

Solution

  • Adding winpty before gdb solved the issue, as per suggestion by David Grayson here: gdb under msys2 on windows 11 can't use layout "not a terminal" is there a terminal under windows?