VirtualBox

Ignore:
Timestamp:
Jun 22, 2012 12:14:56 AM (12 years ago)
Author:
vboxsync
Message:

DIS: Fixed two bugs in the size-only parsers that was introduced when changing the return from size to offset late in the refactoring. Added tests to make sure this doesn't break again so easily.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Disassembler/testcase/tstDisasm-2.cpp

    r41863 r41874  
    357357        if (uHighlightAddr - State.uAddress < State.cbInstr)
    358358            RTPrintf("; ^^^^^^^^^^^^^^^^^^^^^\n");
     359
     360        /* Check that the size-only mode returns the smae size on success. */
     361        if (RT_SUCCESS(rc))
     362        {
     363            uint32_t cbInstrOnly = 32;
     364            uint8_t  abInstr[sizeof(State.Dis.abInstr)];
     365            memcpy(abInstr, State.Dis.abInstr, sizeof(State.Dis.abInstr));
     366            int rcOnly = DISInstWithPrefetchedBytes(State.uAddress, enmCpuMode, 0 /*fFilter - none */,
     367                                                    abInstr, State.Dis.cbCachedInstr, MyDisasInstrRead, &State,
     368                                                    &State.Dis, &cbInstrOnly);
     369            if (   rcOnly != rc
     370                || cbInstrOnly != State.cbInstr)
     371            {
     372                RTPrintf("; Instruction size only check failed rc=%Rrc cbInstrOnly=%#x exepcted %Rrc and %#x\n",
     373                         rcOnly, cbInstrOnly, rc, State.cbInstr);
     374                rcRet = VERR_GENERAL_FAILURE;
     375                break;
     376            }
     377        }
    359378
    360379        /* next */
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