1
0
mirror of https://github.com/NevermindZZT/letter-shell.git synced 2025-01-21 10:02:54 +08:00

Merge pull request #129 from NevermindZZT/shell3.1

修复 hexdump 打印长度异常
This commit is contained in:
Letter 2022-06-12 19:47:13 +08:00 committed by GitHub
commit 5c35f032d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -228,13 +228,13 @@ void logHexDump(Log *log, LogLevel level, void *base, unsigned int length)
len = snprintf(logBuffer, LOG_BUFFER_SIZE - 1, "memory of 0x%08x, size: %d:\r\n%s", len = snprintf(logBuffer, LOG_BUFFER_SIZE - 1, "memory of 0x%08x, size: %d:\r\n%s",
(unsigned int)base, length, memPrintHead); (unsigned int)base, length, memPrintHead);
logWriteBuffer(log, level, logBuffer, len); logWriteBuffer(log, level, logBuffer, len);
len = length;
address = (unsigned char *)((unsigned int)base & (~0x0000000F)); address = (unsigned char *)((unsigned int)base & (~0x0000000F));
length += (unsigned int)base - (unsigned int)address; length += (unsigned int)base - (unsigned int)address;
length = (length + 15) & (~0x0000000F); length = (length + 15) & (~0x0000000F);
len = length;
while (length) while (length)
{ {
printLen += sprintf(logBuffer + printLen, memPrintAddr, (unsigned int)address); printLen += sprintf(logBuffer + printLen, memPrintAddr, (unsigned int)address);