VirtualBox

Changeset 92883 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 13, 2021 1:35:00 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
148834
Message:

ValKit/vboxinstaller.py: Try correlate debuggers to vbox processes and kill the debuggers debugging vbox. (testboxharp6 has collected quite a bit of gdb --batch processes attached to VBoxHeadless zombies)

File:
1 edited

Legend:

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

    r92330 r92883  
    301301        Kills all virtual box related processes we find in the system.
    302302        """
     303        sHostOs = utils.getHostOs();
     304        asDebuggers = [ 'cdb', 'windbg', ] if sHostOs == 'windows' else [ 'gdb', 'gdb-i386-apple-darwin', 'lldb' ];
    303305
    304306        for iIteration in range(22):
    305307            # Gather processes to kill.
    306             aoTodo = [];
     308            aoTodo      = [];
     309            aoDebuggers = [];
    307310            for oProcess in utils.processListAll():
    308311                sBase = oProcess.getBaseImageNameNoExeSuff();
     
    316319                if sBase.startswith('virtualbox-') and sBase.endswith('-multiarch.exe'):
    317320                    aoTodo.append(oProcess);
    318                 if iIteration in [0, 21]  and  sBase in [ 'windbg', 'gdb', 'gdb-i386-apple-darwin', ]:
    319                     reporter.log('Warning: debugger running: %s (%s)' % (oProcess.iPid, sBase,));
     321                if sBase in asDebuggers:
     322                    aoDebuggers.append(oProcess);
     323                    if iIteration in [0, 21]:
     324                        reporter.log('Warning: debugger running: %s (%s %s)' % (oProcess.iPid, sBase, oProcess.asArgs));
    320325            if not aoTodo:
    321326                return True;
     327
     328            # Are any of the debugger processes hooked up to a VBox process?
     329            if sHostOs == 'windows':
     330                # On demand debugging windows: windbg -p <decimal-pid> -e <decimal-event> -g
     331                for oDebugger in aoDebuggers:
     332                    for oProcess in aoTodo:
     333                        # The whole command line is asArgs[0] here. Fix if that changes.
     334                        if oDebugger.asArgs and oDebugger.asArgs[0].find('-p %s ' % (oProcess.iPid,)) >= 0:
     335                            aoTodo.append(oDebugger);
     336                            break;
     337            else:
     338                for oDebugger in aoDebuggers:
     339                    for oProcess in aoTodo:
     340                        # Simplistic approach: Just check for argument equaling our pid.
     341                        if oDebugger.asArgs and ('%s' % oProcess.iPid) in oDebugger.asArgs:
     342                            aoTodo.append(oDebugger);
     343                            break;
    322344
    323345            # Kill.
Note: See TracChangeset for help on using the changeset viewer.

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