mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-01-17 16:20:31 +01:00
fixes to debugging code: added "break on fb_null_pointer() hook", and make it so that
defining FB_DEBUG doesn't make Xquartz always crash (not that it currently helps with any of our fb problems, but hey...)
This commit is contained in:
parent
dec2633c41
commit
e1a67b4872
2 changed files with 15 additions and 2 deletions
5
fb/fb.h
5
fb/fb.h
|
|
@ -133,10 +133,11 @@ typedef CARD32 FbStip;
|
|||
|
||||
typedef int FbStride;
|
||||
|
||||
int fb_null_pointer(char *file, unsigned int line);
|
||||
|
||||
#define CHECK_NULL(ptr) \
|
||||
if ((ptr) == NULL) {\
|
||||
ErrorF("%s:%d: null pointer\n", __FILE__, __LINE__); \
|
||||
return; \
|
||||
if (fb_null_pointer(__FILE__, __LINE__)) return; \
|
||||
}
|
||||
|
||||
#ifdef FB_DEBUG
|
||||
|
|
|
|||
|
|
@ -318,6 +318,15 @@ fbPixmapToRegion(PixmapPtr pPix)
|
|||
return(pReg);
|
||||
}
|
||||
|
||||
int fb_null_pointer(char *file, unsigned int line) {
|
||||
ErrorF("%s:%u: null pointer (break on fb_null_pointer to debug)\n", file, line);
|
||||
#ifdef FB_DEBUG
|
||||
return 0; // ignore error, die horrible death
|
||||
#else
|
||||
return 1; // harmlessly return to caller, hope we don't crash later
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef FB_DEBUG
|
||||
|
||||
#ifndef WIN32
|
||||
|
|
@ -357,6 +366,9 @@ fbValidateDrawable (DrawablePtr pDrawable)
|
|||
if (pDrawable->type != DRAWABLE_PIXMAP)
|
||||
pDrawable = (DrawablePtr) fbGetWindowPixmap(pDrawable);
|
||||
fbGetStipDrawable(pDrawable, bits, stride, bpp, xoff, yoff);
|
||||
#ifdef __APPLE__
|
||||
if (bits >= 0xb0000000) return; // don't validate CG memory
|
||||
#endif
|
||||
first = bits - stride;
|
||||
last = bits + stride * pDrawable->height;
|
||||
if (!fbValidateBits (first, stride, FB_HEAD_BITS) ||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue