908N/AWe have created an mdb module and some simple shell script wrappers
908N/Athat can be used to retrieve various information from a running X server
908N/Aor a X server core dump.
908N/A
908N/ACurrently available information includes:
908N/A
908N/A - a list of the clients connected to an X server, including for each one:
908N/A - the sequence number of the last request it sent
908N/A - in the case of most local clients, their process id
908N/A
908N/A - a list of the input devices connected to an X server and if any
908N/A active grabs are applied to them, which client has done so.
908N/A
908N/A - if a server grab has been done, the id of the client that has the grab.
908N/A
908N/AScripts
908N/A-------
908N/A
908N/AThe simple shell script wrappers are all delivered in /usr/demo/Xserver/mdb
908N/AAll of these scripts can be run on either a running process or a core file.
908N/A
908N/ATo use these scripts on a running Xserver, specify the process id with the
908N/A-p flag, such as "list_Xserver_clients -p 32999". To use on a core file,
908N/Asimply provide the core file as an argument. (The command line arguments
908N/Aare passed through to mdb, see the mdb(1) man page for more details.)
908N/A
908N/ATo use on a running Xorg server, you will need to run as root, due to the
908N/Arestrictions
908N/A
908N/A- list_Xserver_clients
492N/A
492N/AThis can be useful for trying to figure out which client is
492N/Aresponsible for the reads and writes you see to a certain file
492N/Adescriptor in a truss and similar debugging activities. The sequence
492N/Anumber will basically be a count of the number of requests an X client
492N/Ahas sent during its lifetime.
492N/A
492N/AYou will get output like this:
492N/A
492N/Amax_clients = 1024
492N/ACLIENT SEQUENCE # FD PIDS
908N/A 0 0 -1 9719
492N/A 1 8 15 ??? - NULL OsCommPtr->process
908N/A 2 9 16 9721
492N/A 4 8 18 ??? - NULL OsCommPtr->process
492N/A 5 17 ??? - NULL ClientPtr->osPrivate
908N/A 6 14 19 9763
908N/A 7 71 20 9814
908N/A 8 13 21 9819
908N/A 9 17 22 9836
908N/A 10 501747 23 9837
908N/A 11 147 24 9837
908N/A 12 11 25 9837
908N/A 13 9676 26 9843
908N/A 14 38347 27 9843
908N/A 15 11 28 9843
908N/A 16 13251 29 9846 9857 9861 9871
908N/A 18 5299 31 9847 9891 9894 9900 9904 9922
908N/A 19 2397 32 9879
908N/A 21 11 34 9879
908N/A 23 34389507 36 9885
908N/A
492N/A1342 /usr/dt/bin/dtlogin -daemon
908N/A 9719 /usr/X11/bin/Xorg :0 -depth 24 -nobanner -auth /var/dt/A:0-epayvc
492N/A 9721 /usr/openwin/bin/fbconsole -d :0
492N/A 9720 /usr/dt/bin/dtlogin -daemon
492N/A 9741 /bin/ksh /usr/dt/bin/Xsession
908N/A 9819 /usr/dt/bin/sdt_shell -c unsetenv _ PWD; unsetenv DT;
492N/A 9821 -csh -c unsetenv _ PWD; unsetenv DT; setenv DISP
492N/A 9837 /usr/dt/bin/dtsession
492N/A 9843 dtwm
492N/A 9846 /usr/dt/bin/dtterm -session dtb2aitb -C -ls
492N/A 9857 -csh
492N/A 9861 -csh
492N/A 9871 -csh
492N/A 9847 /usr/dt/bin/dtterm -session dtP2aqtb -C -ls
492N/A 9891 -csh
492N/A 9894 -csh
492N/A 9900 -csh
492N/A 9904 -csh
492N/A 9922 -csh
492N/A 9879 dtfile -session dtqRaOFb
492N/A 9949 dtfile -session dtqRaOFb
492N/A 9885 sdtperfmeter -f -H -t cpu -t disk -s 1 -name fpperfmeter
492N/A9836 /usr/dt/bin/ttsession
492N/A
492N/AThe output at the end comes from ptree. From this example we can see
492N/Athe busiest client in this CDE session has been sdtperfmeter since it
492N/Ahas sent 34389507 X requests in order to update the performance meter
492N/Aonce a second. (This session was running for 6 days before this output
492N/Awas taken.)
492N/A
908N/A- list_Xserver_devicegrab_client
908N/A
908N/AThis lists all the input devices known to the Xserver and if they have
908N/Abeen grabbed by any clients, which client holds an active grab.
908N/A
908N/AFor instance, on a machine where the xterm "Secure Keyboard" menu item
908N/Awas chosen to grab the keyboard:
908N/A
908N/A # list_Xserver_devicegrab_client -p 6072
908N/A Device "Virtual core pointer" id 2:
908N/A -- no active grab on device
908N/A
908N/A Device "Virtual core keyboard" id 3:
908N/A -- active grab 5e00000 by client 47
908N/A
908N/A Device "Virtual core XTEST pointer" id 4:
908N/A -- no active grab on device
908N/A
908N/A Device "Virtual core XTEST keyboard" id 5:
908N/A -- no active grab on device
908N/A
908N/A Device "mouse" id 6:
908N/A -- no active grab on device
908N/A
908N/A Device "hotkey" id 7:
908N/A -- no active grab on device
908N/A
908N/A Device "keyboard" id 8:
908N/A -- no active grab on device
908N/A
908N/AYou can then use list_Xserver_clients to find out what client 47 is:
908N/A
908N/A CLIENT SEQUENCE # FD PIDS
908N/A [...]
908N/A 47 3378 78 8936
908N/A [...]
908N/A 8936 xterm
908N/A
908N/A
908N/A- list_Xserver_servergrab_client
908N/A
908N/AThis script checks a variable in the X server to determine if a server
908N/Agrab has been done, and if so which client has done it.
492N/A
492N/ADebugging with mdb
492N/A------------------
492N/A
492N/AThe mdb module can also be used directly in an mdb debugging session
908N/Aon either a live server or a core file. The module is delivered in
908N/A/usr/lib/mdb/proc as Xorg.so, Xvfb.so, Xephyr.so and Xvnc.so so that
908N/Ait should be automatically loaded when mdb attaches to a process or
908N/Acore of any of those programs.
492N/A
908N/ATwo sets of dcmds are provided, each with a "walker" which simply
908N/Aiterates over the entries in the X server internal tables, and a
908N/Acommand that prints the information for each entry.
908N/A
908N/AThe commands currently provided are:
908N/A
908N/A ::client_pids - prints information about a ClientRec entry
908N/A in the X server's array of currently connected X clients.
1265N/A Switches:
1265N/A -w Print arguments with process name when available.
492N/A
908N/A ::inputdev_grabs - prints information about a DeviceIntRec entry
908N/A in the X server's list of currently connected input devices.
908N/A
908N/AThe walkers to iterate over the lists of these structures in the X server are:
492N/A
908N/A ::client_walk - walks the array of ClientRec entries stored in the
908N/A global array "clients", from 0 to the value of the global
908N/A variable "currentMaxClients"
908N/A
908N/A ::inputdev_walk - walks the linked list of DeviceIntRec entries
908N/A starting at the entry stored in the global variable "InputInfo"
908N/A
908N/AYou can run them like this:
908N/A
908N/A# mdb -p 9719
908N/ALoading modules: [ Xorg ld.so.1 libc.so.1 libproc.so.1 libnvpair.so.1 libuutil.so.1 libavl.so.1 libsysevent.so.1 ]
492N/A> ::walk client_walk
492N/Amax_clients = 1024
492N/A1b7db8
492N/A1b7dbc
492N/A1b7dc0
492N/A[...]
492N/A> 1b7dc0 ::client_pids
1265N/ACLIENT SEQUENCE # FD PROCESS
1265N/A 2 20 21 1285 /usr/bin/dbus-launch
492N/A
908N/AIf you run one of the commands (such as ::client_pids) without an address in
908N/Afront, it will automatically call the associated walker to list the
908N/Ainformation for all the entries in the list.
492N/A
1192N/AFor more information about using mdb, see the Solaris Modular Debugger Guide
1265N/Aon http://docs.oracle.com and the mdb OpenSolaris Community website at
908N/Ahttp://hub.opensolaris.org/bin/view/Community+Group+mdb/
492N/A
492N/A=============================================================================
492N/A
1265N/ACopyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
492N/A
492N/APermission is hereby granted, free of charge, to any person obtaining a
919N/Acopy of this software and associated documentation files (the "Software"),
919N/Ato deal in the Software without restriction, including without limitation
919N/Athe rights to use, copy, modify, merge, publish, distribute, sublicense,
919N/Aand/or sell copies of the Software, and to permit persons to whom the
919N/ASoftware is furnished to do so, subject to the following conditions:
492N/A
919N/AThe above copyright notice and this permission notice (including the next
919N/Aparagraph) shall be included in all copies or substantial portions of the
919N/ASoftware.
492N/A
919N/ATHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
919N/AIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
919N/AFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
919N/ATHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
919N/ALIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
919N/AFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
919N/ADEALINGS IN THE SOFTWARE.