~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to src/VBox/VMM/DBGFSym.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
165
165
                if (!pName)
166
166
                {
167
167
                    /* make new symbol space node. */
168
 
                    PDBGFSYMSPACE pName = (PDBGFSYMSPACE)MMR3HeapAlloc(pVM, MM_TAG_DBGF_SYMBOL, sizeof(*pName) + cchName);
 
168
                    pName = (PDBGFSYMSPACE)MMR3HeapAlloc(pVM, MM_TAG_DBGF_SYMBOL, sizeof(*pName) + cchName);
169
169
                    if (pName)
170
170
                    {
171
171
                        pName->Core.pszString = (char *)memcpy(pName + 1, pszName, cchName);
229
229
 */
230
230
static char *dbgfR3Strip(char *psz)
231
231
{
232
 
    while (*psz && isspace(*psz))
 
232
    while (*psz && RT_C_IS_SPACE(*psz))
233
233
        psz++;
234
234
    char *psz2 = strchr(psz, '\0') - 1;
235
 
    while (psz2 >= psz && isspace(*psz2))
 
235
    while (psz2 >= psz && RT_C_IS_SPACE(*psz2))
236
236
        *psz2-- = '\0';
237
237
    return psz;
238
238
}
454
454
            ||  strstr(szHead, "Linker script and memory map"))
455
455
            return SYMFILETYPE_LD_MAP;
456
456
 
457
 
        if (   isxdigit(szHead[0])
458
 
            && isxdigit(szHead[1])
459
 
            && isxdigit(szHead[2])
460
 
            && isxdigit(szHead[3])
461
 
            && isxdigit(szHead[4])
462
 
            && isxdigit(szHead[5])
463
 
            && isxdigit(szHead[6])
464
 
            && isxdigit(szHead[7])
 
457
        if (   RT_C_IS_XDIGIT(szHead[0])
 
458
            && RT_C_IS_XDIGIT(szHead[1])
 
459
            && RT_C_IS_XDIGIT(szHead[2])
 
460
            && RT_C_IS_XDIGIT(szHead[3])
 
461
            && RT_C_IS_XDIGIT(szHead[4])
 
462
            && RT_C_IS_XDIGIT(szHead[5])
 
463
            && RT_C_IS_XDIGIT(szHead[6])
 
464
            && RT_C_IS_XDIGIT(szHead[7])
465
465
            && szHead[8] == ' '
466
 
            && isalpha(szHead[9])
 
466
            && RT_C_IS_ALPHA(szHead[9])
467
467
            && szHead[10] == ' '
468
 
            && (isalpha(szHead[11]) || szHead[11] == '_' || szHead[11] == '$')
 
468
            && (RT_C_IS_ALPHA(szHead[11]) || szHead[11] == '_' || szHead[11] == '$')
469
469
            )
470
470
            return SYMFILETYPE_LINUX_SYSTEM_MAP;
471
471
 
472
 
        if (   isxdigit(szHead[0])
473
 
            && isxdigit(szHead[1])
474
 
            && isxdigit(szHead[2])
475
 
            && isxdigit(szHead[3])
476
 
            && isxdigit(szHead[4])
477
 
            && isxdigit(szHead[5])
478
 
            && isxdigit(szHead[6])
479
 
            && isxdigit(szHead[7])
480
 
            && isxdigit(szHead[8])
481
 
            && isxdigit(szHead[9])
482
 
            && isxdigit(szHead[10])
483
 
            && isxdigit(szHead[11])
484
 
            && isxdigit(szHead[12])
485
 
            && isxdigit(szHead[13])
486
 
            && isxdigit(szHead[14])
487
 
            && isxdigit(szHead[15])
 
472
        if (   RT_C_IS_XDIGIT(szHead[0])
 
473
            && RT_C_IS_XDIGIT(szHead[1])
 
474
            && RT_C_IS_XDIGIT(szHead[2])
 
475
            && RT_C_IS_XDIGIT(szHead[3])
 
476
            && RT_C_IS_XDIGIT(szHead[4])
 
477
            && RT_C_IS_XDIGIT(szHead[5])
 
478
            && RT_C_IS_XDIGIT(szHead[6])
 
479
            && RT_C_IS_XDIGIT(szHead[7])
 
480
            && RT_C_IS_XDIGIT(szHead[8])
 
481
            && RT_C_IS_XDIGIT(szHead[9])
 
482
            && RT_C_IS_XDIGIT(szHead[10])
 
483
            && RT_C_IS_XDIGIT(szHead[11])
 
484
            && RT_C_IS_XDIGIT(szHead[12])
 
485
            && RT_C_IS_XDIGIT(szHead[13])
 
486
            && RT_C_IS_XDIGIT(szHead[14])
 
487
            && RT_C_IS_XDIGIT(szHead[15])
488
488
            && szHead[16] == ' '
489
 
            && isalpha(szHead[17])
 
489
            && RT_C_IS_ALPHA(szHead[17])
490
490
            && szHead[18] == ' '
491
 
            && (isalpha(szHead[19]) || szHead[19] == '_' || szHead[19] == '$')
 
491
            && (RT_C_IS_ALPHA(szHead[19]) || szHead[19] == '_' || szHead[19] == '$')
492
492
            )
493
493
            return SYMFILETYPE_LINUX_SYSTEM_MAP;
494
494
 
532
532
            &&  u64Address != (RTGCUINTPTR)~0)
533
533
        {
534
534
            pszEnd++;
535
 
            if (    isalpha(*pszEnd)
 
535
            if (    RT_C_IS_ALPHA(*pszEnd)
536
536
                &&  (pszEnd[1] == ' ' || pszEnd[1] == '\t'))
537
537
            {
538
538
                psz = dbgfR3Strip(pszEnd + 2);
954
954
 
955
955
 
956
956
/**
957
 
 * Duplicates a symbol.
958
 
 *
959
 
 * @returns Pointer to the duplicated symbol.
960
 
 * @param   pVM             The VM handle.
961
 
 * @param   pSymbol         The symbol to duplicate.
962
 
 */
963
 
static PDBGFSYMBOL dbgfR3SymbolDup(PVM pVM, PCDBGFSYMBOL pSymbol)
964
 
{
965
 
    size_t cb = strlen(pSymbol->szName) + RT_OFFSETOF(DBGFSYMBOL, szName[1]);
966
 
    PDBGFSYMBOL pDup = (PDBGFSYMBOL)MMR3HeapAlloc(pVM, MM_TAG_DBGF_SYMBOL_DUP, cb);
967
 
    if (pDup)
968
 
        memcpy(pDup, pSymbol, cb);
969
 
    return pDup;
970
 
}
971
 
 
972
 
 
973
 
/**
974
 
 * Find symbol by address (nearest), allocate return buffer.
975
 
 *
976
 
 * @returns Pointer to the symbol. Must be freed using DBGFR3SymbolFree().
977
 
 * @returns NULL if the symbol was not found or if we're out of memory.
978
 
 * @param   pVM                 VM handle.
979
 
 * @param   Address             Address.
980
 
 * @param   poffDisplacement    Where to store the symbol displacement from Address.
981
 
 */
982
 
VMMR3DECL(PDBGFSYMBOL) DBGFR3SymbolByAddrAlloc(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement)
983
 
{
984
 
    DBGFSYMBOL Symbol;
985
 
    int rc = DBGFR3SymbolByAddr(pVM, Address, poffDisplacement, &Symbol);
986
 
    if (RT_FAILURE(rc))
987
 
        return NULL;
988
 
    return dbgfR3SymbolDup(pVM, &Symbol);
989
 
}
990
 
 
991
 
 
992
 
/**
993
 
 * Find symbol by name (first), allocate return buffer.
994
 
 *
995
 
 * @returns Pointer to the symbol. Must be freed using DBGFR3SymbolFree().
996
 
 * @returns NULL if the symbol was not found or if we're out of memory.
997
 
 * @param   pVM                 VM handle.
998
 
 * @param   pszSymbol           Symbol name.
999
 
 */
1000
 
VMMR3DECL(PDBGFSYMBOL) DBGFR3SymbolByNameAlloc(PVM pVM, const char *pszSymbol)
1001
 
{
1002
 
    DBGFSYMBOL Symbol;
1003
 
    int rc = DBGFR3SymbolByName(pVM, pszSymbol, &Symbol);
1004
 
    if (RT_FAILURE(rc))
1005
 
        return NULL;
1006
 
    return dbgfR3SymbolDup(pVM, &Symbol);
1007
 
}
1008
 
 
1009
 
 
1010
 
/**
1011
 
 * Frees a symbol returned by DBGFR3SymbolbyNameAlloc() or DBGFR3SymbolByAddressAlloc().
1012
 
 *
1013
 
 * @param   pSymbol         Pointer to the symbol.
1014
 
 */
1015
 
VMMR3DECL(void) DBGFR3SymbolFree(PDBGFSYMBOL pSymbol)
1016
 
{
1017
 
    if (pSymbol)
1018
 
        MMR3HeapFree(pSymbol);
1019
 
}
1020
 
 
1021
 
 
1022
 
/**
1023
957
 * Find line by address (nearest).
1024
958
 *
1025
959
 * @returns VBox status.