For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > January 2008 > Using a c debugger with a curses program









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Using a c debugger with a curses program
Ido Yehieli

2008-01-26, 7:20 pm

it seems ddd doesn't work too well with programs using pdcurses (it
kind of works for a short while and then crashes more often than not).
Insight doesn't even manage to start my program before freezing.

Does anyone have any idea on how to use a debugger under these
circumstances? Compiling my program to use ncursese instead of
pdcurses doesn't seem to help much either.

-Ido.
Gary R. Schmidt

2008-01-27, 8:20 am

Ido Yehieli wrote:
> it seems ddd doesn't work too well with programs using pdcurses (it
> kind of works for a short while and then crashes more often than not).
> Insight doesn't even manage to start my program before freezing.
>
> Does anyone have any idea on how to use a debugger under these
> circumstances? Compiling my program to use ncursese instead of
> pdcurses doesn't seem to help much either.
>
> -Ido.

Run the program in the debugger with the input and output re-directed to
another terminal, that's how I've always done it.

$ debugger a.out
debugger> run < /dev/tty01 > /dev/tty01

Obviously you have to have more than one /terminal/ available, but in
these days where xterms and their ilk abound, it's not like you have to
nick the VT340 off someone else's desk!!

Cheers,
Gary B-)

--
________________________________________
______________________________________
Armful of chairs: Something some people would not know
whether you were up them with or not
- Barry Humphries
Michal Nazarewicz

2008-01-28, 4:33 am

Ido Yehieli <Ido.Yehieli@gmail.com> writes:

> it seems ddd doesn't work too well with programs using pdcurses (it
> kind of works for a short while and then crashes more often than not).
> Insight doesn't even manage to start my program before freezing.
>
> Does anyone have any idea on how to use a debugger under these
> circumstances? Compiling my program to use ncursese instead of
> pdcurses doesn't seem to help much either.


If you don't need to debug that program from the very beginning you can
run your application, get it's PID and then run gdb's attach command.

--
Best regards, _ _
.o. | Liege of Serenly Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +--<mina86*tlen.pl>--<jid:mina86*jabber.org>--ooO--(_)--Ooo--
Jan van den Broek

2008-01-29, 7:26 pm

Sat, 26 Jan 2008 11:37:14 -0800 (PST)
Ido Yehieli <Ido.Yehieli@gmail.com> schrieb:
>it seems ddd doesn't work too well with programs using pdcurses (it
>kind of works for a short while and then crashes more often than not).
>Insight doesn't even manage to start my program before freezing.
>
>Does anyone have any idea on how to use a debugger under these
>circumstances? Compiling my program to use ncursese instead of
>pdcurses doesn't seem to help much either.


I can't test it on ddd, but what works for me with gdb is using to
terminal-sessions, on one I open gdb and enter 'tty /dev/other_terminal',
on the other I put the active shell to sleep with 'sleep 3000'.
--
Jan van den Broek balglaas@xs4all.nl

"There are only five great men in the world and three of them
are hamburgers" --- Don van Vliet
apm35@student.open.ac.uk

2008-01-30, 8:23 am

On 26 Jan, 19:37, Ido Yehieli <Ido.Yehi...@gmail.com> wrote:
> it seems ddd doesn't work too well with programs using pdcurses (it
> kind of works for a short while and then crashes more often than not).
> Insight doesn't even manage to start my program before freezing.
>
> Does anyone have any idea on how to use a debugger under these
> circumstances? Compiling my program to use ncursese instead of
> pdcurses doesn't seem to help much either.
>
> -Ido.


The difficulties you are having demonstrate the benefits of separating
GUI logic from business logic. They allow the 2 to be tested
independently. And I strongly suspect that the error is NOT in curses.

I recommend doing this split then writing a test program that tests
the business logic in isolation. That will be alot easier to run using
ddd.

Regards,

Andrew Marlow
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com