Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp	(revision 39476)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp	(revision 39477)
@@ -142,14 +142,14 @@
         "         incompatible ways without warning.\n",
 
+        (u64Cmd & USAGE_LOADMAP)
+        ? "  loadmap <vmname>|<uuid> <symfile> <address> [module] [subtrahend] [segment]\n"
+          "      This will instruct DBGF to load the given map file\n"
+          "      during initialization.  (See also loadmap in the debugger.)\n"
+          "\n"
+        : "",
         (u64Cmd & USAGE_LOADSYMS)
         ? "  loadsyms <vmname>|<uuid> <symfile> [delta] [module] [module address]\n"
-          "      This will instruct DBGF to load the given symbolfile\n"
+          "      This will instruct DBGF to load the given symbol file\n"
           "      during initialization.\n"
-          "\n"
-        : "",
-        (u64Cmd & USAGE_UNLOADSYMS)
-        ? "  unloadsyms <vmname>|<uuid> <symfile>\n"
-          "      Removes <symfile> from the list of symbol files that\n"
-          "      should be loaded during DBF initialization.\n"
           "\n"
         : "",
@@ -511,4 +511,79 @@
 
 
+/**
+ * Identical to the 'loadmap' command.
+ */
+static int CmdLoadMap(int argc, char **argv, ComPtr<IVirtualBox> aVirtualBox, ComPtr<ISession> aSession)
+{
+    HRESULT rc;
+
+    /*
+     * Get the VM
+     */
+    ComPtr<IMachine> machine;
+    CHECK_ERROR_RET(aVirtualBox, FindMachine(Bstr(argv[0]).raw(),
+                                             machine.asOutParam()), 1);
+
+    /*
+     * Parse the command.
+     */
+    const char *pszFilename;
+    uint64_t    ModuleAddress = UINT64_MAX;
+    const char *pszModule = NULL;
+    uint64_t    offSubtrahend = 0;
+    uint32_t    iSeg = UINT32_MAX;
+
+    /* filename */
+    if (argc < 2)
+        return errorArgument("Missing the filename argument!\n");
+    pszFilename = argv[1];
+
+    /* address */
+    if (argc < 3)
+        return errorArgument("Missing the module address argument!\n");
+    int irc = RTStrToUInt64Ex(argv[2], NULL, 0, &ModuleAddress);
+    if (RT_FAILURE(irc))
+        return errorArgument(argv[0], "Failed to read module address '%s', rc=%Rrc\n", argv[2], rc);
+
+    /* name (optional) */
+    if (argc > 3)
+        pszModule = argv[3];
+
+    /* subtrahend (optional) */
+    if (argc > 4)
+    {
+        irc = RTStrToUInt64Ex(argv[4], NULL, 0, &offSubtrahend);
+        if (RT_FAILURE(irc))
+            return errorArgument(argv[0], "Failed to read subtrahend '%s', rc=%Rrc\n", argv[4], rc);
+    }
+
+    /* segment (optional) */
+    if (argc > 5)
+    {
+        irc = RTStrToUInt32Ex(argv[5], NULL, 0, &iSeg);
+        if (RT_FAILURE(irc))
+            return errorArgument(argv[0], "Failed to read segment number '%s', rc=%Rrc\n", argv[5], rc);
+    }
+
+    /*
+     * Add extra data.
+     */
+    Utf8Str KeyStr;
+    HRESULT hrc = NewUniqueKey(machine, "VBoxInternal/DBGF/loadmap", KeyStr);
+    if (SUCCEEDED(hrc))
+        hrc = SetString(machine, "VBoxInternal/DBGF/loadmap", KeyStr.c_str(), "Filename", pszFilename);
+    if (SUCCEEDED(hrc))
+        hrc = SetUInt64(machine, "VBoxInternal/DBGF/loadmap", KeyStr.c_str(), "Address", ModuleAddress);
+    if (SUCCEEDED(hrc) && pszModule != NULL)
+        hrc = SetString(machine, "VBoxInternal/DBGF/loadmap", KeyStr.c_str(), "Name", pszModule);
+    if (SUCCEEDED(hrc) && offSubtrahend != 0)
+        hrc = SetUInt64(machine, "VBoxInternal/DBGF/loadmap", KeyStr.c_str(), "Subtrahend", offSubtrahend);
+    if (SUCCEEDED(hrc) && iSeg != UINT32_MAX)
+        hrc = SetUInt64(machine, "VBoxInternal/DBGF/loadmap", KeyStr.c_str(), "Segment", iSeg);
+
+    return FAILED(hrc);
+}
+
+
 static DECLCALLBACK(void) handleVDError(void *pvUser, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)
 {
@@ -2108,4 +2183,6 @@
      */
     const char *pszCmd = a->argv[0];
+    if (!strcmp(pszCmd, "loadmap"))
+        return CmdLoadMap(a->argc - 1, &a->argv[1], a->virtualBox, a->session);
     if (!strcmp(pszCmd, "loadsyms"))
         return CmdLoadSyms(a->argc - 1, &a->argv[1], a->virtualBox, a->session);
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h	(revision 39476)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h	(revision 39477)
@@ -68,5 +68,5 @@
 #define USAGE_SHAREDFOLDER_REMOVE   RT_BIT_64(26)
 #define USAGE_LOADSYMS              RT_BIT_64(29)
-#define USAGE_UNLOADSYMS            RT_BIT_64(30)
+#define USAGE_LOADMAP               RT_BIT_64(30)
 #define USAGE_SETHDUUID             RT_BIT_64(31)
 #define USAGE_CONVERTFROMRAW        RT_BIT_64(32)
Index: /trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp	(revision 39476)
+++ /trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp	(revision 39477)
@@ -663,5 +663,13 @@
     PUVM pUVM = pConsole->mpUVM = VMR3GetUVM(pVM);
     VMR3RetainUVM(pUVM);
-    int vrc = pConsole->configConstructorInner(pVM, &alock);
+    int vrc;
+    try
+    {
+        vrc = pConsole->configConstructorInner(pVM, &alock);
+    }
+    catch (...)
+    {
+        vrc = VERR_UNEXPECTED_EXCEPTION;
+    }
     if (RT_FAILURE(vrc))
     {
@@ -1117,7 +1125,9 @@
 #endif
         }
-        /*
-         * Enable 3 following devices: HPET, SMC, LPC on MacOS X guests or on ICH9 chipset
-         */
+
+        /*
+         * Enable the following devices: HPET, SMC and LPC on MacOS X guests or on ICH9 chipset
+         */
+
         /*
          * High Precision Event Timer (HPET)
@@ -2631,4 +2641,29 @@
                 }
             }
+        }
+
+        /*
+         * Set up the default DBGF search paths if all is cool so far.
+         */
+        {
+            PCFGMNODE pDbgf;
+            InsertConfigNode(pRoot, "DBGF", &pDbgf);
+
+            hrc = pMachine->COMGETTER(SettingsFilePath)(bstr.asOutParam());         H();
+            Utf8Str strSettingsPath(bstr);
+            bstr.setNull();
+            strSettingsPath.stripFilename();
+
+            char szHomeDir[RTPATH_MAX];
+            rc = RTPathUserHome(szHomeDir, sizeof(szHomeDir));
+            if (RT_FAILURE(rc))
+                szHomeDir[0] = '\0';
+
+            Utf8Str strPath;
+            strPath.append(strSettingsPath).append("/debug/;");
+            strPath.append(strSettingsPath).append("/;");
+            strPath.append(szHomeDir).append("/");
+
+            InsertConfigString(pDbgf, "Path", strPath.c_str());
         }
     }
Index: /trunk/src/VBox/VMM/VMMR3/DBGFAddrSpace.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/DBGFAddrSpace.cpp	(revision 39476)
+++ /trunk/src/VBox/VMM/VMMR3/DBGFAddrSpace.cpp	(revision 39477)
@@ -686,5 +686,6 @@
  * Same as dbgfR3AsSearchEnv, except that the path is taken from the environment.
  *
- * It the environment variable doesn't exist, the current directory is searched instead.
+ * If the environment variable doesn't exist, the current directory is searched
+ * instead.
  *
  * @returns VBox status code.
@@ -705,4 +706,30 @@
     else
         rc = dbgfR3AsSearchPath(pszFilename, ".", pfnOpen, pvUser);
+    return rc;
+}
+
+
+/**
+ * Same as dbgfR3AsSearchEnv, except that the path is taken from the DBGF config
+ * (CFGM).
+ *
+ * Nothing is done if the CFGM variable isn't set.
+ *
+ * @returns VBox status code.
+ * @param   pszFilename     The filename.
+ * @param   pszCfgValue     The name of the config variable (under /DBGF/).
+ * @param   pfnOpen         The open callback function.
+ * @param   pvUser          User argument for the callback.
+ */
+static int dbgfR3AsSearchCfgPath(PVM pVM, const char *pszFilename, const char *pszCfgValue, PFNDBGFR3ASSEARCHOPEN pfnOpen, void *pvUser)
+{
+    char *pszPath;
+    int rc = CFGMR3QueryStringAllocDef(CFGMR3GetChild(CFGMR3GetRoot(pVM), "/DBGF"), pszCfgValue, &pszPath, NULL);
+    if (RT_FAILURE(rc))
+        return rc;
+    if (!pszPath)
+        return VERR_FILE_NOT_FOUND;
+    rc = dbgfR3AsSearchPath(pszFilename, pszPath, pfnOpen, pvUser);
+    MMR3HeapFree(pszPath);
     return rc;
 }
@@ -762,5 +789,9 @@
     Data.fFlags = 0;
     Data.hMod = NIL_RTDBGMOD;
-    int rc = dbgfR3AsSearchEnvPath(pszFilename, "VBOXDBG_IMAGE_PATH", dbgfR3AsLoadImageOpen, &Data);
+    int rc = dbgfR3AsSearchCfgPath(pVM, pszFilename, "ImagePath", dbgfR3AsLoadImageOpen, &Data);
+    if (RT_FAILURE(rc))
+        rc = dbgfR3AsSearchEnvPath(pszFilename, "VBOXDBG_IMAGE_PATH", dbgfR3AsLoadImageOpen, &Data);
+    if (RT_FAILURE(rc))
+        rc = dbgfR3AsSearchCfgPath(pVM, pszFilename, "Path", dbgfR3AsLoadImageOpen, &Data);
     if (RT_FAILURE(rc))
         rc = dbgfR3AsSearchEnvPath(pszFilename, "VBOXDBG_PATH", dbgfR3AsLoadImageOpen, &Data);
@@ -834,5 +865,9 @@
     Data.fFlags = 0;
     Data.hMod = NIL_RTDBGMOD;
-    int rc = dbgfR3AsSearchEnvPath(pszFilename, "VBOXDBG_MAP_PATH", dbgfR3AsLoadMapOpen, &Data);
+    int rc = dbgfR3AsSearchCfgPath(pVM, pszFilename, "MapPath", dbgfR3AsLoadMapOpen, &Data);
+    if (RT_FAILURE(rc))
+        rc = dbgfR3AsSearchEnvPath(pszFilename, "VBOXDBG_MAP_PATH", dbgfR3AsLoadMapOpen, &Data);
+    if (RT_FAILURE(rc))
+        rc = dbgfR3AsSearchCfgPath(pVM, pszFilename, "Path", dbgfR3AsLoadMapOpen, &Data);
     if (RT_FAILURE(rc))
         rc = dbgfR3AsSearchEnvPath(pszFilename, "VBOXDBG_PATH", dbgfR3AsLoadMapOpen, &Data);
Index: /trunk/src/VBox/VMM/VMMR3/DBGFSym.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/DBGFSym.cpp	(revision 39476)
+++ /trunk/src/VBox/VMM/VMMR3/DBGFSym.cpp	(revision 39477)
@@ -262,4 +262,6 @@
 #endif
 
+    /** @todo symbol search path setup. */
+
     /*
      * Check if there are 'loadsyms' commands in the configuration.
@@ -324,4 +326,60 @@
 
             MMR3HeapFree(pszModule);
+            MMR3HeapFree(pszFilename);
+        }
+    }
+
+    /*
+     * Check if there are 'loadmap' commands in the configuration.
+     */
+    pNode = CFGMR3GetChild(CFGMR3GetRoot(pVM), "/DBGF/loadmap/");
+    if (pNode)
+    {
+        /*
+         * Enumerate the commands.
+         */
+        for (PCFGMNODE pCmdNode = CFGMR3GetFirstChild(pNode);
+             pCmdNode;
+             pCmdNode = CFGMR3GetNextChild(pCmdNode))
+        {
+            char szCmdName[128];
+            CFGMR3GetName(pCmdNode, &szCmdName[0], sizeof(szCmdName));
+
+            /* File */
+            char *pszFilename;
+            rc = CFGMR3QueryStringAlloc(pCmdNode, "Filename", &pszFilename);
+            AssertMsgRCReturn(rc, ("rc=%Rrc querying the 'File' attribute of '/DBGF/loadsyms/%s'!\n", rc, szCmdName), rc);
+
+            /* Address. */
+            RTGCPTR GCPtrAddr;
+            rc = CFGMR3QueryGCPtrUDef(pNode, "Address", &GCPtrAddr, 0);
+            AssertMsgRCReturn(rc, ("rc=%Rrc querying the 'Address' attribute of '/DBGF/loadsyms/%s'!\n", rc, szCmdName), rc);
+            DBGFADDRESS ModAddr;
+            DBGFR3AddrFromFlat(pVM, &ModAddr, GCPtrAddr);
+
+            /* Name (optional) */
+            char *pszModName;
+            rc = CFGMR3QueryStringAllocDef(pCmdNode, "Name", &pszModName, NULL);
+            AssertMsgRCReturn(rc, ("rc=%Rrc querying the 'Name' attribute of '/DBGF/loadsyms/%s'!\n", rc, szCmdName), rc);
+
+            /* Subtrahend (optional) */
+            RTGCPTR offSubtrahend;
+            rc = CFGMR3QueryGCPtrDef(pNode, "Subtrahend", &offSubtrahend, 0);
+            AssertMsgRCReturn(rc, ("rc=%Rrc querying the 'Subtrahend' attribute of '/DBGF/loadsyms/%s'!\n", rc, szCmdName), rc);
+
+            /* Segment (optional) */
+            uint32_t iSeg;
+            rc = CFGMR3QueryU32Def(pNode, "Segment", &iSeg, UINT32_MAX);
+            AssertMsgRCReturn(rc, ("rc=%Rrc querying the 'Segment' attribute of '/DBGF/loadsyms/%s'!\n", rc, szCmdName), rc);
+
+            /*
+             * Execute the command.
+             */
+            rc = DBGFR3AsLoadMap(pVM, DBGF_AS_GLOBAL, pszFilename, pszModName, &ModAddr,
+                                 iSeg == UINT32_MAX ? NIL_RTDBGSEGIDX : iSeg, offSubtrahend, 0 /*fFlags*/);
+            AssertMsgRCReturn(rc, ("pszFilename=%s pszModName=%s ModAddr=%RGv offSubtrahend=%#x iSeg=%#x\n",
+                                   pszFilename, pszModName, ModAddr.FlatPtr, offSubtrahend, iSeg), rc);
+
+            MMR3HeapFree(pszModName);
             MMR3HeapFree(pszFilename);
         }
