Impossible to run MediaPortal under debugger? (1 Viewer)

mrstef

Portal Pro
March 15, 2007
58
8
Home Country
Sweden Sweden
TV-Server Version: Latest SVN
MediaPortal Version: Latest SVN
MediaPortal Skin: BlueTwo Wide
Windows Version: XP SP2
CPU Type: Intel DualCore 7300
HDD:
Memory: 2 GB
Motherboard: HP
Motherboard Chipset: HP
Motherboard Bios:
Video Card: 8600M GS
Video Card Driver: Latest 157X by Nvidia
Sound Card:
Sound Card AC3:
Sound Card Driver:
1. TV Card: FireDTV
1. TV Card Type: DVB-T
1. TV Card Driver: Latest
2. TV Card:
2. TV Card Type:
2. TV Card Driver:
3. TV Card:
3. TV Card Type:
3. TV Card Driver:
4. TV Card:
4. TV Card Type:
4. TV Card Driver:
MPEG2 Video Codec: Nvidia PureVIdeo
MPEG2 Audio Codec: AC3Filter
Satelite/CableTV Provider:
HTPC Case:
Cooling:
Power Supply:
Remote:
TV: Samsung LCD
TV - HTPC Connection: HDMI

Hi!

I would like to create a monitoring application that launches MediaPortal and monitors it for exceptions and terminations and restarts it. It will also close MediaPortal if the power button on the remote is pressed and then go to sleep mode (since this is not possible to do when TV is active in MediaPortal. You have to turn off TV before you can go to standby).

The strategy I was planning on was to have my app launch mediaportal using either of the following ways:

Launch Mediaportal using CreateProcess with option DEBUG_PROCESS.
Launch Mediaportal using CreateProcess with no options and then attach to it with function DebugActiveProcess.

When just using CreateProcess with no options, MediaPortal starts perfectly fine!
When trying option one (DEBUG_PROCESS), a process called MediaPortal is started, but no window appears. After doing some research it seems as this is quite common when it comes to .NET apps. The solution is to use DebugActiveProcess instead

When trying this approach, Mediaportal is launched just fine using createprocess, but as soon as I do the DebugActiveProcess, Mediaportal crashes. My monitoring app catches first a wild, undocumented exception type, and then a DEBUG_EXIT_PROCESS event.

Do you have any code in Mediaportal that is "debugger aware" and wont run under a debugger? Or do you have any clue on why this does not work? If I use my monitor app to launch any other "standard" windows app, it works perfectly!

I have seen that sometimes the TestTool pops up after a crash. How is this done? What mechanism is used to call TestTool in case of a crash?

Best Regards
 

tourettes

Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    MP itself shouldn't have anything that will cause attaching the debugger to fail. For example following works perfectly: http://www.msfn.org/board/Creating-memory-dumps-t90244.html

    Some comercial (almost all) are detecting the debuggers precence and are behaving in different ways (for example nvidia's codecs will do uninstall as oon as they see the debugger attached to the process.). But that should be the cause only if the video playback is running when attaching the debugger.
     

    mrstef

    Portal Pro
    March 15, 2007
    58
    8
    Home Country
    Sweden Sweden
    Hm, I do run Nvidias MPEG2 decoders, but as you say, these shouldn't be activated until I start playing some video/TV. But MP crashes imediately even when idle at "home" screen. I wonder what could be loaded at that point that prevents the debug,...

    Well, I guess this is not really a way forward anyhow since I don't think people want to give up their commercial MPEG/h264 codecs,...

    I'll have to find some other way of detecting a crash. I cannot check wether MP is actually running or not, because most of the time if you do get a crash, the MP process is still there. Sometimes it freezes, but it seldom exits,...

    I still wonder how you test tool detects a crash though! I found a few other interesting API:s when searching for a solution, but it seems as this only works inside a process. You cannot use it to detect exceptions in other processes. But it might be something you could use internally in MP to detect exceptions and handle them (log the error to find root cause and then see if it might be possible to recover, and if it is not, terminate MP to allow a quick restart) instead of forwarding the exception to Windows exception handler?

    http://msdn2.microsoft.com/en-us/library/ms680634(VS.85).aspx
     

    Users who are viewing this thread

    Top Bottom