Index: trunk/src/VBox/Runtime/common/dbg/dbgmodnm.cpp
===================================================================
--- trunk/src/VBox/Runtime/common/dbg/dbgmodnm.cpp	(revision 21106)
+++ trunk/src/VBox/Runtime/common/dbg/dbgmodnm.cpp	(revision 21107)
@@ -202,7 +202,9 @@
      * Try parse the stream.
      */
-    char        szMod[RTDBG_SEGMENT_NAME_LENGTH] = "";
+    RTUINTPTR   SegZeroRva = fAddSymbols ? RTDbgModSegmentRva(pThis->hCnt, 0/*iSeg*/) : 0;
+    char        szSym[RTDBG_SYMBOL_NAME_LENGTH] = "";
+    size_t      cchMod  = 0;
+    size_t      offSym  = 0;
     unsigned    cchAddr = 0;
-    RTDBGSEGIDX iSeg    = 0;
     uint64_t    u64Low  = UINT64_MAX;
     uint64_t    u64High = 0;
@@ -261,6 +263,6 @@
                         return VERR_DBG_NOT_LINUX_KALLSYMS;
                     char *pszEnd = pszModNameEnd + 1;
-                    if ((size_t)(pszModNameEnd - pszModName) >= sizeof(szMod)) /* lazy bird */
-                        pszModNameEnd = &pszModName[sizeof(szMod)-1];
+                    if ((size_t)(pszModNameEnd - pszModName) >= 128) /* lazy bird */
+                        return VERR_DBG_NOT_LINUX_KALLSYMS;
                     *pszModNameEnd = '\0';
                     if (*pszEnd)
@@ -272,20 +274,19 @@
 
             /*
-             * Did the module change? If so commit the previous segment.
+             * Did the module change? Then update the symbol prefix.
              */
-            if (    strcmp(pszModName, szMod)
-                &&  (   u64Low != UINT64_MAX
-                     || u64High != 0))
+            if (    cchMod != pszModNameEnd - pszModName
+                ||  memcmp(pszModName, szSym, cchMod))
             {
-                if (!fAddSymbols)
+                cchMod = pszModNameEnd - pszModName;
+                if (cchMod == 0)
+                    offSym = 0;
+                else
                 {
-                    rc = RTDbgModSegmentAdd(pThis->hCnt, u64Low, u64High - u64Low + 1, szMod[0] ? szMod : "main", 0, &iSeg);
-                    if (RT_FAILURE(rc))
-                        return rc;
+                    memcpy(szSym, pszModName, cchMod);
+                    szSym[cchMod] = '.';
+                    offSym = cchMod + 1;
                 }
-                iSeg++;
-                u64Low = UINT64_MAX;
-                u64High = 0;
-                memcpy(szMod, pszModName, pszModNameEnd - pszModName + 1);
+                szSym[offSym] = '\0';
             }
 
@@ -294,9 +295,10 @@
              */
             uint32_t    fFlags  = 0;
-            RTDBGSEGIDX iSegSym = iSeg;
+            RTDBGSEGIDX iSegSym = 0;
             switch (chType)
             {
                 /* absolute */
                 case 'a':
+                case '?': /* /proc/kallsyms */
                     iSegSym = RTDBGSEGIDX_ABS;
                     /// @todo fFlags |= RTDBG_SYM_FLAGS_LOCAL;
@@ -388,11 +390,20 @@
                 if (fAddSymbols)
                 {
-                    rc = RTDbgModSymbolAdd(pThis->hCnt, pszName, iSeg, u64Addr - RTDbgModSegmentRva(pThis->hCnt, iSeg), 0, fFlags, NULL);
-                    if (RT_FAILURE(rc))
+                    size_t cchName = pszNameEnd - pszName;
+                    if (cchName >= sizeof(szSym) - offSym)
+                        cchName = sizeof(szSym) - offSym - 1;
+                    memcpy(&szSym[offSym], pszName, cchName + 1);
+                    if (iSegSym == 0)
+                        rc = RTDbgModSymbolAdd(pThis->hCnt, szSym, iSegSym, u64Addr - SegZeroRva, 0/*cb*/, fFlags, NULL);
+                    else
+                        rc = RTDbgModSymbolAdd(pThis->hCnt, szSym, iSegSym, u64Addr, 0/*cb*/, fFlags, NULL);
+                    if (    RT_FAILURE(rc)
+                        &&  rc != VERR_DBG_DUPLICATE_SYMBOL
+                        &&  rc != VERR_DBG_ADDRESS_CONFLICT) /* (don't be too strict) */
                         return rc;
                 }
 
                 /* Track segment span. */
-                if (iSegSym == iSeg)
+                if (iSegSym == 0)
                 {
                     if (u64Low > u64Addr)
@@ -435,10 +446,14 @@
     if (rc == VERR_EOF)
     {
-        if (    !fAddSymbols
-            &&  (   u64Low != UINT64_MAX
-                 || u64High != 0))
-            rc = RTDbgModSegmentAdd(pThis->hCnt, u64Low, u64High - u64Low + 1, szMod[0] ? szMod : "main", 0, &iSeg);
+        if (fAddSymbols)
+            rc = VINF_SUCCESS;
         else
-            rc = VINF_SUCCESS;
+        {
+            if (    u64Low  != UINT64_MAX
+                 || u64High != 0)
+                rc = RTDbgModSegmentAdd(pThis->hCnt, u64Low, u64High - u64Low + 1, "main", 0, NULL);
+            else /* No sensible symbols... throw an error instead? */
+                rc = RTDbgModSegmentAdd(pThis->hCnt, 0, 0, "main", 0, NULL);
+        }
     }
 
