VirtualBox

Changeset 55883 in vbox


Ignore:
Timestamp:
May 16, 2015 1:22:15 AM (9 years ago)
Author:
vboxsync
Message:

IMachineDebugger: Added loadPlugIn and unloadPlugIn methods.

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r55854 r55883  
    1716417164  <interface
    1716517165    name="IMachineDebugger" extends="$unknown"
    17166     uuid="5e4534dc-21b8-4f6b-8a08-eef50e1a0aa1"
     17166    uuid="b08d5aa9-4e35-3a17-2e4d-61948b590989"
    1716717167    wsmap="managed"
    1716817168    >
     
    1734517345      <param name="bytes" type="octet" safearray="yes" dir="in">
    1734617346        <desc>The bytes to write.</desc>
     17347      </param>
     17348    </method>
     17349
     17350    <method name="loadPlugIn">
     17351      <desc> Loads a DBGF plug-in. </desc>
     17352      <param name="name" type="wstring" dir="in">
     17353        <desc>The plug-in name or DLL. Special name 'all' loads all installed plug-ins.</desc>
     17354      </param>
     17355      <param name="plugInName" type="wstring" dir="return">
     17356        <desc>The name of the loaded plug-in.</desc>
     17357      </param>
     17358    </method>
     17359
     17360    <method name="unloadPlugIn">
     17361      <desc>Unloads a DBGF plug-in.</desc>
     17362      <param name="name" type="wstring" dir="in">
     17363        <desc>The plug-in name or DLL. Special name 'all' unloads all plug-ins.</desc>
    1734717364      </param>
    1734817365    </method>
  • trunk/src/VBox/Main/include/MachineDebuggerImpl.h

    r51092 r55883  
    11/* $Id$ */
    2 
    32/** @file
    4  *
    53 * VirtualBox COM class implementation
    64 */
    75
    86/*
    9  * Copyright (C) 2006-2012 Oracle Corporation
     7 * Copyright (C) 2006-2015 Oracle Corporation
    108 *
    119 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    105103                               ULONG aSize,
    106104                               const std::vector<BYTE> &aBytes);
     105    HRESULT loadPlugIn(const com::Utf8Str &aName,
     106                       com::Utf8Str &aPlugInName);
     107    HRESULT unloadPlugIn(const com::Utf8Str &aName);
    107108    HRESULT detectOS(com::Utf8Str &aOs);
    108109    HRESULT getRegister(ULONG aCpuId,
  • trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp

    r55702 r55883  
    10691069}
    10701070
    1071 HRESULT MachineDebugger::detectOS(com::Utf8Str &aOs)
    1072 {
    1073     LogFlowThisFunc(("\n"));
    1074 
     1071HRESULT MachineDebugger::loadPlugIn(const com::Utf8Str &aName, com::Utf8Str &aPlugInName)
     1072{
    10751073    /*
    1076      * Do the autocaller and lock bits.
     1074     * Lock the debugger and get the VM pointer
    10771075     */
    10781076    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    10841082         * Do the job and try convert the name.
    10851083         */
    1086 /** @todo automatically load the DBGC plugins or this is a waste of time. */
     1084        if (aName.equals("all"))
     1085        {
     1086            DBGFR3PlugInLoadAll(ptrVM.rawUVM());
     1087            try
     1088            {
     1089                aPlugInName = "all";
     1090                hrc = S_OK;
     1091            }
     1092            catch (std::bad_alloc)
     1093            {
     1094                hrc = E_OUTOFMEMORY;
     1095            }
     1096        }
     1097        else
     1098        {
     1099            RTERRINFOSTATIC ErrInfo;
     1100            char            szName[80];
     1101            int vrc = DBGFR3PlugInLoad(ptrVM.rawUVM(), aName.c_str(), szName, sizeof(szName), RTErrInfoInitStatic(&ErrInfo));
     1102            if (RT_SUCCESS(vrc))
     1103            {
     1104                try
     1105                {
     1106                    aPlugInName = "all";
     1107                    hrc = S_OK;
     1108                }
     1109                catch (std::bad_alloc)
     1110                {
     1111                    hrc = E_OUTOFMEMORY;
     1112                }
     1113            }
     1114            else
     1115                hrc = setErrorVrc(vrc, "%s", ErrInfo.szMsg);
     1116        }
     1117    }
     1118    return hrc;
     1119
     1120}
     1121
     1122HRESULT MachineDebugger::unloadPlugIn(const com::Utf8Str &aName)
     1123{
     1124    /*
     1125     * Lock the debugger and get the VM pointer
     1126     */
     1127    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     1128    Console::SafeVMPtr ptrVM(mParent);
     1129    HRESULT hrc = ptrVM.rc();
     1130    if (SUCCEEDED(hrc))
     1131    {
     1132        /*
     1133         * Do the job and try convert the name.
     1134         */
     1135        if (aName.equals("all"))
     1136        {
     1137            DBGFR3PlugInUnloadAll(ptrVM.rawUVM());
     1138            hrc = S_OK;
     1139        }
     1140        else
     1141        {
     1142            int vrc = DBGFR3PlugInUnload(ptrVM.rawUVM(), aName.c_str());
     1143            if (RT_SUCCESS(vrc))
     1144                hrc = S_OK;
     1145            else if (vrc == VERR_NOT_FOUND)
     1146                hrc = setErrorBoth(E_FAIL, vrc, "Plug-in '%s' was not found", aName.c_str());
     1147            else
     1148                hrc = setErrorVrc(vrc, "Error unloading '%s': %Rrc", aName.c_str(), vrc);
     1149        }
     1150    }
     1151    return hrc;
     1152
     1153}
     1154
     1155HRESULT MachineDebugger::detectOS(com::Utf8Str &aOs)
     1156{
     1157    LogFlowThisFunc(("\n"));
     1158
     1159    /*
     1160     * Lock the debugger and get the VM pointer
     1161     */
     1162    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     1163    Console::SafeVMPtr ptrVM(mParent);
     1164    HRESULT hrc = ptrVM.rc();
     1165    if (SUCCEEDED(hrc))
     1166    {
     1167        /*
     1168         * Do the job.
     1169         */
    10871170        char szName[64];
    10881171        int vrc = DBGFR3OSDetect(ptrVM.rawUVM(), szName, sizeof(szName));
     
    10911174            try
    10921175            {
    1093                 Bstr bstrName(szName);
    1094                 aOs = Utf8Str(bstrName);
     1176                aOs = szName;
    10951177            }
    10961178            catch (std::bad_alloc)
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