0

When I debug a ncurses appplication I usually do the following:

gdb --tty=/dev/ttys000 ...

This will then make the ncurses application to run in a different terminal than the one gdb runs in.

Recently I discovered cgdb and I very much like it. Unfortunately it does not seem to respect the --tty option.

Are there any other way of doing this? How do the cgdb people debug cgdb :) ?

Thanks.

Ynv
  • 1,824
  • 3
  • 20
  • 29

1 Answers1

1

Yes, you can use tty command the same way as --tty option, either in gdb or in cgdb. See Debugging Ncurses Programs. Also you can use gdb in tui mode. It is much like cgdb.

ks1322
  • 33,961
  • 14
  • 109
  • 164
  • Thanks for your reply. Astonishingly this does not work on my machine. I asked in the cgdb IRC and there they told me to just attach the process and this turned out to be working. The only problem is that I can't reach any part of the code as I am attaching to a already running process.... – Ynv Mar 08 '12 at 14:02
  • I have tried this `(gdb) tty /dev/ttys000` on my machine on sample ncurses app and this worked for me. If this does not work on your machine than I don't know what is the problem, sorry. You may use gdb tui as I said, than `gdb --tty=/dev/ttys000` will also work. – ks1322 Mar 08 '12 at 14:18
  • I'm on os x 10.7 and gdb is not compiled with TUI... Entering tty works, what does not work is starting cgdb with the --tty=... option. Thanks for your help! – Ynv Mar 08 '12 at 15:38
  • Does entering tty work in cgdb via `tty` command? If it does, why not to use it? It is essentially the same as `--tty=...`, [gdb doc](http://sources.redhat.com/gdb/current/onlinedocs/gdb.html#Input_002fOutput). – ks1322 Mar 08 '12 at 16:06
  • Yeah it works. I have become tired of starting a terminal, entering sleep n, then looking for the tty, starting cgdb and entering it all manually. I wanted to write a shell script to do this for me which seems to be unbelievably complex.... – Ynv Mar 08 '12 at 16:25