Wiki Home arrow MediaPortal Wiki

Using memory dumps to find C++ side issues

  • This short guide will help all testers (and devs also) to create memory dumps of MP process when something nasty happens on C++ side and MP decides to bail out without any visible traces. Note that this should be pretty tester & HTPC friendly as it's not requiring Visual Studio to be installed on the PC.

Requirements

  1. Install Debugging Tools for Windows 32-bit Version or Install Debugging Tools for Windows 64-bit Version, depending on which version you are using.

  2. Create a directory called c:\MP_crash_dumps.

  3. Copy attached MS VC debug DLLs to MP root directory

    • <!> is this still needed? can we link to ms anywhere for those files?

  4. Change MP to use MPV/MPA mpeg2 codecs (also ffdshow for h264). Reason for this is that codecs are detecting the debug process presence and are refusing to load.
  5. Use debug version of ?TsReader.ax or any other C++ side component that is suspected to be causing the crash. You can find those debug version in mediaportal svn DirectShowFilters\bin\Debug trunk. At later stages we should have up to date debug binaries for all C++ components (including the symbol files...). <!> remove the last sentence ?

Start debugging

  • You can run the command everytime using the run box and the command prompt or you create batch files to simply rerun the commands when needed.

MediaPortal: Catching the exceptions

  1. Start MP in windowed mode
  2. Goto START -> Run -> type

    cmd /k pushd "%ProgramFiles%\Debugging Tools for Windows\"
    
  3. In command prompt start

    cscript adplus.vbs -crash -pn MediaPortal.exe -quiet -o c:\MP_crash_dumps
    
  4. Make sure that new (timestamped) folder is created under c:\MP_crash_dumps
  5. Switch MP to fullscreen and do something...
  6. Wait for a crash and let the log & memory dump file to be created

MediaPortal: Pin pointing the code that causes a hang...

  1. Start MP in windowed mode (and do not go to full screen!)
  2. Do something and wait for a hang
  3. Goto START -> Run -> type

    cmd /k pushd "%ProgramFiles%\Debugging Tools for Windows\"
    
  4. In command prompt start

    cscript adplus.vbs -hang -pn MediaPortal.exe -quiet -o c:\MP_crash_dumps
    
  5. Check out the memory dump and logs

TVServer: Catch a channel scan crash

  1. Start ?SetupTv.exe

  2. Goto START -> Run -> type

    cmd /k pushd "%ProgramFiles%\Debugging Tools for Windows\"
    
  3. In command prompt start

    cscript adplus.vbs -crash -pn TVService.exe -quiet -o c:\MP_crash_dumps
    
  4. Check out the memory dump and logs

example batch file

  • @echo off
    
    pushd "%ProgramFiles%\Debugging Tools for Windows\"
    
    cscript adplus.vbs -crash -pn TVService.exe -quiet -o E:\TVServer_crash_dumps
    

Troubleshooting

_NT_SYMBOL_PATH environment variable

  • If you get the following warning, you have to set an environment variable.

    WARNING!  An '_NT_SYMBOL_PATH' environment variable is not set.
    
  1. Goto Control Panel -> System.

  2. Switch to tab Advanced and click environment variables.

  3. Add a new variable to system level (2nd group).

    Name for variable: _NT_SYMBOL_PATH
    Value for variable: symsrv*symsrv.dll*f:\localsymbols*http://msdl.microsoft.com/download/symbols
    

event log file

  • If you get one of the following errors you have to delete event log.

    %ProgramFiles%\Debugging Tools for Windows\adplus.vbs(1259, 3) (null): Event log file is out of space.
    %ProgramFiles%\Debugging Tools for Windows\adplus.vbs(1259, 3) (null): Die Ereignisprotokolldatei ist voll.
    
  1. Goto START -> Run -> type eventvwr.exe

  2. Choose Application -> right click -> Properties

  3. Change maximum log size to 102400 KB.

  4. Click button Delete log <!> (or empty log or remove log !?

  5. Click OK, to close the dialog and start at point 2. again with System instead of Application

MediaPortal Wiki: Debugging/MemoryDump (last edited 2008-05-08 00:40:39 by chefkoch)


by team-mediaportal.com - 2008 SourceForge.net Logo