VirtualBox

Ignore:
Timestamp:
Nov 1, 2017 1:20:00 PM (7 years ago)
Author:
vboxsync
Message:

testdriver: temporary heap debug code for windows

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testdriver/winbase.py

    r69111 r69541  
    272272    return True;
    273273
     274def checkProcessHeap():
     275    """
     276    Calls HeapValidate(GetProcessHeap(), 0, NULL);
     277    """
     278
     279    # Get the process heap.
     280    try:
     281        hHeap = ctypes.windll.kernel32.GetProcessHeap();
     282    except:
     283        reporter.logXcpt();
     284        return False;
     285
     286    # Check it.
     287    try:
     288        fIsOkay = ctypes.windll.kernel32.HeapValidate(hHeap, 0, None);
     289    except:
     290        reporter.logXcpt();
     291        return False;
     292
     293    if fIsOkay == 0:
     294        reporter.log('HeapValidate failed!');
     295
     296        # Try trigger a dump using c:\utils\procdump64.exe.
     297        from common import utils;
     298
     299        iPid = os.getpid();
     300        asArgs = [ 'e:\\utils\\procdump64.exe', '-ma', '%s' % (iPid,), 'c:\\CrashDumps\\python.exe-%u-heap.dmp' % (iPid,)];
     301        if utils.getHostArch() != 'amd64':
     302            asArgs[0] = 'c:\\utils\\procdump.exe'
     303        reporter.log('Trying to dump this process using: %s' % (asArgs,));
     304        utils.processCall(asArgs);
     305
     306        # Generate a crash exception.
     307        ctypes.windll.msvcrt.strcpy(None, None, 1024);
     308
     309    return True;
     310
     311
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette