Re: CGDB



On 5/23/16, Nicolas Rybkin <mfkorenev yandex ru> wrote:
Is it possible to debug MC using GDB/CGDB?

Sure. There are ways to make gdb and mc use two different terminals
(as Slava mentioned, and see later), but, depending on what you want,
this is often not needed.


I can't debug it with pure GDB too, because I can't use
keyboard when MC is running.

- Did you remember to resume mc's execution by, for example, typing
'cont' in gdb?
- Maybe the fact that mc's screen is garbled leads you to think
(erroneously) that it doesn't respond to keys. Press C-l to make mc
redraw the screen (after 'cont').

Anyway, there are ways to make gdb and mc use different terminals
(but, again, it may not have been this issue that tripped you):

(1) Run './mc' in one terminal and 'sudo gdb -p 1234' (or 'sudo gdb
./mc 1234') in another, where 1234 is mc's PID (which you can find by
executing 'echo $PPID' in mc). (Drop the 'sudo' to get instruction on
how to do without.) In gdb, set breakpoints or whatever, and do 'cont'
to resume mc (you can return to gdb even without breakpoints, by
pressing C-g). (The disadvantage of this simple method is that you
don't get a chance to inspect mc's startup.)

(2) Use 'gdbserver'.

(3) Use gdb's 'tty' command.

I once wrote some notes explaining methods (2) and (3). They're not
quite suitable for public consumption, but here they are:
http://pastebin.com/pqdk1NfB .


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]