Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!spool.mu.edu!caen!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ucbvax!bloom-beacon!dont-send-mail-to-path-lines From: hill@luke.lanl.GOV (Jeff Hill) Newsgroups: comp.windows.x Subject: Re: Is there some way to find out what a BadMatch is about? Message-ID: <9106241731.AA20764@luke.lanl.gov> Date: 24 Jun 91 17:31:06 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 53 >> I've got this program which works fine on monochrome screens, but >> when I try running it on a PseudoColor screen I get BadMatch errors >> from innocuous calls like XDrawPoint and XFillRectangle. So I was >> just wondering if anyone has any tricks for finding out what the >> server thinks doesn't match. I suppose I could run the server in a >> debugger, but that's a hassle. > >Run it under xscope, that's what I find is generally best. That way >you can see precisely what requests are being sent.... Another (perhaps easier) way to track down what call caused the bad match is to use XSynchronize(). Many X applications and most Xt applications have this as a command line option. This works even better if you have installed your own X exception handler which dumps core. You can then investigate the cause from a debugger (the default X exception handler calls exit() leaving no trace of what happened). Jeff PS: An example code follows: #include main() { /* * install an error handler that makes a core file when * an X Error occurs. This can be usefull if XSync is on. * */ XSetErrorHandler(opi_x_error_handler); } /* * * X Error Handler * (with core dump) * */ int x_error_handler(d, pev) Display *d; XErrorEvent *pev; { char message[256]; XGetErrorText(d, pev->error_code, message, sizeof(message)); printf("Sorry a fatal X Window System error has occured\n"); printf("\tThe cause: %s\n", message); printf("\tResource Id. %x\n", pev->resourceid); printf("Core Dumped\n"); abort(); }