From: Jean-Paul Mari Date: Thu, 23 Aug 2018 01:52:14 +0000 (-0400) Subject: The address provided in the memory window is now verified to prevent crash X-Git-Tag: v2.1.3-R4~45 X-Git-Url: http://git.hcoop.net/clinton/Virtual-Jaguar-Rx.git/commitdiff_plain/8d867eb21d032694c92c3a7f6192f434a67b88a6?hp=47b6ecae8f96f86ae72d0a76ada94c943bad54b3 The address provided in the memory window is now verified to prevent crash --- diff --git a/docs/vj_ReleaseNotes.txt b/docs/vj_ReleaseNotes.txt index 5df4915..e2208b2 100644 --- a/docs/vj_ReleaseNotes.txt +++ b/docs/vj_ReleaseNotes.txt @@ -11,11 +11,13 @@ Release 4 (TBD) -- Breakpoint can now occur in the case of a ROM cartridge writing -- Alert box will display a message with possibility to pass or not the breakpoint only if this is related to a 8 or 16 bits ROM access 8) Local variables window detects now if a variable is used or not by the code +9) The address provided in the memory window is now verified to prevent crash +-- Wrong provided address will be displayed in red Release 3 (13th November 2017) ------------------------------ 0) Fixed the windows respawning in the next emulator launch within --alpine or --debugger options -1) Added an Exception Vector Table browser window +1) Added an Exception Vector Table window 2) Modified the About window to update the credits list in a more appropriate way -- Updated the emulator application credits line 3) Added 'Rx' word to the emulator name @@ -38,7 +40,7 @@ Release 3 (13th November 2017) 15) Improved the .heap section detection to avoid a detection error -- Depend vlink version, .heap section may have an Alloc flag 16) Fixed a crash when DWARF information does references to missing source code files -17) Added a Local browser window for local variables +17) Added a local variables window 18) Project has switched to Visual Studio 2017 and QT 5.9.1 library Release 2 (3rd September 2017) @@ -50,9 +52,9 @@ Release 2 (3rd September 2017) 4) DWARF support -- TAG: Compilation Unit, Subprogram, Variables, Types -- Line numbers, symbols, functions -5) Added an All Watch browser window for non-local variables -6) Added a heap allocator browser window based on my own memory allocation functions -7) Added additional 4 memory browser windows with address input based on hexa, decimal or symbol name +5) Added an All Watch window for non-local variables +6) Added a heap allocator window based on my own memory allocation functions +7) Added additional 4 memory windows with address input based on hexa, decimal or symbol name 8) Windows refreshing executed only if windows is visible 9) Added a restart function -- Restart only the 68000 program counter to his original set @@ -118,6 +120,7 @@ Known issues -- Otherwise, source code and assembly may not match or leads to instabilities 9) The emulator needs to be restarted in case of keybindings changes 10) In the case of a ROM cartridge writing, and an occuring breakpoint, the PC pointer will point at the next instruction and not at the instruction causing the breakpoint +11) Emulator will crash in case of wrong value provided in the memory browser window Cosmetic / UX issues ==================== diff --git a/src/debugger/memory1browser.cpp b/src/debugger/memory1browser.cpp index af8cbc2..71c3473 100644 --- a/src/debugger/memory1browser.cpp +++ b/src/debugger/memory1browser.cpp @@ -16,6 +16,7 @@ #include "memory1browser.h" #include "memory.h" #include "debugger/DBGManager.h" +#include "settings.h" // @@ -63,9 +64,8 @@ void Memory1BrowserWindow::RefreshContents(size_t NumWin) if (isVisible()) { - sprintf(string, "Memory %i - %06X", (unsigned int)((NumWinOrigin = NumWin) + 1), (unsigned int)memOrigin); + sprintf(string, "Memory %i - 0x%06X", (unsigned int)((NumWinOrigin = NumWin) + 1), (unsigned int)memOrigin); setWindowTitle(tr(string)); - RefreshContentsWindow(); } } @@ -128,7 +128,9 @@ void Memory1BrowserWindow::keyPressEvent(QKeyEvent * e) memBase -= 480; if (memBase < 0) + { memBase = 0; + } RefreshContentsWindow(); } @@ -138,8 +140,10 @@ void Memory1BrowserWindow::keyPressEvent(QKeyEvent * e) { memBase += 480; - if (memBase > (0x200000 - 480)) - memBase = 0x200000 - 480; + if (memBase > (vjs.DRAM_size - 480)) + { + memBase = vjs.DRAM_size - 480; + } RefreshContentsWindow(); } @@ -150,7 +154,9 @@ void Memory1BrowserWindow::keyPressEvent(QKeyEvent * e) memBase -= 16; if (memBase < 0) + { memBase = 0; + } RefreshContentsWindow(); } @@ -160,8 +166,10 @@ void Memory1BrowserWindow::keyPressEvent(QKeyEvent * e) { memBase += 16; - if (memBase > (0x200000 - 480)) - memBase = 0x200000 - 480; + if (memBase > (vjs.DRAM_size - 480)) + { + memBase = vjs.DRAM_size - 480; + } RefreshContentsWindow(); } @@ -185,21 +193,39 @@ void Memory1BrowserWindow::GoToAddress(void) { bool ok; QString newAddress; + size_t newmemBase; + QPalette p = address->palette(); newAddress = address->text(); - if (( newAddress.at(0) == QChar('0')) && (newAddress.at(1) == QChar('x'))) + if (newAddress.size()) { - memBase = newAddress.toUInt(&ok, 16); - } - else - { - if (!(memBase = DBGManager_GetAdrFromSymbolName(newAddress.toLatin1().data()))) + if ((newAddress.at(0) == QChar('0')) && (newAddress.at(1) == QChar('x'))) { - memBase = newAddress.toUInt(&ok, 10); + newmemBase = newAddress.toUInt(&ok, 16); + } + else + { + if (!(newmemBase = DBGManager_GetAdrFromSymbolName(newAddress.toLatin1().data()))) + { + newmemBase = newAddress.toUInt(&ok, 10); + } + else + { + ok = true; + } } - } - memOrigin = memBase; - RefreshContents(NumWinOrigin); + if (!ok || (newmemBase < 0) || (newmemBase > vjs.DRAM_size)) + { + p.setColor(QPalette::Text, Qt::red); + } + else + { + p.setColor(QPalette::Text, Qt::black); + memOrigin = (memBase = newmemBase); + RefreshContents(NumWinOrigin); + } + address->setPalette(p); + } }