VirtualBox

Changeset 84989 in vbox for trunk/src/VBox/Debugger


Ignore:
Timestamp:
Jun 29, 2020 11:12:40 AM (5 years ago)
Author:
vboxsync
Message:

Debugger/DBGPlugInLinux: Straighten the code to adjust the kernel log buffer size to not require a loop, bugref:1098

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Debugger/DBGPlugInLinux.cpp

    r84988 r84989  
    293293        /** @todo Go back to find the start address of the kernel log (or we loose potential kernel log messages). */
    294294
    295         if (RT_SUCCESS(rc))
     295        if (   RT_SUCCESS(rc)
     296            && cbLogBuf)
    296297        {
    297298            /* Align log buffer size to a power of two. */
    298             if (cbLogBuf && !RT_IS_POWER_OF_TWO(cbLogBuf))
    299             {
    300                 uint32_t i = 0;
    301 
    302                 while (cbLogBuf)
    303                 {
    304                     cbLogBuf >>= 1;
    305                     i++;
    306                 }
    307 
    308                 cbLogBuf = 1 << i;
    309             }
     299            uint32_t idxBitLast = ASMBitLastSetU32(cbLogBuf);
     300            idxBitLast--; /* There is at least one bit set, see check above. */
     301
     302            if (cbLogBuf & (RT_BIT_32(idxBitLast) - 1))
     303                idxBitLast++;
    310304
    311305            *pGCPtrLogBuf = AddrHit.FlatPtr;
    312             *pcbLogBuf    = RT_MIN(cbLogBuf, LNX_MAX_KERNEL_LOG_SIZE);
    313         }
     306            *pcbLogBuf    = RT_MIN(RT_BIT_32(idxBitLast), LNX_MAX_KERNEL_LOG_SIZE);
     307        }
     308        else if (RT_SUCCESS(rc))
     309            rc = VERR_NOT_FOUND;
    314310    }
    315311
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