Added ELF sections check so a potential unknown section will stop, or not stop, the...
authorJean-Paul Mari <djipi.mari@gmail.com>
Thu, 11 Apr 2019 01:37:56 +0000 (21:37 -0400)
committerJean-Paul Mari <djipi.mari@gmail.com>
Thu, 11 Apr 2019 01:37:56 +0000 (21:37 -0400)
docs/vj_HistoryNotes.txt
src/debugger/DWARFManager.cpp
src/debugger/debuggertab.cpp
src/debugger/debuggertab.h
src/file.cpp
src/gui/mainwin.cpp
src/settings.h

index d3e65c2..a12910d 100644 (file)
@@ -82,6 +82,7 @@ Git commit: TBD
 44) Debugger sources code clean-up
 45) Fix a crash when emulator, in non-debugger mode, opens the breakpoint UIs at launch
 46) Fix crash with potential missing DWARF structure tag's type name
 44) Debugger sources code clean-up
 45) Fix a crash when emulator, in non-debugger mode, opens the breakpoint UIs at launch
 46) Fix crash with potential missing DWARF structure tag's type name
+47) Added ELF sections check so a potential unknown section won't stop the reading
 
 Release 3 (13th November 2017)
 ------------------------------
 
 Release 3 (13th November 2017)
 ------------------------------
index acfe387..fed680a 100644 (file)
@@ -28,7 +28,7 @@
 \r
 \r
 // Definitions for debugging\r
 \r
 \r
 // Definitions for debugging\r
-//#define DEBUG_NumCU                  0x                            // CU number to debug or undefine it\r
+//#define DEBUG_NumCU                  0x4d                            // CU number to debug or undefine it\r
 //#define DEBUG_VariableName   "sound_death"                           // Variable name to look for or undefine it\r
 //#define DEBUG_TypeName               "Cbuf_Execute"                  // Type name to look for or undefine it\r
 //#define DEBUG_TypeDef                        DW_TAG_typedef          // Type def to look for or undefine it (not supported)\r
 //#define DEBUG_VariableName   "sound_death"                           // Variable name to look for or undefine it\r
 //#define DEBUG_TypeName               "Cbuf_Execute"                  // Type name to look for or undefine it\r
 //#define DEBUG_TypeDef                        DW_TAG_typedef          // Type def to look for or undefine it (not supported)\r
index d6135e8..0b4bd46 100644 (file)
@@ -9,6 +9,7 @@
 // ---  ----------  ------------------------------------------------------------\r
 // JPM  Sept./2016  Created this file, and added Soft debugger support\r
 // JPM  10/09/2018  Added source file search paths\r
 // ---  ----------  ------------------------------------------------------------\r
 // JPM  Sept./2016  Created this file, and added Soft debugger support\r
 // JPM  10/09/2018  Added source file search paths\r
+// JPM  04/06/2019  Added ELF sections check\r
 //\r
 \r
 #include "debuggertab.h"\r
 //\r
 \r
 #include "debuggertab.h"\r
@@ -52,13 +53,16 @@ DebuggerTab::DebuggerTab(QWidget * parent/*= 0*/): QWidget(parent)
        displayHWlabels = new QCheckBox(tr("Display HW labels"));\r
        disasmopcodes   = new QCheckBox(tr("Display M68000 opcodes"));\r
        displayFullSourceFilename = new QCheckBox(tr("Display source filename"));\r
        displayHWlabels = new QCheckBox(tr("Display HW labels"));\r
        disasmopcodes   = new QCheckBox(tr("Display M68000 opcodes"));\r
        displayFullSourceFilename = new QCheckBox(tr("Display source filename"));\r
+       ELFSectionsCheck = new QCheckBox(tr("ELF sections check"));\r
        disasmopcodes->setDisabled(false);\r
        displayHWlabels->setDisabled(false);\r
        displayFullSourceFilename->setDisabled(false);\r
        disasmopcodes->setDisabled(false);\r
        displayHWlabels->setDisabled(false);\r
        displayFullSourceFilename->setDisabled(false);\r
+       ELFSectionsCheck->setDisabled(false);\r
 \r
        layout4->addWidget(disasmopcodes);\r
        layout4->addWidget(displayHWlabels);\r
        layout4->addWidget(displayFullSourceFilename);\r
 \r
        layout4->addWidget(disasmopcodes);\r
        layout4->addWidget(displayHWlabels);\r
        layout4->addWidget(displayFullSourceFilename);\r
+       layout4->addWidget(ELFSectionsCheck);\r
 \r
        setLayout(layout4);\r
 }\r
 \r
        setLayout(layout4);\r
 }\r
@@ -81,6 +85,7 @@ void DebuggerTab::SetSettings(void)
        vjs.displayHWlabels = displayHWlabels->isChecked();\r
        vjs.disasmopcodes = disasmopcodes->isChecked();\r
        vjs.displayFullSourceFilename = displayFullSourceFilename->isChecked();\r
        vjs.displayHWlabels = displayHWlabels->isChecked();\r
        vjs.disasmopcodes = disasmopcodes->isChecked();\r
        vjs.displayFullSourceFilename = displayFullSourceFilename->isChecked();\r
+       vjs.ELFSectionsCheck = ELFSectionsCheck->isChecked();\r
 }\r
 \r
 \r
 }\r
 \r
 \r
@@ -93,6 +98,7 @@ void DebuggerTab::GetSettings(void)
        displayHWlabels->setChecked(vjs.displayHWlabels);\r
        disasmopcodes->setChecked(vjs.disasmopcodes);\r
        displayFullSourceFilename->setChecked(vjs.displayFullSourceFilename);\r
        displayHWlabels->setChecked(vjs.displayHWlabels);\r
        disasmopcodes->setChecked(vjs.disasmopcodes);\r
        displayFullSourceFilename->setChecked(vjs.displayFullSourceFilename);\r
+       ELFSectionsCheck->setChecked(vjs.ELFSectionsCheck);\r
 }\r
 \r
 \r
 }\r
 \r
 \r
index f9e1b8a..583dd30 100644 (file)
@@ -5,6 +5,7 @@
 // ---  ----------  ------------------------------------------------------------\r
 // JPM  Sept./2016  Created this file, and added Soft debugger support\r
 // JPM  10/09/2018  Added the source file search paths\r
 // ---  ----------  ------------------------------------------------------------\r
 // JPM  Sept./2016  Created this file, and added Soft debugger support\r
 // JPM  10/09/2018  Added the source file search paths\r
+// JPM  04/06/2019  Added ELF sections check\r
 //\r
 \r
 #ifndef __DEBUGGERTAB_H__\r
 //\r
 \r
 #ifndef __DEBUGGERTAB_H__\r
@@ -31,6 +32,7 @@ class DebuggerTab: public QWidget
                QCheckBox *displayHWlabels;\r
                QCheckBox *disasmopcodes;\r
                QCheckBox *displayFullSourceFilename;\r
                QCheckBox *displayHWlabels;\r
                QCheckBox *disasmopcodes;\r
                QCheckBox *displayFullSourceFilename;\r
+               QCheckBox *ELFSectionsCheck;\r
 };\r
 \r
 #endif // __DEBUGGERTAB_H__\r
 };\r
 \r
 #endif // __DEBUGGERTAB_H__\r
index c1cf88a..a296bd0 100644 (file)
 // Who  When        What\r
 // ---  ----------  ------------------------------------------------------------\r
 // JLH  01/16/2010  Created this log ;-)\r
 // Who  When        What\r
 // ---  ----------  ------------------------------------------------------------\r
 // JLH  01/16/2010  Created this log ;-)\r
-// JLH  02/28/2010  Added functions to look inside .ZIP files and handle\r
-//                  contents\r
+// JLH  02/28/2010  Added functions to look inside .ZIP files and handle contents\r
 // JLH  06/01/2012  Added function to check ZIP file CRCs against file DB\r
 // JLH  06/01/2012  Added function to check ZIP file CRCs against file DB\r
-// JPM  06/06/2016  Visual Studio support\r
-// JPM  06/15/2016  ELF format support\r
-// JPM  06/19/2016  Soft debugger support\r
+// JPM   June/2016  Visual Studio support, ELF format support and Soft debugger support\r
 // JPM  07/15/2016  DWARF format support\r
 // JPM  07/15/2016  DWARF format support\r
+// JPM  04/06/2019  Added ELF sections check\r
 //\r
 \r
 #include "file.h"\r
 //\r
 \r
 #include "file.h"\r
@@ -40,6 +38,7 @@
 #include "libdwarf.h"\r
 #include "debugger/ELFManager.h"\r
 #include "debugger/DBGManager.h"\r
 #include "libdwarf.h"\r
 #include "debugger/ELFManager.h"\r
 #include "debugger/DBGManager.h"\r
+#include "settings.h"\r
 \r
 \r
 // Private function prototypes\r
 \r
 \r
 // Private function prototypes\r
@@ -222,11 +221,11 @@ WriteLog("FILE: Cartridge run address is reported as $%X...\n", jaguarRunAddress
                                                        else\r
                                                        {\r
                                                                NameSection = elf_strptr(ElfMem, PtrGElfEhdr->e_shstrndx, (size_t)PtrGElfShdr->sh_name);\r
                                                        else\r
                                                        {\r
                                                                NameSection = elf_strptr(ElfMem, PtrGElfEhdr->e_shstrndx, (size_t)PtrGElfShdr->sh_name);\r
-                                                               WriteLog("FILE: ELF Section name: %s\n", NameSection);\r
+                                                               WriteLog("FILE: ELF Section %s found\n", NameSection);\r
 \r
 \r
-                                                               if ((ElfSectionNameType = ELFManager_GetSectionType(NameSection)) == ELF_NO_TYPE)\r
+                                                               if (((ElfSectionNameType = ELFManager_GetSectionType(NameSection)) == ELF_NO_TYPE) && vjs.ELFSectionsCheck)\r
                                                                {\r
                                                                {\r
-                                                                       WriteLog("FILE: ELF Section not listed\n");\r
+                                                                       WriteLog("FILE: ELF Section %s not recognized\n", NameSection);\r
                                                                        error = true;\r
                                                                }\r
                                                                else\r
                                                                        error = true;\r
                                                                }\r
                                                                else\r
index a941d48..1b547e2 100644 (file)
@@ -22,6 +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
 //\r
 \r
 // FIXED:\r
 //\r
 \r
 // FIXED:\r
@@ -1846,6 +1847,7 @@ void MainWin::ReadSettings(void)
        vjs.disasmopcodes = settings.value("DisasmOpcodes", true).toBool();\r
        vjs.displayHWlabels = settings.value("DisplayHWLabels", true).toBool();\r
        vjs.displayFullSourceFilename = settings.value("displayFullSourceFilename", true).toBool();\r
        vjs.disasmopcodes = settings.value("DisasmOpcodes", true).toBool();\r
        vjs.displayHWlabels = settings.value("DisplayHWLabels", true).toBool();\r
        vjs.displayFullSourceFilename = settings.value("displayFullSourceFilename", true).toBool();\r
+       vjs.ELFSectionsCheck = settings.value("ELFSectionsCheck", false).toBool();\r
        vjs.nbrmemory1browserwindow = settings.value("NbrMemory1BrowserWindow", MaxMemory1BrowserWindow).toUInt();\r
        settings.endGroup();\r
 \r
        vjs.nbrmemory1browserwindow = settings.value("NbrMemory1BrowserWindow", MaxMemory1BrowserWindow).toUInt();\r
        settings.endGroup();\r
 \r
@@ -2149,6 +2151,7 @@ void MainWin::WriteSettings(void)
        settings.setValue("NbrDisasmLines", vjs.nbrdisasmlines);\r
        settings.setValue("DisasmOpcodes", vjs.disasmopcodes);\r
        settings.setValue("displayFullSourceFilename", vjs.displayFullSourceFilename);\r
        settings.setValue("NbrDisasmLines", vjs.nbrdisasmlines);\r
        settings.setValue("DisasmOpcodes", vjs.disasmopcodes);\r
        settings.setValue("displayFullSourceFilename", vjs.displayFullSourceFilename);\r
+       settings.setValue("ELFSectionsCheck", vjs.ELFSectionsCheck);\r
        settings.setValue("NbrMemory1BrowserWindow", (unsigned int)vjs.nbrmemory1browserwindow);\r
        settings.setValue("DefaultROM", vjs.debuggerROMPath);\r
        settings.setValue("SourceFileSearchPaths", vjs.sourcefilesearchPaths);\r
        settings.setValue("NbrMemory1BrowserWindow", (unsigned int)vjs.nbrmemory1browserwindow);\r
        settings.setValue("DefaultROM", vjs.debuggerROMPath);\r
        settings.setValue("SourceFileSearchPaths", vjs.sourcefilesearchPaths);\r
index e81d57d..8b7ca16 100644 (file)
@@ -7,7 +7,8 @@
 // ---  ----------  ------------------------------------------------------------\r
 // JPM  06/19/2016  Soft debugger support\r
 // JPM  Sept./2018  Added the new Models and BIOS handler, and a screenshot settings\r
 // ---  ----------  ------------------------------------------------------------\r
 // JPM  06/19/2016  Soft debugger support\r
 // JPM  Sept./2018  Added the new Models and BIOS handler, and a screenshot settings\r
-// JPM  10/10/2018  Added search paths in settings \r
+// JPM  10/10/2018  Added search paths in settings\r
+// JPM  04/06/2019  Added ELF sections check\r
 //\r
 \r
 #ifndef __SETTINGS_H__\r
 //\r
 \r
 #ifndef __SETTINGS_H__\r
@@ -83,6 +84,7 @@ struct VJSettings
        bool displayHWlabels;\r
        bool useFastBlitter;\r
        bool displayFullSourceFilename;\r
        bool displayHWlabels;\r
        bool useFastBlitter;\r
        bool displayFullSourceFilename;\r
+       bool ELFSectionsCheck;\r
        size_t nbrmemory1browserwindow;                                                         // Number of memory browser windows\r
        size_t DRAM_size;                                                                                       // DRAM size\r
 \r
        size_t nbrmemory1browserwindow;                                                         // Number of memory browser windows\r
        size_t DRAM_size;                                                                                       // DRAM size\r
 \r