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/ACurrently available information includes:
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 - 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 - if a server grab has been done, the id of the client that has the grab.
908N/AAll of these scripts can be run on either a running process or a core file.
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/ATo use on a running Xorg server, you will need to run as root, due to the
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/AYou will get output like this:
492N/ACLIENT SEQUENCE # FD PIDS
492N/A 1 8 15 ??? - NULL OsCommPtr->process
492N/A 4 8 18 ??? - NULL OsCommPtr->process
492N/A 5 17 ??? - NULL ClientPtr->osPrivate
908N/A 16 13251 29 9846 9857 9861 9871
908N/A 18 5299 31 9847 9891 9894 9900 9904 9922
492N/A 9821 -csh -c unsetenv _ PWD; unsetenv DT; setenv DISP
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/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
908N/A- list_Xserver_devicegrab_client
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/AFor instance, on a machine where the xterm "Secure Keyboard" menu item
908N/Awas chosen to grab the keyboard:
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 Device "Virtual core keyboard" id 3:
908N/A -- active grab 5e00000 by client 47
908N/A Device "Virtual core XTEST pointer" id 4:
908N/A -- no active grab on device
908N/A Device "Virtual core XTEST keyboard" id 5:
908N/A -- no active grab on device
908N/A -- no active grab on device
908N/A -- no active grab on device
908N/A Device "keyboard" id 8:
908N/A -- no active grab on device
908N/AYou can then use list_Xserver_clients to find out what client 47 is:
908N/A CLIENT SEQUENCE # FD PIDS
908N/A- list_Xserver_servergrab_client
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/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/Ait should be automatically loaded when mdb attaches to a process or
908N/Acore of any of those programs.
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/AThe commands currently provided are:
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 -w Print arguments with process name when available.
908N/A ::inputdev_grabs - prints information about a DeviceIntRec entry
908N/A in the X server's list of currently connected input devices.
908N/AThe walkers to iterate over the lists of these structures in the X server are:
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 ::inputdev_walk - walks the linked list of DeviceIntRec entries
908N/A starting at the entry stored in the global variable "InputInfo"
908N/AYou can run them like this:
1265N/ACLIENT SEQUENCE # FD PROCESS
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.
1192N/AFor more information about using mdb, see the Solaris Modular Debugger Guide
492N/A=============================================================================
1265N/ACopyright (c) 2010, 2012, Oracle
and/or its affiliates. All rights reserved.
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:
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/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.