xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Changes between Version 29 and Version 30 of Debugging


Ignore:
Timestamp:
12/11/13 10:44:20 (7 years ago)
Author:
Antoine Martin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Debugging

    v29 v30  
     1{{{#!div class="box"
    12= Debugging =
    23
     
    78* [/wiki/WindowRefresh Window Refresh]
    89
     10* [/wiki/Debugging/VisualStudio Debugging using Visual Studio]
     11* [/wiki/Debugging/OpenGL OpenGL Debugging]
     12
     13[[BR]]
     14
    915== First Things ==
    1016Always try to narrow it down as much as possible, by turning off as many features as possible (clipboard, etc) and trying various encodings.
     
    1319If a debug build is available, please use it. It may provide more useful diagnostic messages.
    1420You can generate debug builds by calling {{{setup.py}}} with the {{{--with-debug}}} flag (or by setting {{{DEBUG=1}}} in the MS Windows [/browser/xpra/trunk/src/win32/MAKE-INSTALLER.BAT BAT file])
    15 
    16 [[BR]]
    17 
    18 ----
     21}}}
    1922
    2023
     24{{{#!div class="box"
    2125== Via Logging ==
    2226Sometimes the problem is so obvious that you will simply get the error directly from the command line or in the server log file.
     
    4044* {{{XPRA_X11_LOG}}} (enables logging for X11 events)
    4145* {{{XPRA_X11_DEBUG}}} (logs all X11 events through going through our loop - this is very verbose)
     46}}}
    4247
    4348
     49{{{#!div class="box"
    4450== Other Environment Variables ==
    4551There are other environment variables which can be used to tune the behaviour of the system and may be used for debugging or testing, you can obtain the full list with:
    4652{{{
    4753grep 'os.environ' src/xpra
    48 grep 'os.environ' src/wimpiggy
    4954}}}
    5055Notably:
     
    5863* use PIL for parsing png and jpeg packets (on/off): {{{XPRA_USE_PIL}}}
    5964Please refer to the actual code for details.
    60 
    61 [[BR]]
     65}}}
    6266
    6367
    64 ----
    65 
    66 
     68{{{#!div class="box"
    6769== Network Traffic ==
    6870
     
    7375The packet type is the first thing in each packet and it is a simple string which makes it easy to observe traffic.
    7476With version 0.9 onwards, it is best to set {{{XPRA_USE_ALIASES=0}}} to ensure that the packets will use plain-text headers rather than numeric aliases.
    75 
    76 [[BR]]
     77}}}
    7778
    7879
     80{{{#!div class="box"
    7981== xtrace ==
    8082(X11 traffic)
     
    101103xtrace xpra attach ..
    102104}}}
     105}}}
    103106
    104107
    105 ----
    106 
    107 
     108{{{#!div class="box"
    108109== GDB ==
    109110When dealing with crashes ("core dumped"), the best way to debug is to fire gdb.
     
    119120Then once you get a crash, gdb should show you its prompt again and you can extract the python stacktrace with {{{py-bt}}} and the full stacktrace with {{{bt}}}. Having both is useful.
    120121Note: installing the required "debug" symbol packages for your distribution is out of scope, please refer to your vendor's package manager for details (ie: [http://wiki.debian.org/HowToGetABacktrace debian] and [http://yum.baseurl.org/wiki/YumUtils/DebugInfoInstall yum debuginfo-install]).
     122}}}
    121123
     124
     125{{{#!div class="box"
    122126=== X11 errors ===
    123127Occasionally you may encounter an X11 crash ({{{BadDrawable}}}, {{{BadWindow}}}, etc). These are more tricky. You may need to set a breakpoint:
     
    137141In this case, we may want to force all X11 calls to be synchronized (which will hurt performance and may even hide the bugs - beware of heisenbugs!), trace all X11 calls, etc.
    138142[/attachment/wiki/Debugging/error.py this modified error.py] allows you to do just that (see the constants at the top).
     143}}}
    139144
    140145
    141 ----
     146{{{#!div class="box"
     147== Venerable Print Statements ==
     148When all else fails, or just when appropriate, sprinkling some {{{print}}} statements around the critical sections of code is often the best way to get a clearer picture of what is really going on..
     149}}}
    142150
    143151
    144 == Venerable Print Statements ==
    145 When all else fails, or just when appropriate, sprinkling some {{{print}}} statements around the critical sections of code is often the best way to get a clearer picture of what is really going on..
    146 
    147 
    148 ----
    149 
    150 
     152{{{#!div class="box"
    151153== Memory Leaks ==
    152154
     
    162164* [http://stackoverflow.com/a/1641280/428751 simple leak code]
    163165* [http://code.activestate.com/recipes/65333/ Debug with garbage collection recipe]
    164 
    165 
    166 ----
    167 
    168 
    169 == Debugging in Windows ==
    170 
    171 === Using Microsoft Visual Studio Express ===
    172 
    173 You will need to create a new, empty project (File->New->Project), select "General" and "Empty Project". Visual Studio will require a name for the project and will ask for a place to save it.
    174 This project will contain nothing but basic information to start Xpra with the debugger, so save it somewhere for later use.
    175 
    176 You will be placed in the tree, containing the "Solution" and the project you've created. Right click on the project in the tree and select "properties".
    177 
    178 Go to "Debugging", in fill in the fields to attach your Xpra client - example below.
    179 
    180 [[Image(screenshot_1363196248.jpg​)]]
    181 
    182 Then you can do F5 to start the application with the debugger.
    183 
    184 Alternatively, if you set "Attach" to yes, the debugger will ask you to what running process you want to attach upon pressing F5.
    185 
    186 ---
    187 
    188 == OpenGL ==
    189 
    190 Whenever you encounter problems with client-side OpenGL rendering, for example with OpenGL error messages, crashes, or visual artifacts, there are some specific steps to take to investigate. The *Apitrace* tool will get a dump of the OpenGL command stream, allowing it to be sent to the developers for replaying and investigation.
    191 
    192 === Installation of Apitrace ===
    193 
    194 ==== On Linux ====
    195 
    196 Download [https://github.com/apitrace/apitrace Apitrace], build it according to the documentation: [https://github.com/apitrace/apitrace/blob/master/INSTALL.markdown]
    197 
    198 ==== On Windows ====
    199 
    200 You can use pre-built binaries found at [http://people.freedesktop.org/~jrfonseca/apitrace/]
    201 Try to always use the latest version and fallback to an older one if it doesn't work.
    202 
    203 === Trace generation ===
    204 
    205 This trace will enable you to replay the actions of the client without having to re-run it; giving you additional error tracing, ability to send the trace to another person, and ability to replay the exact same steps every time.
    206 
    207 Use as follows:
    208 {{{
    209 $ apitrace trace xpra attach <your regular commandline>
    210166}}}
    211 - Do whatever is needed to reproduce the issue you are experiencing. Beware: Apitrace is keeping a copy of everything you do in RAM, it's going to be huge, so don't run the session for too long, and focus on reproducing one issue at a time.
    212 - Exit Xpra when done
    213 {{{
    214 $ qapitrace
    215 }}}
    216 File -> load the trace
    217 Then go to Trace -> Replay and check both boxes
    218 
    219 Apitrace will replay your trace and report in the bottom panel any errors it found, with additional explanation as compared to what the GL driver typically gives.
    220 
    221 Be ready to send the .trace file to the developers for further investigation.