Dbx Process I/O Window and CURSES problems

Does anybody know how to make CURSES based application to work properly when using Studio 11 dbx 揚rocess I/O?Output Window?

Some characters are scrambled on output and the worst part is that input 揳rrows?from keyboard and some other keys will not return from 搘getch(win) curses function call. 搆eypad()?is set to TRUE.

The application works fine running under xterm with TERM=vt100 settings

It was also running fine under Forte IDE debugger.

Thanks

[478 byte] By [coinserva] at [2007-11-26 17:09:55]
# 1

There is an ongoing discussion of this issue in this

http://forum.java.sun.com/thread.jspa?threadID=5103040

thread.

I"ll have to look more into the keypad issues, but I'd appreciate

if you could characterize the character scrambling a bit better.

Do you know for example which curses commands you

are using, or better yet which ANSI sequences are being sent?

IvanIgorovicha at 2007-7-8 23:37:44 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2

I will try to make you a small sample to reproduce it. However it will take me a while. It is not my front end, I am using it just to get to my stuff.

For now just: The application will draw a frame around each window. The frame has wrong characters in corners. It may have to do something with BOLD mode.

The input will process letters fine but there is no response on arrow keys. It is using wgetch() to read symbols with settings:

Cbreak()

Noecho()

Keypad( ,TRUE)

coinserva at 2007-7-8 23:37:44 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3
A little demo would be nice. I have also printed a curses tutorial and was going to brush up.I have a question for you though.Putting bugs aside, from a usability POV, wouldyou prefer a terminal inside the IDE or outside the IDE?
IvanIgorovicha at 2007-7-8 23:37:44 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 4

Well,

I will try to make demo next week.

Please define terminal inside the IDE or outside the IDE.

If the difference is that you have to attach to the process running in the outside terminal than I would prefer one inside IDE or the one I can use when starting process directly form the debugger. The way Forte was handling the output window was (or at least it looked like) more universal.

The ability to attach to a running process is a very nice and important feature for those processes you just cannot start from the debugger.. However attaching to a process is degrading debugging options ?as discussed in the 揜unning executables in an XTERM?topic and 揑nability to use RTC when attaching to a process.?topic.

Frankly, convenience is one thing and functionality is the other one. I like nice IDEs and Graphical interfaces. On the other side I am still using plain 憊i?and xterm and simple window manager setting, and shell commands instead of all graphical tools. If I have to I do not mind to do it from the command line using hex editor. I am doing cross platform development and it is easier to use simple tools than to learn 10 different GUIs and end up using simple ones anyway. I liked Forte (or old workshop) very much. I like more the old way of watching variables, evaluating expressions, running functions from the display line etc. Unfortunately some thinks do not work with Solaris 10 anymore and I need Sun Studio and new compilers.

coinserva at 2007-7-8 23:37:44 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 5

"Please define terminal inside the IDE or outside the IDE."

Inside IDE: a window managed by the IDEs "windowing system" and

occuring withinin the topmost window of the IDE.

Outside IDE: a window managed by your desktop vying the IDE

for screen space.

Your comments wrt attach are noted. The intent is to have ss_attach

to work with RTC and other tools as well.

IvanIgorovicha at 2007-7-8 23:37:44 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 6

Ivan,

This is promised CURSES code. It is very quick and simple but it will demonstrate issues I was describing. There is also another issue ?which you will notice very soon. If you try to rerun the process the screen will not reset. You can get very odd behavior.

Regarding the terminal I would probably prefer to have it outside the IDE.

Thanks

Code was compiled with:cc 杇 杔 curses

#include <stdlib.h>

#include <stdio.h>

#include <termios.h>

#include <curses.h>

#include <unistd.h>

int main()

{WINDOW *win1;

int key;

char ch;

char *s;

initscr();

clear();

refresh();

win1 = newwin(20,50,0,0);

scrollok(win1,1);

keypad(win1,1);

werase(win1);

box(win1,'*','*');

wrefresh(win1);

cbreak();

noecho();

do {

mvwaddstr(win1,2,3,"CTRL A - quit:");

mvwaddstr(win1,3,3,"Enter Symbol:");

key = wgetch(win1);

mvwaddstr(win1,4,3,"You Entered :");

ch = (char)key;

switch (key) {

case KEY_UP:

waddstr(win1,"KEY_UP");

break;

case KEY_DOWN:

waddstr(win1,"KEY_DOWN ");

break;

case KEY_LEFT:

waddstr(win1,"KEY_LEFT ");

break;

case KEY_RIGHT:

waddstr(win1,"KEY_RIGHT");

break;

case KEY_ENTER:

waddstr(win1,"KEY_ENTER");

break;

default:

if ( ch == '\001' )

break;

else if ( isalpha(ch) ) {

s = " ";

s[0] = ch;

}

else

s = "another ";

waddstr(win1,s);

break;

}

} while ( ch != '\001' );

endwin();

exit(0);

}

coinserva at 2007-7-8 23:37:44 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 7

One thing you could do is have your program run an xterm and redirect its standard input and output via that xterm. It's quite useful if you want to have multiple sources of input and output.

We do this in our simulator.

See my blog entry: http://ccnuma.anu.edu.au/~wpc/blog/programming/pseudo-terminals.html

cheers,

/lib

slashliba at 2007-7-8 23:37:44 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 8

/lib,

At the beginning I have to say that the pseud.c looks nice and probably works very well. However it does not fit my case. Just to explain.

Have you ever seen a 憊i?opening its own xterm? I guess not.

My application is a text based window (CURSES) application to provide simple 揋UI?to a user on a dummy terminals. So it has to work form any terminal which is or is able to simulate VT100 or similar. It is executed from a shell command line and is taking over terminal I/O regardless what it is.

My problem is when I run the application from studio11 IDE the debugger I/O window will not handle CURSES functions properly. Previous versions of development IDE (Forte) was working fine. This is what this topic is about. To fix debugger I/O window in Studio IDE.

To rewrite the whole I/O part of the application just to debug it is also not a very good idea.

To attach to an already running process is only a partial solution because it degrades dbx options and I cannot use them.

coinserva at 2007-7-8 23:37:44 > top of Java-index,Development Tools,Solaris and Linux Development Tools...