[comp.windows.x] "segmentation erroron Sun"

kral@skvax1.csc.ti.COM (10/10/88)

    I have a bug in my X application that seems to appear randomly when I
run my application on a Sun 3/60 and appears not-so-randomly on a Sun 4/110.
The error is a segmentation violation.  When I debug with dbx it says it
blows up in XrmStringToQuark.  The error occurs when creating certain widgets
on the Sun4 and occasionally occurs upon destroying a widget on the Sun3.

Below is a small dbx session involving the error.  Could somebody tell me
what XrmStringToQuark is supposed to do.  If somebody recognizes this error
or thinks they may know what the problem is please let me know.


dbx session:

signal SEGV (segmentation violation) in XrmStringToQuark at 0x39024
XrmStringToQuark+0x24:  ldsb    [%i5], %o0
`Resources`CacheArgs`args->name = 0x1 "<unprintable...>"
(dbx) where
XrmStringToQuark() at 0x39024
CacheArgs(args = 0xfefff2ec, num_args = 13, quark_cache = 0xfeffecb4, num_quar
ks = 100, pQuarks = 0xfeffecb0), line 396 in "Resources.c"
XtGetResources(w = 0x1, args = 0xfefff2b4, num_args = 13), line 426 in "Resour
ces.c"
XtCreateWidget(name = 0x604e7 "pin1", widgetClass = 0x60224, parent = 0x839c8,
 args = 0xfefff2b4, num_args = 13), line 205 in "Create.c"
XtCreateManagedWidget(name = 0x604e7 "pin1", widgetClass = 0x60224, parent = 0
x839c8, args = 0xfefff2b4, num_args = 13), line 235 in "Create.c"
`Spin1`Symcopy(w = 0x7ef78, event = 0xfefff8b8, params = (nil), num_params = 0
x7ebb4), line 486 in "Spin1.c"
_XtTranslateEvent(w = 0x7ef78, closure = 0x7efc4 "", event = 0x1), line 425 in
 "TMstate.c"
DispatchEvent(event = 0x1, widget = 0x7ef78, mask = 4), line 439 in "Event.c"
XtDispatchEvent(event = 0xfefff8b8), line 624 in "Event.c"
XtMainLoop(), line 849 in "Event.c"
main(argc = 1, argv = 0xfefffd04), line 696 in "symbol2.c"


        I hope that I did something obviously stupid so that someone will
recognize it and I can get past this bug in my program.  Send any help or
advice to:
                            Kral Ferch
                            kral@skvax1.ti.com

                                            Thank You.

--------------------
Kral Ferch          Texas Instruments, Inc.
ARPANET:            kral@skvax1.ti.com

swick@ATHENA.MIT.EDU (Ralph R. Swick) (10/11/88)

From your stack trace, it looks to me as though someone has written
on your arglist before the call to XtCreateManagedWidget.  In
particular, the 'name' field of one of your args seems to have been
tromped; it normally contains a pointer to a printable string.  There
is no known Xt bug that causes exactly the symptoms you report.

XrmStringToQuark is documented in section 10.11.2 of the Xlib manual.

dheller@cory.Berkeley.EDU (Dan Heller) (10/12/88)

In article <8810101619.AA19823@ti.com> kral@skvax1.csc.ti.COM writes:
>    I have a bug in my X application that seems to appear randomly when I
>run my application on a Sun 3/60 and appears not-so-randomly on a Sun 4/110.
>The error is a segmentation violation.  When I debug with dbx it says it
>blows up in XrmStringToQuark.  The error occurs when creating certain widgets

If someone where I work didn't just have this exact same problem, I would
have immediately agreed with Ralf Swick's reponse (that you're stepping
on memory somewhere).  Altho you actually could be stepping on memory
as he suggests, in our particular case the problem was due to your
workstation running out of memory.

The Xlib stuff rarely checks for null returns from malloc calls (based
on my experience reading the code).  Our experience with the problem
you described happened on a sun 3/50 -- when trying to run the program
on another machine, it worked fine.  Just the 3/50 had problems. It
turned out to be out of memory.  Ironic how our program died in the
same place.  If that's not the problem -- oh well..
Dan Heller	<island!argv@sun.com>