[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | DECWINDOWS 26-JAN-89 to 29-NOV-90 |
Notice: | See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit |
Moderator: | STAR::VATNE |
|
Created: | Mon Oct 30 1989 |
Last Modified: | Mon Dec 31 1990 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 3726 |
Total number of notes: | 19516 |
3626.0. "core dump associate with up/down stepping arrows" by MARX::CHOY () Fri Nov 09 1990 18:10
My program gets core dump when it displays messages to a DECwindow, and
at the same time I keep clicking on the up/down stepping arrow of the vertical
scroll bar.
The program is a background process, it listens to incoming messages through
a well known UDP port. When a message is received, The program writes it to a
database table, and then displays it to a small simple-text widget. The
widget is contained in an attached-dialog-box which has a horizontal and a
vertical scroll bars. There is no call back routine to handle the scroll
bar events.
If there are messages coming, and I keep clicking on the up or down
stepping arrow, the program always core dump at DwtTextSetTopPosition of
the nmsx_display routine. nmsx_display is used to display message to a
simple-text widget.
dbx Debugging information, nmsx_display routine, and part of the uil are
listed below for your reference.
Would appreciate any information.
Debugging information for my program :-
Child died at pc 0x47d830 of signal : Bus error
[using memory image in core]
(dbx) > 0 XtRemoveTimeOut(0x7fffb534, 0x7fffb340, 0x100747ec, 0x10021e20,
0x4c4950) ["NextEvent.c":393, 0x47d82c]
1 Scroll.ScrollCallback(0xd, 0x18f, 0x0, 0x0, 0x0) ["Scroll.c":1036,
0x4c1d30]
2 Scroll.SetValues(0x7fffb340, 0x7fffb340, 0x100747ec, 0x10021e20, 0x4)
["Scroll.c":2584, 0x4c494c]
3 CallSetValues(0x7fffb534, 0x7fffb340, 0x100747ec, 0x10021e20, 0x4)
["Resources.c":860, 0x481530]
4 XtSetValues(0x10021e20, 0x4, 0x1a, 0x1, 0x1) ["Resources.c":978, 0x481948]
5 TextOutput.CheckForNewSize(0x7fffffff, 0x0, 0x48118c, 0x15, 0x482164)
["TextOutput.c":463, 0x4e58e0]
6 TextOutput.MeasureLine(0x1005dc1c, 0x1f9, 0x1007af54, 0x1007af50,
0x4813c0) ["TextOutput.c":530, 0x4e5c2c]
7 RefigureLines(0x484554, 0x7fffb900, 0x2, 0x2, 0xa) ["Text.c":720,
0x486ba8]
8 Text.Redisplay(0x405208, 0x1005e7d8, 0x20e, 0x10051ec0, 0x4052e4)
["Text.c":844, 0x4871b8]
9 DwtTextSetTopPosition(0x7fffb900, 0x1f8, 0x1003b1f0, 0xffffffff, 0x1a)
["Text.c":1408, 0x488a28]
10 nmsx_display.nmsx_display(0x7fffba10, 0xffffffff, 0x1, 0x7fffbad4, 0x0)
["nmsx_display.c":153, 0x4052e0]
11 display_alm_msg(display_type = 1, widget = 2, alm_timestamp = 0x10080dc8
= " 9-Nov-1990 16:45:46", alm_object = 0x7fffbad4 = "choy", alm_type =
0x7fffbb1c = "send_alm_msg6", alm_msg = 0x7fffbb3d = "test alarm message
5.") ["almd_window.c":893, 0x4030d8]
12 get_msg() ["almd_main.c":306, 0x400690]
13 IeCallProc(0x0, 0x0, 0x600016, 0x1005dc1c, 0x10061cf4)
["NextEvent.c":327, 0x47d640]
14 DoOtherSources(0x0, 0x4, 0x100747ec, 0x1005dc1c, 0x47f120)
["NextEvent.c":667, 0x47de60]
15 XtAppNextEvent(0x7fffbc98, 0x10005750, 0x47f15c, 0x4, 0x60e)
["NextEvent.c":780, 0x47e10c]
16 XtAppMainLoop(0x1, 0x1000, 0x0, 0x1, 0x400524) ["Event.c":1105, 0x47c78c]
17 XtMainLoop(0x1, 0x400544, 0x0, 0x0, 0x0) ["Event.c":1096, 0x47c760]
18 almd_main.main(argc = 1, argv = 0x7fffbd5c) ["almd_main.c":210, 0x400520]
nmsx_display routine :-
/**************************************************************************
* routine: nmsx_display()
*
* description:
* this routine displays to the simple text widget passed to the routine.
* This routine handles scrolling a little differently than is usual
* for the simple-text widget
*
* arguments:
* widget - display text on this widget
* str - string to be displayed
* log_fd - file descriptor to write the message to if
* logging is enabled. log_fd = NMSX_NOLOG --> no logging.
* nlflag - Should a newline be placed after the string befor
* displaying?
* 1 = TRUE -> add a newline to the string argument
* 0 = FALSE -> do NOT add a newline to the string argument
**************************************************************************/
#include <X11/DECwDwtApplProg.h> /* DECwindows toolkit */
#include <nms.h>
#define MAX_WIDGETS 100
extern Widget widgets[MAX_WIDGETS];
extern DRMHierarchy s_DRMHierarchy;
extern Widget toplevel_widget;
nmsx_display(widget, str, log_fd, nlflag)
Widget widget;
char *str;
int log_fd;
int nlflag;
{
Arg wargs[30];
int argi;
static char newtext[LEN_DISPLAY_STRING];
char *current_contents;
int textlen, nlines;
long int toppos, current_toppos;
Dimension rows;
/*
* We need to do an append, so get a pointer to the current
* contents of the text widget.
*/
current_contents = DwtSTextGetString(widget);
textlen = strlen(current_contents);
XtFree(current_contents);
/*
* If there is already text in the widget, add a newline to
* the text we are going to insert.
*/
if (textlen > 0 && nlflag) {
strcpy (newtext, "\n");
strcat (newtext, str);
} else {
strcpy (newtext, str);
}
/*
* Insert the new text, specifying the insertion position as
* the last existing character.
*/
DwtSTextReplace (widget, textlen, textlen, newtext);
/*
* The simple text doesn't usually scroll unless the user manipulates
* the scroll bar. Hence once the window is full, you don't see
* new lines that are appended to the end of the text. We jump through
* some hoops here in order to determine which character position of
* the text should be the one displayed as the first in the window. The
* idea is to choose that byte such that the last line is visible at the
* bottom of the window.
*/
/*
* Get some of the current window characteristics. We need to know
* the number of lines (rows) that can be displayed and the current
* offset of the first displayed character. The number of rows can be
* set in the UIL file, and can be changed by resizing, so we don't
* want to hardcode it here.
*/
argi = 0;
XtSetArg (wargs[argi], DwtNrows, &rows);argi++;
XtSetArg (wargs[argi], DwtNtopPosition, ¤t_toppos);argi++;
XtGetValues (widget, wargs, argi);
/*
* There is a limit (set in the UIL file as max_length) to the amount
* of text the window will hold (how far you can scroll back). After
* that limit is reached, appending new text causes some to be
* deleted from the top of the text. So we can't assume that the text
* in the window is its previous contents plus what we inserted
* above. So get a pointer to the current text in the window.
*/
current_contents = DwtSTextGetString (widget);
toppos = strlen (current_contents);
/*
* Starting from the end of the text, count newline characters
* until we have enough to fill the window. Then so a little
* adjusting we we point at the right character to be at the
* top of the window.
*/
nlines = 0;
while (toppos >= 0 && nlines < rows) {
if (current_contents[toppos--] == '\n') nlines++;
}
XtFree (current_contents);
if (toppos >= 0) {
toppos += 2;
} else {
toppos = 0;
}
/*
* If the character we want at the top of the window is different
* from what it is now, change it. When this program was written
* trying to do this by setting DwtNtopPosition with XtSetValues
* caused the text widget to shiver like a bowl of jelly. The
* procedure call used below works, though.
*/
if (current_toppos != toppos) {
DwtTextSetTopPosition (widget, toppos);
}
/* If the logging file descriptor is valid, i.e. >= 0, then
* write the message to the output file as well as to the
* specified widget.
*/
if (log_fd >= 0)
write(log_fd, newtext, strlen(newtext));
}
The simple-text widget is defined as follow :-
! define main window
object
S_MAIN_WINDOW: main_window {
arguments {
};
controls {
menu_bar s_menu_bar;
attached_dialog_box dialog;
};
};
! define the main control box widget
object
dialog: attached_dialog_box {
arguments {
units = DwtPixelUnits;
};
controls {
simple_text main_display_box;
};
callbacks {
create = procedure widget_created_proc(control_box_widget);
};
};
! define the main window text display area.
object
main_display_box : simple_text {
arguments {
adb_top_attachment = DwtAttachAdb;
adb_left_attachment = DwtAttachAdb;
adb_right_attachment = DwtAttachAdb;
adb_bottom_attachment = DwtAttachAdb;
auto_show_insertion_point = true;
editable = false;
insertion_point_visible = false;
max_length = 8192;
scroll_horizontal = true;
scroll_vertical = true;
font_argument = k_default_font;
};
callbacks {
create = procedure widget_created_proc(main_display_widget);
};
};
T.R | Title | User | Personal Name | Date | Lines
|
---|