VirtualBox

Changeset 32450 in vbox


Ignore:
Timestamp:
Sep 13, 2010 2:33:41 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
65821
Message:

VMM/DBGFCoreWrite: comply with both ELF64 and broken Solaris code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/DBGFCoreWrite.cpp

    r32341 r32450  
    8080static const int s_NoteAlign  = 4;      /* @todo see #5211 comment 3 */
    8181static const int s_cbNoteName = 16;
    82 static const char *s_pcszCoreVBoxCore = "VBOXCORE";
    83 static const char *s_pcszCoreVBoxCpu  = "VBOXCPU";
     82
     83/* These strings *HAVE* to be 8-byte aligned */
     84static const char *s_pcszCoreVBoxCore = "VBCORE";
     85static const char *s_pcszCoreVBoxCpu  = "VBCPU";
     86
    8487
    8588/**
     
    215218    uint64_t cbDataAlign = RT_ALIGN_64(cbData, s_NoteAlign);
    216219
     220    /*
     221     * Yell loudly and bail if we are going to be writing a core file that is not compatible with
     222     * both Solaris and the 64-bit ELF spec. which dictates 8-byte alignment. See #5211 comment 3.
     223     */
     224    if (cbNameAlign % 8)
     225    {
     226        LogRel((DBGFLOG_NAME ":Elf64WriteNoteHdr pszName=%s cbNameAlign=%u, not 8-byte aligned!\n", pszName, cbNameAlign));
     227        return VERR_INVALID_PARAMETER;
     228    }
     229
     230    if (cbDataAlign % 8)
     231    {
     232        LogRel((DBGFLOG_NAME ":Elf64WriteNoteHdr pszName=%s cbDataAlign=%u, not 8-byte aligned!\n", pszName, cbDataAlign));
     233        return VERR_INVALID_PARAMETER;
     234    }
     235
    217236    static const char s_achPad[7] = { 0, 0, 0, 0, 0, 0, 0 };
    218237    AssertCompile(sizeof(s_achPad) >= s_NoteAlign - 1);
     
    220239    Elf64_Nhdr ElfNoteHdr;
    221240    RT_ZERO(ElfNoteHdr);
    222     ElfNoteHdr.n_namesz = (Elf64_Word)cbName;   /* @todo fix this later to NOT include NULL terminator */
     241    ElfNoteHdr.n_namesz = (Elf64_Word)cbName - 1;   /* Again a discrepancy between Elf64 and Solaris (#5211 comment 3) */
    223242    ElfNoteHdr.n_type   = Type;
    224243    ElfNoteHdr.n_descsz = (Elf64_Word)cbDataAlign;
     
    322341    CoreDescriptor.cCpus            = pVM->cCpus;
    323342
    324     LogRel((DBGFLOG_NAME ":CoreDescriptor Version=%u Revision=%u\n", CoreDescriptor.u32VBoxVersion, CoreDescriptor.u32VBoxRevision));
     343    Log((DBGFLOG_NAME ":CoreDescriptor Version=%u Revision=%u\n", CoreDescriptor.u32VBoxVersion, CoreDescriptor.u32VBoxRevision));
    325344
    326345    /*
     
    394413        uint64_t cbFileRange = fIsMmio ? 0 : cbMemRange;
    395414
    396         LogRel((DBGFLOG_NAME ": PGMR3PhysGetRange iRange=%u GCPhysStart=%#x GCPhysEnd=%#x cbMemRange=%u\n",
     415        Log((DBGFLOG_NAME ": PGMR3PhysGetRange iRange=%u GCPhysStart=%#x GCPhysEnd=%#x cbMemRange=%u\n",
    397416                iRange, GCPhysStart, GCPhysEnd, cbMemRange));
    398417
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