X Server Device Developer's Guide
  Cerca solo questo libro
Scarica il manuale in formato PDF

Debug Server Modules

13

A version of the X window server is available for debugging purposes. It is included in the SUNWxwdes (SPARC) and SUNWxwdex (x86) packages. Use the debug server with dbx(1).

  example% cd /opt/SUNWddk/ddk_2.6/xserver/bin/sparc  
  example% dbx Xsun-ddkdebug  

The source code for some of the dynamic libraries is also in the DDK CD-ROM. Use dbx's file and use commands to step through the dynamic code.

  (dbx) stop in miSpritePolyFillRect  
  (dbx) cont  
  stopped in miSpritePolyFillRect at 0xeec15e60  
  miSpritePolyFillRect+0x2c: ld [%fp + 68], %o0  
  warning: can't find source  
  /export/ddk/ea2/bin/Xsun/mit/server/ddx/mi/misprite.c  
  (dbx) use /opt/SUNWddk/ddk_2.6/xserver/server/ddx/mi  
  (dbx) file misprite.c  

Now you can step through the code examining values as necessary.

For x86 systems - This does not work on x86 because the -xs compiler switch is not supported. However, you can still print out the arguments to functions.

As a device driver developer, you are most likely interested in the initialization stage of your driver. However, since the server loads your driver dynamically, its symbols are not available to you at startup time. You can stop the server before device initialization in the AddScreen function. This function contains the address of which it is going to switch to initialize the framebuffer device.

  (dbx) stop in AddScreen  
  (dbx) run  
  AddScreen(pfnInit = &xxxxxxInit () at 0xef7628a4, argc = 1, argv = 0xeffffaac) at 0x51f50  

The pfnInit() function pointer should point to your device driver's initialization function. Now that your dynamic library has been loaded, you can set breakpoints and step through your code in dbx.