VirtualBox

Changeset 69541 in vbox for trunk/src/VBox


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

testdriver: temporary heap debug code for windows

Location:
trunk/src/VBox/ValidationKit/testdriver
Files:
2 edited

Legend:

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

    r69111 r69541  
    816816        self.fEnableDebugger          = True;
    817817
     818        # TEMPORARY: For process heap checking on windows 2012 boxes.
     819        self.fDoHeapChecks = False;
     820        if 'COMPUTERNAME' in os.environ and utils.getHostOs() == 'windows':
     821            self.fDoHeapChecks = os.environ['COMPUTERNAME'] in [ 'TESTBOXWIN5', 'WEI01-B6KC-4', 'TESTBOXPILE2' ];
     822
    818823        # Quietly detect build and validation kit.
    819824        self._detectBuild(False);
     
    842847        if self.oBuild is not None:
    843848            self.oBuild.dump();
     849
     850
     851    def checkProcessHeap(self):
     852        """
     853        TEMPORARY: Check the process heap on some Windows 2012 server machines to try catch heap corruption issue.
     854        """
     855        if self.fDoHeapChecks:
     856            if sys.platform == 'win32':
     857                from testdriver import winbase;
     858                return winbase.checkProcessHeap();
     859        return True;
     860
    844861
    845862    def _detectBuild(self, fQuiet = False):
     
    14171434        self.oVBox            = None;
    14181435        vboxcon.goHackModuleClass.oVBoxMgr = None; # VBoxConstantWrappingHack.
     1436        self.checkProcessHeap(); ## TEMPORARY
    14191437
    14201438        try:
     
    14391457            reporter.logXcpt();
    14401458        self.fImportedVBoxApi = False;
     1459        self.checkProcessHeap(); ## TEMPORARY
    14411460
    14421461        if self.sHost == 'win':
     
    14601479            except:
    14611480                reporter.logXcpt();
     1481        self.checkProcessHeap(); ## TEMPORARY
    14621482
    14631483        try:
     
    14661486        except:
    14671487            reporter.logXcpt();
     1488        self.checkProcessHeap(); ## TEMPORARY
    14681489        return True;
    14691490
     
    18331854        Only Ctrl-C exception, no return.
    18341855        """
     1856        self.checkProcessHeap(); ## TEMPORARY
    18351857        try:
    18361858            self.oVBoxMgr.waitForEvents(cMsTimeout);
     
    18391861        except:
    18401862            pass;
     1863        self.checkProcessHeap(); ## TEMPORARY
    18411864        return None;
    18421865
     
    21212144        if not self.importVBoxApi():
    21222145            return None;
     2146        self.checkProcessHeap(); ## TEMPORARY
    21232147
    21242148        # create + register the VM
     
    22312255        reporter.log('created "%s" with name "%s"' % (oVM.id, sName));
    22322256        self.aoVMs.append(oVM);
     2257        self.checkProcessHeap(); ## TEMPORARY
    22332258        self.logVmInfo(oVM); # testing...
     2259        self.checkProcessHeap(); ## TEMPORARY
    22342260        return oVM;
    22352261    # pylint: enable=R0913,R0914,R0915
  • 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