Added a Save Dump As... feature to save a memory zone to a file
authorJean-Paul Mari <djipi.mari@gmail.com>
Mon, 22 Apr 2019 01:03:43 +0000 (21:03 -0400)
committerJean-Paul Mari <djipi.mari@gmail.com>
Mon, 22 Apr 2019 01:03:43 +0000 (21:03 -0400)
.gitignore
Win-VS2017/virtualjaguar.vcxproj
Win-VS2017/virtualjaguar.vcxproj.filters
docs/vj_HistoryNotes.txt
src/debugger/SaveDumpAsWin.cpp [new file with mode: 0644]
src/debugger/SaveDumpAsWin.h [new file with mode: 0644]
src/gui/mainwin.cpp
src/gui/mainwin.h
virtualjaguar.pro

index 05baa39..ffc38f5 100644 (file)
@@ -32,3 +32,4 @@ Win-VS2017/virtualjaguar.sdf
 Win-VS2017/virtualjaguar.vcxproj.user\r
 Win-VS2017/GeneratedFiles/\r
 Win-VS2015/\r
 Win-VS2017/virtualjaguar.vcxproj.user\r
 Win-VS2017/GeneratedFiles/\r
 Win-VS2015/\r
+Win-VS2019/\r
index 08f1e70..52a6b6d 100644 (file)
     <ClCompile Include="..\src\debugger\FilesrcListWin.cpp" />\r
     <ClCompile Include="..\src\debugger\localbrowser.cpp" />\r
     <ClCompile Include="..\src\debugger\NewFnctBreakpointWin.cpp" />\r
     <ClCompile Include="..\src\debugger\FilesrcListWin.cpp" />\r
     <ClCompile Include="..\src\debugger\localbrowser.cpp" />\r
     <ClCompile Include="..\src\debugger\NewFnctBreakpointWin.cpp" />\r
+    <ClCompile Include="..\src\debugger\SaveDumpAsWin.cpp" />\r
     <ClCompile Include="..\src\debugger\VideoWin.cpp" />\r
     <ClCompile Include="..\src\file.cpp" />\r
     <ClCompile Include="..\src\gui\keybindingstab.cpp" />\r
     <ClCompile Include="..\src\debugger\VideoWin.cpp" />\r
     <ClCompile Include="..\src\file.cpp" />\r
     <ClCompile Include="..\src\gui\keybindingstab.cpp" />\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
     </ClCompile>\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
     </ClCompile>\r
+    <ClCompile Include="GeneratedFiles\Debug\moc_SaveDumpAsWin.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
     <ClCompile Include="GeneratedFiles\Debug\moc_stackbrowser.cpp">\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
     <ClCompile Include="GeneratedFiles\Debug\moc_stackbrowser.cpp">\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
     </ClCompile>\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
     </ClCompile>\r
+    <ClCompile Include="GeneratedFiles\Release\moc_SaveDumpAsWin.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
     <ClCompile Include="GeneratedFiles\Release\moc_stackbrowser.cpp">\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
     <ClCompile Include="GeneratedFiles\Release\moc_stackbrowser.cpp">\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>\r
       <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"  -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -D__GCCWIN32__ -DQT_NO_DEBUG -DQT_OPENGL_LIB -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -D_UNICODE  "-I." "-I.\..\src" "-I.\..\src\gui" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtOpenGL" "-IC:\SDK\OpenGL\include" "-IC:\SDK\SDL\SDL-1.2.15\include" "-IC:\SDK\DWARF\libdwarf-VS2015\include" "-IC:\SDK\Elf\libelf-0.8.13\include" "-IC:\SDK\zlib\zlib-1.2.11\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\GeneratedFiles"</Command>\r
     </CustomBuild>\r
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>\r
       <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"  -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -D__GCCWIN32__ -DQT_NO_DEBUG -DQT_OPENGL_LIB -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -D_UNICODE  "-I." "-I.\..\src" "-I.\..\src\gui" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtOpenGL" "-IC:\SDK\OpenGL\include" "-IC:\SDK\SDL\SDL-1.2.15\include" "-IC:\SDK\DWARF\libdwarf-VS2015\include" "-IC:\SDK\Elf\libelf-0.8.13\include" "-IC:\SDK\zlib\zlib-1.2.11\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\GeneratedFiles"</Command>\r
     </CustomBuild>\r
+    <CustomBuild Include="..\src\debugger\SaveDumpAsWin.h">\r
+      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>\r
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing %(Identity)...</Message>\r
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>\r
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"  -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -D__GCCWIN32__ -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_OPENGL_LIB -D%(PreprocessorDefinitions) "-I." "-I.\..\src" "-I.\..\src\gui" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtOpenGL" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtWidgets" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtGui" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtANGLE" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtCore" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\mkspecs\win32-msvc2015" "-IC:\SDK\SDL-1.2.15\include" "-IC:\SDK\mesa-11.2.0-rc4\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtOpenGL" "-I.\GeneratedFiles\$(ConfigurationName)" "-I.\GeneratedFiles"</Command>\r
+      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>\r
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Moc%27ing %(Identity)...</Message>\r
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>\r
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"  -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -D__GCCWIN32__ -DQT_OPENGL_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -D%(PreprocessorDefinitions) "-I." "-I.\..\src" "-I.\..\src\gui" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtOpenGL" "-IC:\SDK\SDL\SDL-1.2.15\include" "-IC:\SDK\DWARF\libdwarf-VS2015\include" "-IC:\SDK\Elf\libelf-0.8.13\include" "-IC:\SDK\zlib\zlib-1.2.8\include" "-I.\GeneratedFiles\$(ConfigurationName)" "-IC:\SDK\OpenGL\include" "-I.\GeneratedFiles"</Command>\r
+      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>\r
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing %(Identity)...</Message>\r
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>\r
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"  -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -D__GCCWIN32__ -DQT_NO_DEBUG -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_OPENGL_LIB -D%(PreprocessorDefinitions) "-I." "-I.\..\src" "-I.\..\src\gui" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtOpenGL" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtWidgets" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtGui" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtANGLE" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtCore" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\mkspecs\win32-msvc2015" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtOpenGL" "-I.\GeneratedFiles\$(ConfigurationName)" "-I.\GeneratedFiles"</Command>\r
+      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>\r
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Moc%27ing %(Identity)...</Message>\r
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>\r
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"  -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -D__GCCWIN32__ -DQT_NO_DEBUG -DQT_OPENGL_LIB -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -D%(PreprocessorDefinitions) "-I." "-I.\..\src" "-I.\..\src\gui" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtOpenGL" "-IC:\SDK\OpenGL\include" "-IC:\SDK\SDL\SDL-1.2.15\include" "-IC:\SDK\DWARF\libdwarf-VS2015\include" "-IC:\SDK\Elf\libelf-0.8.13\include" "-IC:\SDK\zlib\zlib-1.2.11\include" "-I.\GeneratedFiles\$(ConfigurationName)" "-I.\GeneratedFiles"</Command>\r
+    </CustomBuild>\r
     <ClInclude Include="..\src\file.h" />\r
     <CustomBuild Include="..\src\gui\keybindingstab.h">\r
       <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing keybindingstab.h...</Message>\r
     <ClInclude Include="..\src\file.h" />\r
     <CustomBuild Include="..\src\gui\keybindingstab.h">\r
       <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing keybindingstab.h...</Message>\r
index 75e8af3..530696e 100644 (file)
     <ClCompile Include="GeneratedFiles\qrc_virtualjaguar.cpp">\r
       <Filter>Generated Files</Filter>\r
     </ClCompile>\r
     <ClCompile Include="GeneratedFiles\qrc_virtualjaguar.cpp">\r
       <Filter>Generated Files</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="GeneratedFiles\Debug\moc_SaveDumpAsWin.cpp">\r
+      <Filter>Generated Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="GeneratedFiles\Release\moc_SaveDumpAsWin.cpp">\r
+      <Filter>Generated Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\src\debugger\SaveDumpAsWin.cpp">\r
+      <Filter>Source Files\debugger</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\src\debugger\DWARFManager.h">\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\src\debugger\DWARFManager.h">\r
     <CustomBuild Include="..\src\debugger\CartFilesListWin.h">\r
       <Filter>Header Files\debugger\View</Filter>\r
     </CustomBuild>\r
     <CustomBuild Include="..\src\debugger\CartFilesListWin.h">\r
       <Filter>Header Files\debugger\View</Filter>\r
     </CustomBuild>\r
+    <CustomBuild Include="..\src\debugger\SaveDumpAsWin.h">\r
+      <Filter>Header Files\debugger</Filter>\r
+    </CustomBuild>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ResourceCompile Include="..\res\vj.rc">\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ResourceCompile Include="..\res\vj.rc">\r
index ba62d4b..c9756bb 100644 (file)
@@ -84,6 +84,7 @@ Git commit: TBD
 46) Fix crash with potential missing DWARF structure tag's type name
 47) Added ELF sections check so a potential unknown section will stop, or not stop, the decoding
 48) Project has switched to QT 5.12.0 library 64bits for VS 2017
 46) Fix crash with potential missing DWARF structure tag's type name
 47) Added ELF sections check so a potential unknown section will stop, or not stop, the decoding
 48) Project has switched to QT 5.12.0 library 64bits for VS 2017
+49) Added a Save Dump As... feature to save a memory zone to a file
 
 Release 3 (13th November 2017)
 ------------------------------
 
 Release 3 (13th November 2017)
 ------------------------------
diff --git a/src/debugger/SaveDumpAsWin.cpp b/src/debugger/SaveDumpAsWin.cpp
new file mode 100644 (file)
index 0000000..abf7cbd
--- /dev/null
@@ -0,0 +1,190 @@
+//
+// SaveDumpAsWin.cpp - Save Dump function
+//
+// by Jean-Paul Mari
+//
+// JPM = Jean-Paul Mari <djipi.mari@gmail.com>
+//
+// Who  When        What
+// ---  ----------  -----------------------------------------------------------
+// JPM  04/10/2019  Created this file
+//
+
+// STILL TO DO:
+//
+
+#include "debugger/SaveDumpAsWin.h"
+#include "jaguar.h"
+#include "debugger/DBGManager.h"
+#include "m68000/m68kinterface.h"
+#include "settings.h"
+
+
+//
+SaveDumpAsWindow::SaveDumpAsWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog),
+layout(new QVBoxLayout),
+maddress(new QLineEdit),
+msize(new QLineEdit),
+savedump(new SaveDumpAsInfo),
+save(new QPushButton(tr("Save")))
+{
+       setWindowTitle(tr("Save Dump As..."));
+
+       maddress->setPlaceholderText("0x<value>, decimal value or symbol name");
+       msize->setPlaceholderText("0x<value>, or decimal value");
+
+       QHBoxLayout * hbox1 = new QHBoxLayout;
+       hbox1->addWidget(maddress);
+       hbox1->addWidget(msize);
+       hbox1->addWidget(save);
+
+       layout->addLayout(hbox1);
+       setLayout(layout);
+
+       connect(save, SIGNAL(clicked()), this, SLOT(SaveDumpAs()));
+}
+
+
+//
+SaveDumpAsWindow::~SaveDumpAsWindow(void)
+{
+}
+
+
+//
+void SaveDumpAsWindow::keyPressEvent(QKeyEvent * e)
+{
+       if (e->key() == Qt::Key_Escape)
+       {
+               hide();
+       }
+       else
+       {
+               if (e->key() == Qt::Key_Return)
+               {
+                       SaveDumpAs();
+               }
+       }
+}
+
+
+// Save Dump
+void SaveDumpAsWindow::SaveDumpAs(void)
+{
+       if (SelectAddress() && SelectSize())
+       {
+               QString fileName = QFileDialog::getSaveFileName(this, tr("Save dump"), "", tr("Save dump files (*.bin)"));
+
+               if (fileName.size())
+               {
+                       if (FILE *File = fopen((char *)fileName.toUtf8().data(), "wb"))
+                       {
+                               if (fwrite((void *)&jagMemSpace[savedump->Adr], savedump->Size, 1, File) == 1)
+                               {
+                                       fclose(File);
+                               }
+                       }
+               }
+       }
+}
+
+
+// Select size
+bool SaveDumpAsWindow::SelectSize(void)
+{
+       bool ok = false;
+       size_t len;
+       QString newSize;
+       size_t s;
+
+       QPalette p = msize->palette();
+       newSize = msize->text();
+
+       if ((len = newSize.size()))
+       {
+               if ((len > 1) && (newSize.at(0) == QChar('0')) && (newSize.at(1) == QChar('x')))
+               {
+                       s = newSize.toUInt(&ok, 16);
+               }
+               else
+               {
+                       s = newSize.toUInt(&ok, 10);
+               }
+
+               // Check validity size
+               if (ok && s && (s < 0xffffff))
+               {
+                       // In all cases, consider size as valid
+                       savedump->Size = s;
+                       p.setColor(QPalette::Text, Qt::darkYellow);
+               }
+               else
+               {
+                       // Size is not valid
+                       ok = false;
+                       p.setColor(QPalette::Text, Qt::red);
+               }
+       }
+       else
+       {
+               // Size has not be set
+               p.setColor(QPalette::Text, Qt::darkRed);
+       }
+
+       msize->setPalette(p);
+       return ok ? true : false;
+}
+
+
+// Select address
+// Address can be an hexa, decimal or a symbol name
+bool SaveDumpAsWindow::SelectAddress(void)
+{
+       bool ok = false;
+       size_t len;
+       QString newAddress;
+       size_t adr;
+
+       QPalette p = maddress->palette();
+       newAddress = maddress->text();
+
+       if ((len = newAddress.size()))
+       {
+               if ((len > 1) && (newAddress.at(0) == QChar('0')) && (newAddress.at(1) == QChar('x')))
+               {
+                       adr = newAddress.toUInt(&ok, 16);
+               }
+               else
+               {
+                       if (!(adr = DBGManager_GetAdrFromSymbolName(newAddress.toLatin1().data())))
+                       {
+                               adr = newAddress.toUInt(&ok, 10);
+                       }
+                       else
+                       {
+                               ok = true;
+                       }
+               }
+
+               // Check validity address
+               if (ok && (adr < 0xffffff))
+               {
+                       // In all cases, consider address as valid
+                       savedump->Adr = adr;
+                       p.setColor(QPalette::Text, Qt::darkYellow);
+               }
+               else
+               {
+                       // Address is not valid
+                       p.setColor(QPalette::Text, Qt::red);
+               }
+       }
+       else
+       {
+               // Address has not be set
+               p.setColor(QPalette::Text, Qt::darkRed);
+       }
+
+       maddress->setPalette(p);
+       return ok ? true : false;
+}
diff --git a/src/debugger/SaveDumpAsWin.h b/src/debugger/SaveDumpAsWin.h
new file mode 100644 (file)
index 0000000..3a755ed
--- /dev/null
@@ -0,0 +1,46 @@
+//
+// SaveDumpAsWin.h: Save Dump function
+//
+// by Jean-Paul Mari
+//
+
+#ifndef __SAVEDUMPASWIN_H__
+#define __SAVEDUMPASWIN_H__
+
+#include <QtWidgets>
+#include <stdint.h>
+
+class SaveDumpAsWindow : public QWidget
+{
+       Q_OBJECT
+
+       typedef struct SaveDumpAsInfo
+       {
+               size_t Size;
+               size_t Adr;
+       }
+       S_SaveDumpAsInfo;
+
+       public:
+               SaveDumpAsWindow(QWidget * parent = 0);
+               ~SaveDumpAsWindow(void);
+
+       protected:
+               void keyPressEvent(QKeyEvent *);
+
+       protected slots:
+               void SaveDumpAs(void);
+
+       private:
+               bool SelectAddress(void);
+               bool SelectSize(void);
+
+       private:
+               QVBoxLayout *layout;
+               QLineEdit *maddress;
+               QLineEdit *msize;
+               QPushButton *save;
+               SaveDumpAsInfo *savedump;
+};
+
+#endif // __SAVEDUMPASWIN_H__
index 1b547e2..0c3ec45 100644 (file)
@@ -22,7 +22,7 @@
 // JPM  Sept./2018  Added the new Models and BIOS handler, a screenshot feature and source code files browsing\r
 // JPM   Oct./2018  Added search paths in the settings, breakpoints feature, cartdridge view menu\r
 // JPM  11/18/2018  Fix crash with non-debugger mode\r
 // JPM  Sept./2018  Added the new Models and BIOS handler, a screenshot feature and source code files browsing\r
 // JPM   Oct./2018  Added search paths in the settings, breakpoints feature, cartdridge view menu\r
 // JPM  11/18/2018  Fix crash with non-debugger mode\r
-// JPM  04/06/2019  Added ELF sections check\r
+// JPM  April/2019  Added ELF sections check, added a save memory dump\r
 //\r
 \r
 // FIXED:\r
 //\r
 \r
 // FIXED:\r
 #include "debugger/heapallocatorbrowser.h"\r
 #include "debugger/callstackbrowser.h"\r
 #include "debugger/CartFilesListWin.h"\r
 #include "debugger/heapallocatorbrowser.h"\r
 #include "debugger/callstackbrowser.h"\r
 #include "debugger/CartFilesListWin.h"\r
+#include "debugger/SaveDumpAsWin.h"\r
 \r
 \r
 // According to SebRmv, this header isn't seen on Arch Linux either... :-/\r
 \r
 \r
 // According to SebRmv, this header isn't seen on Arch Linux either... :-/\r
@@ -200,6 +201,7 @@ MainWin::MainWin(bool autoRun): running(true), powerButtonOn(false),
                heapallocatorBrowseWin = new HeapAllocatorBrowserWindow(this);\r
                BreakpointsWin = new BreakpointsWindow(this);\r
                NewFunctionBreakpointWin = new NewFnctBreakpointWindow(this);\r
                heapallocatorBrowseWin = new HeapAllocatorBrowserWindow(this);\r
                BreakpointsWin = new BreakpointsWindow(this);\r
                NewFunctionBreakpointWin = new NewFnctBreakpointWindow(this);\r
+               SaveDumpAsWin = new SaveDumpAsWindow(this);\r
                exceptionvectortableBrowseWin = new ExceptionVectorTableBrowserWindow(this);\r
                CallStackBrowseWin = new CallStackBrowserWindow(this);\r
                CartFilesListWin = new CartFilesListWindow(this);\r
                exceptionvectortableBrowseWin = new ExceptionVectorTableBrowserWindow(this);\r
                CallStackBrowseWin = new CallStackBrowserWindow(this);\r
                CartFilesListWin = new CartFilesListWindow(this);\r
@@ -418,6 +420,12 @@ MainWin::MainWin(bool autoRun): running(true), powerButtonOn(false),
                disableAllBreakpointsAct = new QAction(QIcon(":/res/debug-disableallbreakpoints.png"), tr("&Disable All Breakpoints"), this);\r
                connect(disableAllBreakpointsAct, SIGNAL(triggered()), this, SLOT(DisableAllBreakpoints()));\r
 \r
                disableAllBreakpointsAct = new QAction(QIcon(":/res/debug-disableallbreakpoints.png"), tr("&Disable All Breakpoints"), this);\r
                connect(disableAllBreakpointsAct, SIGNAL(triggered()), this, SLOT(DisableAllBreakpoints()));\r
 \r
+               // Save dump\r
+               saveDumpAsAct = new QAction(tr("&Save Dump As..."), this);\r
+               saveDumpAsAct->setCheckable(false);\r
+               saveDumpAsAct->setDisabled(false);\r
+               connect(saveDumpAsAct, SIGNAL(triggered()), this, SLOT(ShowSaveDumpAsWin()));\r
+\r
                //VideoOutputAct = new QAction(tr("Output Video"), this);\r
                //VideoOutputAct->setStatusTip(tr("Shows the output video window"));\r
                //connect(VideoOutputAct, SIGNAL(triggered()), this, SLOT(ShowVideoOutputWin()));\r
                //VideoOutputAct = new QAction(tr("Output Video"), this);\r
                //VideoOutputAct->setStatusTip(tr("Shows the output video window"));\r
                //connect(VideoOutputAct, SIGNAL(triggered()), this, SLOT(ShowVideoOutputWin()));\r
@@ -588,6 +596,8 @@ MainWin::MainWin(bool autoRun): running(true), powerButtonOn(false),
                        debugNewBreakpointMenu->addAction(newFunctionBreakpointAct);\r
                        debugMenu->addAction(deleteAllBreakpointsAct);\r
                        debugMenu->addAction(disableAllBreakpointsAct);\r
                        debugNewBreakpointMenu->addAction(newFunctionBreakpointAct);\r
                        debugMenu->addAction(deleteAllBreakpointsAct);\r
                        debugMenu->addAction(disableAllBreakpointsAct);\r
+                       debugMenu->addSeparator();\r
+                       debugMenu->addAction(saveDumpAsAct);\r
 #if 0\r
                        debugMenu->addSeparator();\r
                        debugMenu->addAction(DasmAct);\r
 #if 0\r
                        debugMenu->addSeparator();\r
                        debugMenu->addAction(DasmAct);\r
@@ -1515,7 +1525,7 @@ void MainWin::ShowNewFunctionBreakpointWin(void)
 }\r
 \r
 \r
 }\r
 \r
 \r
-// \r
+// Display list of files found in cartdridge\r
 void MainWin::ShowCartFilesListWin(void)\r
 {\r
        CartFilesListWin->show();\r
 void MainWin::ShowCartFilesListWin(void)\r
 {\r
        CartFilesListWin->show();\r
@@ -1523,6 +1533,13 @@ void MainWin::ShowCartFilesListWin(void)
 }\r
 \r
 \r
 }\r
 \r
 \r
+//\r
+void MainWin::ShowSaveDumpAsWin(void)\r
+{\r
+       SaveDumpAsWin->show();\r
+}\r
+\r
+\r
 // Step Into trace\r
 void MainWin::DebuggerTraceStepInto(void)\r
 {\r
 // Step Into trace\r
 void MainWin::DebuggerTraceStepInto(void)\r
 {\r
@@ -2058,13 +2075,20 @@ void MainWin::ReadUISettings(void)
                size = settings.value("CallStackBrowseWinSize", QSize(400, 400)).toSize();\r
                CallStackBrowseWin->resize(size);\r
 \r
                size = settings.value("CallStackBrowseWinSize", QSize(400, 400)).toSize();\r
                CallStackBrowseWin->resize(size);\r
 \r
-               // Cartdridge directory and files\r
+               // Cartdridge directory and files UI information\r
                pos = settings.value("CartFilesListWinPos", QPoint(200, 200)).toPoint();\r
                CartFilesListWin->move(pos);\r
                settings.value("CartFilesListWinIsVisible", false).toBool() ? ShowCartFilesListWin() : void();\r
                size = settings.value("CartFilesListWinSize", QSize(400, 400)).toSize();\r
                CartFilesListWin->resize(size);\r
 \r
                pos = settings.value("CartFilesListWinPos", QPoint(200, 200)).toPoint();\r
                CartFilesListWin->move(pos);\r
                settings.value("CartFilesListWinIsVisible", false).toBool() ? ShowCartFilesListWin() : void();\r
                size = settings.value("CartFilesListWinSize", QSize(400, 400)).toSize();\r
                CartFilesListWin->resize(size);\r
 \r
+               // Save dump UI information\r
+               pos = settings.value("SaveDumpAsWinPos", QPoint(200, 200)).toPoint();\r
+               SaveDumpAsWin->move(pos);\r
+               settings.value("SaveDumpAsWinIsVisible", false).toBool() ? ShowSaveDumpAsWin() : void();\r
+               size = settings.value("SaveDumpAsWinSize", QSize(400, 400)).toSize();\r
+               SaveDumpAsWin->resize(size);\r
+\r
                // Breakpoints UI information\r
                pos = settings.value("BreakpointsWinPos", QPoint(200, 200)).toPoint();\r
                BreakpointsWin->move(pos);\r
                // Breakpoints UI information\r
                pos = settings.value("BreakpointsWinPos", QPoint(200, 200)).toPoint();\r
                BreakpointsWin->move(pos);\r
@@ -2288,6 +2312,9 @@ void MainWin::WriteUISettings(void)
                settings.setValue("CartFilesListWinPos", CartFilesListWin->pos());\r
                settings.setValue("CartFilesListWinIsVisible", CartFilesListWin->isVisible());\r
                settings.setValue("CartFilesListWinSize", CartFilesListWin->size());\r
                settings.setValue("CartFilesListWinPos", CartFilesListWin->pos());\r
                settings.setValue("CartFilesListWinIsVisible", CartFilesListWin->isVisible());\r
                settings.setValue("CartFilesListWinSize", CartFilesListWin->size());\r
+               settings.setValue("SaveDumpAsWinPos", SaveDumpAsWin->pos());\r
+               settings.setValue("SaveDumpAsWinIsVisible", SaveDumpAsWin->isVisible());\r
+               settings.setValue("SaveDumpAsWinSize", SaveDumpAsWin->size());\r
 \r
                for (i = 0; i < vjs.nbrmemory1browserwindow; i++)\r
                {\r
 \r
                for (i = 0; i < vjs.nbrmemory1browserwindow; i++)\r
                {\r
index e0aa8d1..849b0cc 100644 (file)
@@ -48,6 +48,7 @@ class NewFnctBreakpointWindow;
 class ExceptionVectorTableBrowserWindow;\r
 class FilesrcListWindow;\r
 class CartFilesListWindow;\r
 class ExceptionVectorTableBrowserWindow;\r
 class FilesrcListWindow;\r
 class CartFilesListWindow;\r
+class SaveDumpAsWindow;\r
 \r
 \r
 // \r
 \r
 \r
 // \r
@@ -108,6 +109,7 @@ class MainWin: public QMainWindow
                void ShowBreakpointsWin(void);\r
                void DeleteAllBreakpoints(void);\r
                void DisableAllBreakpoints(void);\r
                void ShowBreakpointsWin(void);\r
                void DeleteAllBreakpoints(void);\r
                void DisableAllBreakpoints(void);\r
+               void ShowSaveDumpAsWin(void);\r
 #if 0\r
                void ShowVideoOutputWin(void);\r
                void ShowDasmWin(void);\r
 #if 0\r
                void ShowVideoOutputWin(void);\r
                void ShowDasmWin(void);\r
@@ -162,6 +164,7 @@ class MainWin: public QMainWindow
                BreakpointsWindow *BreakpointsWin;\r
                NewFnctBreakpointWindow *NewFunctionBreakpointWin;\r
                CartFilesListWindow *CartFilesListWin;\r
                BreakpointsWindow *BreakpointsWin;\r
                NewFnctBreakpointWindow *NewFunctionBreakpointWin;\r
                CartFilesListWindow *CartFilesListWin;\r
+               SaveDumpAsWindow *SaveDumpAsWin;\r
                QTimer *timer;\r
                bool running;\r
                int zoomLevel;\r
                QTimer *timer;\r
                bool running;\r
                int zoomLevel;\r
@@ -244,6 +247,7 @@ class MainWin: public QMainWindow
                QAction *BreakpointsAct;\r
                QAction *deleteAllBreakpointsAct;\r
                QAction *disableAllBreakpointsAct;\r
                QAction *BreakpointsAct;\r
                QAction *deleteAllBreakpointsAct;\r
                QAction *disableAllBreakpointsAct;\r
+               QAction *saveDumpAsAct;\r
                QAction *exceptionVectorTableBrowseAct;\r
                QAction *CartFilesListAct;\r
 \r
                QAction *exceptionVectorTableBrowseAct;\r
                QAction *CartFilesListAct;\r
 \r
index d7e70de..19bd96a 100644 (file)
@@ -127,6 +127,7 @@ HEADERS = \
        src/debugger/exceptionvectortablebrowser.h \\r
        src/debugger/NewFnctBreakpointWin.h \\r
        src/debugger/CartFilesListWin.h \\r
        src/debugger/exceptionvectortablebrowser.h \\r
        src/debugger/NewFnctBreakpointWin.h \\r
        src/debugger/CartFilesListWin.h \\r
+       src/debugger/SaveDumpAsWin.h \\r
        src/log.h \\r
        src/unzip.h \\r
        src/crc32.h \\r
        src/log.h \\r
        src/unzip.h \\r
        src/crc32.h \\r
@@ -181,6 +182,7 @@ SOURCES = \
        src/debugger/callstackbrowser.cpp \\r
        src/debugger/NewFnctBreakpointWin.cpp \\r
        src/debugger/CartFilesListWin.cpp \\r
        src/debugger/callstackbrowser.cpp \\r
        src/debugger/NewFnctBreakpointWin.cpp \\r
        src/debugger/CartFilesListWin.cpp \\r
+       src/debugger/SaveDumpAsWin.cpp \\r
        src/log.cpp \\r
        src/unzip.cpp \\r
        src/crc32.cpp \\r
        src/log.cpp \\r
        src/unzip.cpp \\r
        src/crc32.cpp \\r