From: Jean-Paul Mari Date: Fri, 21 Aug 2020 12:56:18 +0000 (-0400) Subject: Added a source code file date check when reading DWARF information X-Git-Tag: v2.1.3-R5^2~34 X-Git-Url: http://git.hcoop.net/clinton/Virtual-Jaguar-Rx.git/commitdiff_plain/009df4d72576516c0bd57440cddf6a2e7063bccd Added a source code file date check when reading DWARF information --- diff --git a/docs/vj_HistoryNotes.txt b/docs/vj_HistoryNotes.txt index f8c3fb4..8151a17 100644 --- a/docs/vj_HistoryNotes.txt +++ b/docs/vj_HistoryNotes.txt @@ -14,12 +14,13 @@ Release 5 (TBA) 7) Fix a random crash when reading the source lines information 8) Added ELF & DWARF .debug* types 9) Added ELF section types check and new error messages -10) Project has switched to libdwarf 20191104 library 64bits for VS 2017 -11) Modified the call stack layout window and added source filename from the called source line -12) Added a source tab in the main window for step into tracing -13) Added the step over for source level tracing -14) Project has switched to libdwarf 20200114 library 64bits for VS 2017 -15) Set text conversion to Qt/HTML format for the M68K tracing window +10) Modified the call stack layout window and added source filename from the called source line +11) Added a source tab in the main window for step into tracing +12) Added the step over for source level tracing +13) Project has switched to libdwarf 20200114 library 64bits for VS 2017 +14) Set text conversion to Qt/HTML format for the M68K tracing window +15) Added a source code file date check when reading DWARF information +-- Will avoid source code mismatching with the ELF executable Release 4a (15th August 2019) ----------------------------- diff --git a/src/debugger/DBGManager.cpp b/src/debugger/DBGManager.cpp index f401c4a..28d1ffe 100644 --- a/src/debugger/DBGManager.cpp +++ b/src/debugger/DBGManager.cpp @@ -214,11 +214,11 @@ size_t DBGManager_GetType(void) // Get source filename based on the memeory address // return NULL if no source filename -char *DBGManager_GetFullSourceFilenameFromAdr(size_t Adr, bool *Error) +char *DBGManager_GetFullSourceFilenameFromAdr(size_t Adr, DBGstatus *Status) { if ((DBGType & DBG_ELFDWARF)) { - return DWARFManager_GetFullSourceFilenameFromAdr(Adr, Error); + return DWARFManager_GetFullSourceFilenameFromAdr(Adr, (DWARFstatus *)Status); } else { diff --git a/src/debugger/DBGManager.h b/src/debugger/DBGManager.h index 09cabc1..5695eb0 100644 --- a/src/debugger/DBGManager.h +++ b/src/debugger/DBGManager.h @@ -4,6 +4,16 @@ #define __DBGMANAGER_H__ +// Definition for the DWARF status of each source file +typedef enum +{ + DBGSTATUS_OK = 0x0, + DBGSTATUS_OUTDATEDFILE = 0x1, + DBGSTATUS_NOFILE = 0x2, + DBGSTATUS_NOFILEINFO = 0x4, + DBGSTATUS_UNKNOWN = 0xff +}DBGstatus; + // Language tag based in the DW_TAG_... list from the dwarf.h typedef enum { DBG_NO_LANG = 0x0, @@ -260,7 +270,7 @@ extern char *DBGManager_GetSymbolNameFromAdr(size_t Adr); extern size_t DBGManager_GetAdrFromSymbolName(char *SymbolName); // Source text files manager -extern char *DBGManager_GetFullSourceFilenameFromAdr(size_t Adr, bool *Error); +extern char *DBGManager_GetFullSourceFilenameFromAdr(size_t Adr, DBGstatus *Status); extern char *DBGManager_GetNumFullSourceFilename(size_t Index); extern char *DBGManager_GetNumSourceFilename(size_t Index); diff --git a/src/debugger/DWARFManager.cpp b/src/debugger/DWARFManager.cpp index 130342a..e0e07b9 100644 --- a/src/debugger/DWARFManager.cpp +++ b/src/debugger/DWARFManager.cpp @@ -12,6 +12,7 @@ // JPM Oct./2018 Improve the DWARF parsing information, and the source file text reading; support the used source lines from DWARF structure, and the search paths for the files // JPM Aug./2019 Added new functions to handle DWARF information, full filename fix // JPM Mar./2020 Fix a random crash when reading the source lines information +// JPM Aug./2020 Added a source code file date check when reading DWARF information // // To Do @@ -23,9 +24,13 @@ #include #include #include -#include -#include +#include +#include +#include +#include "libdwarf.h" +#include "dwarf.h" #include "LEB128.h" +#include "DWARFManager.h" // Definitions for debugging @@ -131,7 +136,7 @@ typedef struct CUStruct size_t Tag; size_t Language; // Language (C, etc.) used by the source code size_t LowPC, HighPC; // Memory range for the code - char *PtrProducer; // Pointer to the "Producer" text information (mostly compiler and compilation options used) + char *PtrProducer; // "Producer" text information (mostly compiler and compilation options used) char *PtrSourceFilename; // Source file name char *PtrSourceFileDirectory; // Directory of the source file char *PtrFullFilename; // Pointer to full namefile (directory & filename) @@ -151,6 +156,8 @@ typedef struct CUStruct CUStruct_LineSrc *PtrUsedLinesSrc; // Pointer to the used source lines list structure char **PtrUsedLinesLoadSrc; // Pointer lists to each used source line referenced by the CUStruct_LineSrc structure size_t *PtrUsedNumLines; // List of the number lines used + struct _stat _statbuf; // File information + DWARFstatus Status; // File status }S_CUStruct; @@ -163,6 +170,7 @@ Dwarf_Debug dbg; CUStruct *PtrCU; char **ListSearchPaths; size_t NbSearchPaths; +struct _stat FileElfExeInfo; // @@ -242,10 +250,11 @@ bool DWARFManager_Close(void) // Dwarf manager Elf init -int DWARFManager_ElfInit(Elf *ElfPtr) +int DWARFManager_ElfInit(Elf *ElfPtr, struct _stat FileElfInfo) { if ((LibDwarf = dwarf_elf_init(ElfPtr, DW_DLC_READ, (Dwarf_Handler)DWARFManager_ErrorHandler, errarg, &dbg, &error)) == DW_DLV_OK) { + FileElfExeInfo = FileElfInfo; DWARFManager_InitDMI(); } @@ -525,65 +534,88 @@ void DWARFManager_InitDMI(void) strcpy((Ptr1 + 1), (Ptr + 4)); } - // Open the source file as a binary file - if (!fopen_s(&SrcFile, PtrCU[NbCU].PtrFullFilename, "rb")) + // Get the source file information + if (!_stat(PtrCU[NbCU].PtrFullFilename, &PtrCU[NbCU]._statbuf)) { - if (!fseek(SrcFile, 0, SEEK_END)) + // check the time stamp with the executable + if (PtrCU[NbCU]._statbuf.st_mtime <= FileElfExeInfo.st_mtime) { - if ((PtrCU[NbCU].SizeLoadSrc = ftell(SrcFile)) > 0) + // Open the source file as a binary file + if (!fopen_s(&SrcFile, PtrCU[NbCU].PtrFullFilename, "rb")) { - if (!fseek(SrcFile, 0, SEEK_SET)) + if (!fseek(SrcFile, 0, SEEK_END)) { - if (PtrCU[NbCU].PtrLoadSrc = Ptr = Ptr1 = (char *)calloc(1, (PtrCU[NbCU].SizeLoadSrc + 2))) + if ((PtrCU[NbCU].SizeLoadSrc = ftell(SrcFile)) > 0) { - // Read whole file - if (fread_s(PtrCU[NbCU].PtrLoadSrc, PtrCU[NbCU].SizeLoadSrc, PtrCU[NbCU].SizeLoadSrc, 1, SrcFile) != 1) - { - free(PtrCU[NbCU].PtrLoadSrc); - PtrCU[NbCU].PtrLoadSrc = NULL; - PtrCU[NbCU].SizeLoadSrc = 0; - } - else + if (!fseek(SrcFile, 0, SEEK_SET)) { - // Eliminate all carriage return code '\r' (oxd) - do + if (PtrCU[NbCU].PtrLoadSrc = Ptr = Ptr1 = (char *)calloc(1, (PtrCU[NbCU].SizeLoadSrc + 2))) { - if ((*Ptr = *Ptr1) != '\r') + // Read whole file + if (fread_s(PtrCU[NbCU].PtrLoadSrc, PtrCU[NbCU].SizeLoadSrc, PtrCU[NbCU].SizeLoadSrc, 1, SrcFile) != 1) { - Ptr++; + free(PtrCU[NbCU].PtrLoadSrc); + PtrCU[NbCU].PtrLoadSrc = NULL; + PtrCU[NbCU].SizeLoadSrc = 0; } - } - while (*Ptr1++); + else + { + // Eliminate all carriage return code '\r' (oxd) + do + { + if ((*Ptr = *Ptr1) != '\r') + { + Ptr++; + } + } while (*Ptr1++); - // Get back the new text file size - PtrCU[NbCU].SizeLoadSrc = strlen(Ptr = PtrCU[NbCU].PtrLoadSrc); + // Get back the new text file size + PtrCU[NbCU].SizeLoadSrc = strlen(Ptr = PtrCU[NbCU].PtrLoadSrc); - // Make sure the text file finish with a new line code '\n' (0xa) - if (PtrCU[NbCU].PtrLoadSrc[PtrCU[NbCU].SizeLoadSrc - 1] != '\n') - { - PtrCU[NbCU].PtrLoadSrc[PtrCU[NbCU].SizeLoadSrc++] = '\n'; - PtrCU[NbCU].PtrLoadSrc[PtrCU[NbCU].SizeLoadSrc] = 0; - } + // Make sure the text file finish with a new line code '\n' (0xa) + if (PtrCU[NbCU].PtrLoadSrc[PtrCU[NbCU].SizeLoadSrc - 1] != '\n') + { + PtrCU[NbCU].PtrLoadSrc[PtrCU[NbCU].SizeLoadSrc++] = '\n'; + PtrCU[NbCU].PtrLoadSrc[PtrCU[NbCU].SizeLoadSrc] = 0; + } - // Reallocate text file - if (PtrCU[NbCU].PtrLoadSrc = Ptr = (char *)realloc(PtrCU[NbCU].PtrLoadSrc, (PtrCU[NbCU].SizeLoadSrc + 1))) - { - // Count line numbers, based on the new line code '\n' (0xa), and finish each line with 0 - do - { - if (*Ptr == '\n') + // Reallocate text file + if (PtrCU[NbCU].PtrLoadSrc = Ptr = (char *)realloc(PtrCU[NbCU].PtrLoadSrc, (PtrCU[NbCU].SizeLoadSrc + 1))) { - PtrCU[NbCU].NbLinesLoadSrc++; - *Ptr = 0; + // Count line numbers, based on the new line code '\n' (0xa), and finish each line with 0 + do + { + if (*Ptr == '\n') + { + PtrCU[NbCU].NbLinesLoadSrc++; + *Ptr = 0; + } + } while (*++Ptr); } - } while (*++Ptr); + } } } } } + + fclose(SrcFile); } + else + { + // Source file doesn't exist + PtrCU[NbCU].Status = DWARFSTATUS_NOFILE; + } + } + else + { + // Source file is outdated + PtrCU[NbCU].Status = DWARFSTATUS_OUTDATEDFILE; } - fclose(SrcFile); + } + else + { + // Source file doesn't have information + PtrCU[NbCU].Status = DWARFSTATUS_NOFILEINFO; } break; @@ -593,7 +625,7 @@ void DWARFManager_InitDMI(void) } // Get the source lines table located in the CU - if (dwarf_srclines(return_sib, &linebuf, &cnt, &error) == DW_DLV_OK) + if ((dwarf_srclines(return_sib, &linebuf, &cnt, &error) == DW_DLV_OK) && (PtrCU[NbCU].Status == DWARFSTATUS_OK)) { if (cnt) { @@ -903,7 +935,8 @@ void DWARFManager_InitDMI(void) // Get source line number and associated block of address for (Dwarf_Signed i = 0; i < cnt; ++i) { - if ((PtrCU[NbCU].PtrUsedLinesSrc[i].StartPC >= return_lowpc) && (PtrCU[NbCU].PtrUsedLinesSrc[i].StartPC <= return_highpc)) + // Check the presence of the line in the memory frame + if (PtrCU[NbCU].PtrUsedLinesSrc && (PtrCU[NbCU].PtrUsedLinesSrc[i].StartPC >= return_lowpc) && (PtrCU[NbCU].PtrUsedLinesSrc[i].StartPC <= return_highpc)) { PtrCU[NbCU].PtrSubProgs[PtrCU[NbCU].NbSubProgs].PtrLinesSrc = (DMIStruct_LineSrc *)realloc(PtrCU[NbCU].PtrSubProgs[PtrCU[NbCU].NbSubProgs].PtrLinesSrc, (PtrCU[NbCU].PtrSubProgs[PtrCU[NbCU].NbSubProgs].NbLinesSrc + 1) * sizeof(DMIStruct_LineSrc)); memset((void *)(PtrCU[NbCU].PtrSubProgs[PtrCU[NbCU].NbSubProgs].PtrLinesSrc + PtrCU[NbCU].PtrSubProgs[PtrCU[NbCU].NbSubProgs].NbLinesSrc), 0, sizeof(DMIStruct_LineSrc)); @@ -1371,16 +1404,16 @@ char *DWARFManager_GetSymbolnameFromAdr(size_t Adr) // Get complete source filename based from address // Return NULL if no source filename exists -// Return the existence status (true or false) in Error if pointer not NULL -char *DWARFManager_GetFullSourceFilenameFromAdr(size_t Adr, bool *Error) +// Return the existence status in Status if pointer not NULL +char *DWARFManager_GetFullSourceFilenameFromAdr(size_t Adr, DWARFstatus *Status) { for (size_t i = 0; i < NbCU; i++) { if ((Adr >= PtrCU[i].LowPC) && (Adr < PtrCU[i].HighPC)) { - if (Error) + if (Status) { - *Error = PtrCU[i].PtrLoadSrc ? true : false; + *Status = PtrCU[i].Status; } return PtrCU[i].PtrFullFilename; diff --git a/src/debugger/DWARFManager.h b/src/debugger/DWARFManager.h index 9df4535..a1bcf77 100644 --- a/src/debugger/DWARFManager.h +++ b/src/debugger/DWARFManager.h @@ -4,11 +4,21 @@ #define __DWARFMANAGER_H__ +// Definition for the DWARF status of each source file +typedef enum +{ + DWARFSTATUS_OK = 0x0, + DWARFSTATUS_OUTDATEDFILE = 0x1, + DWARFSTATUS_NOFILE = 0x2, + DWARFSTATUS_NOFILEINFO = 0x4, + DWARFSTATUS_UNKNOWN = 0xff +}DWARFstatus; + // Internal manager extern bool DWARFManager_Reset(void); extern bool DWARFManager_Close(void); extern void DWARFManager_Init(void); -extern int DWARFManager_ElfInit(Elf *ElfPtr); +extern int DWARFManager_ElfInit(Elf *ElfPtr, struct _stat FileElfInfo); extern void DWARFManager_Set(size_t NbPathsInList, char **PtrListPaths); extern size_t DWARFManager_GetNbSources(void); @@ -17,7 +27,7 @@ extern char *DWARFManager_GetFunctionName(size_t Adr); extern size_t DWARFManager_GetSrcLanguageFromIndex(size_t Index); // Source text files manager -extern char *DWARFManager_GetFullSourceFilenameFromAdr(size_t Adr, bool *Error); +extern char *DWARFManager_GetFullSourceFilenameFromAdr(size_t Adr, DWARFstatus *Status); extern char *DWARFManager_GetNumFullSourceFilename(size_t Index); extern char *DWARFManager_GetNumSourceFilename(size_t Index); diff --git a/src/debugger/ELFManager.cpp b/src/debugger/ELFManager.cpp index 421e3e3..459e4b8 100644 --- a/src/debugger/ELFManager.cpp +++ b/src/debugger/ELFManager.cpp @@ -15,6 +15,8 @@ #include #include +#include +#include #include "libelf/libelf.h" #include "libelf/gelf.h" #include "libdwarf.h" @@ -145,9 +147,9 @@ void ELFManager_Init(void) // ELF manager Dwarf Initialisation -bool ELFManager_DwarfInit(Elf *PtrElfMem) +bool ELFManager_DwarfInit(Elf *PtrElfMem, struct _stat FileElfInfo) { - return (ElfDwarf = (DWARFManager_ElfInit(PtrElfMem) == DW_DLV_OK) ? true : false); + return (ElfDwarf = (DWARFManager_ElfInit(PtrElfMem, FileElfInfo) == DW_DLV_OK) ? true : false); } diff --git a/src/debugger/ELFManager.h b/src/debugger/ELFManager.h index 23c137f..06caa86 100644 --- a/src/debugger/ELFManager.h +++ b/src/debugger/ELFManager.h @@ -35,7 +35,7 @@ typedef enum { // Internal manager extern void ELFManager_Init(void); -extern bool ELFManager_DwarfInit(Elf *PtrElfMem); +extern bool ELFManager_DwarfInit(Elf *PtrElfMem, struct _stat FileElfInfo); extern Elf *ELFManager_MemOpen(char *PtrELFExe, size_t Size); extern int ELFManager_MemEnd(void); extern void ELFManager_Reset(void); diff --git a/src/debugger/NewFnctBreakpointWin.cpp b/src/debugger/NewFnctBreakpointWin.cpp index a962ded..268898c 100644 --- a/src/debugger/NewFnctBreakpointWin.cpp +++ b/src/debugger/NewFnctBreakpointWin.cpp @@ -97,7 +97,7 @@ void NewFnctBreakpointWindow::AddBreakpointAddress(void) { // Set information based on address Brk.Name = DBGManager_GetSymbolNameFromAdr(adr); - Brk.Filename = DBGManager_GetFullSourceFilenameFromAdr(adr, &ok); + Brk.Filename = DBGManager_GetFullSourceFilenameFromAdr(adr, NULL); Brk.NumLine = DBGManager_GetNumLineFromAdr(adr, DBG_TAG_subprogram); Brk.LineSrc = DBGManager_GetLineSrcFromAdrNumLine(adr, Brk.NumLine); diff --git a/src/debugger/SourcesWin.cpp b/src/debugger/SourcesWin.cpp index 0dfa87e..c9b3a0e 100644 --- a/src/debugger/SourcesWin.cpp +++ b/src/debugger/SourcesWin.cpp @@ -158,15 +158,15 @@ void SourcesWindow::RefreshContents(void) size_t m68kPC = m68k_get_reg(NULL, M68K_REG_PC); int index = 0; size_t i; - bool Error; + DBGstatus Status; char *Filename; // Check valid PC if (m68kPC && NbSourcesInfos) { // Get source filename pointed by PC address - Filename = DBGManager_GetFullSourceFilenameFromAdr(m68kPC, &Error); - if (Error && Filename) + Filename = DBGManager_GetFullSourceFilenameFromAdr(m68kPC, &Status); + if (!Status && Filename) { // Look for a new tab for (i = 0; i < NbSourcesInfos; i++, !index) @@ -196,7 +196,7 @@ void SourcesWindow::RefreshContents(void) // Source file doesn't exist if (indexErrorTab == -1) { - indexErrorTab = sourcestabWidget->addTab(sourceErrorTab = new(SourceCWindow), tr("Source file not found")); + indexErrorTab = sourcestabWidget->addTab(sourceErrorTab = new(SourceCWindow), tr("Source file not available")); //sourceErrorTab->hide(); } sourcestabWidget->setCurrentIndex(indexErrorTab); diff --git a/src/debugger/callstackbrowser.cpp b/src/debugger/callstackbrowser.cpp index 6f618a6..40d8e13 100644 --- a/src/debugger/callstackbrowser.cpp +++ b/src/debugger/callstackbrowser.cpp @@ -81,7 +81,7 @@ void CallStackBrowserWindow::RefreshContents(void) { char msg[1024]; size_t Error = CS_NOERROR; - bool FilenameError; + DBGstatus FilenameStatus; unsigned int a6, Sa6, ret; char *Name; size_t NumError = 0; @@ -127,7 +127,7 @@ void CallStackBrowserWindow::RefreshContents(void) sprintf(msg, "0x%06X", ret); model->setItem(NbRaw, 2, new QStandardItem(QString("%1").arg(msg))); // display the source filename from called source line - model->setItem(NbRaw++, 3, new QStandardItem(QString("%1").arg(((Name = DBGManager_GetFullSourceFilenameFromAdr(ret, &FilenameError)) && FilenameError) ? Name : "(N/A)"))); + model->setItem(NbRaw++, 3, new QStandardItem(QString("%1").arg(((Name = DBGManager_GetFullSourceFilenameFromAdr(ret, &FilenameStatus)) && !FilenameStatus) ? Name : "(N/A)"))); #endif } else diff --git a/src/debugger/m68kDasmWin.cpp b/src/debugger/m68kDasmWin.cpp index 65542fd..de4fc82 100644 --- a/src/debugger/m68kDasmWin.cpp +++ b/src/debugger/m68kDasmWin.cpp @@ -10,7 +10,7 @@ // JPM 06/27/2016 Created this file // JPM 12/04/2016 Suport ELF debug information // JPM Replacing the ELF support by the debugger information manager calls -// JPM Aug./2020 Display only the code related to the traced function, added different layouts, Qt/HTML text format support +// JPM Aug./2020 Display only the code related to the traced function, added different layouts & a status bar, Qt/HTML text format support // // STILL TO DO: @@ -28,6 +28,9 @@ // m68KDasmWindow::m68KDasmWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog), layout(new QVBoxLayout), +#if MD_LAYOUTFILE == 1 +statusbar(new QStatusBar), +#endif #ifdef MD_LAYOUTTEXTS text(new QTextBrowser), #endif @@ -44,6 +47,12 @@ memBase(0) layout->addWidget(text); #endif + // Status bar +#if MD_LAYOUTFILE == 1 + layout->addWidget(statusbar); + setLayout(layout); +#endif + // Set layout setLayout(layout); } @@ -59,7 +68,8 @@ void m68KDasmWindow::RefreshContents(void) size_t m68KPCNbrDisasmLines = 0; char *Symbol = NULL, *LineSrc, *CurrentLineSrc = NULL; bool m68kPCShow = false; - bool constant, adr, equal, Error; + bool constant, adr, equal; + DBGstatus Status; size_t j, i; size_t nbr = vjs.nbrdisasmlines; char *PtrFullSource, *CurrentPtrFullSource = (char *)calloc(1, 1); @@ -78,7 +88,7 @@ void m68KDasmWindow::RefreshContents(void) adr = constant = equal = false; // Display source filename based on the program address - if (vjs.displayFullSourceFilename && (PtrFullSource = DBGManager_GetFullSourceFilenameFromAdr(oldpc, &Error)) && strcmp(CurrentPtrFullSource, PtrFullSource)) + if (vjs.displayFullSourceFilename && (PtrFullSource = DBGManager_GetFullSourceFilenameFromAdr(oldpc, &Status)) && strcmp(CurrentPtrFullSource, PtrFullSource)) { #if defined(MD_LAYOUTFILE) if (i) @@ -100,15 +110,33 @@ void m68KDasmWindow::RefreshContents(void) CurrentPtrFullSource = (char *)realloc(CurrentPtrFullSource, strlen(PtrFullSource) + 1); strcpy(CurrentPtrFullSource, PtrFullSource); #if defined(MD_LAYOUTFILE) - if (!Error) + if (Status) { - // Referenced filename does exist + // Referenced filename doesn't exist sprintf(string, "%s
", PtrFullSource); +#if MD_LAYOUTFILE == 1 + // Display status bar + if ((Status & DBGSTATUS_OUTDATEDFILE)) + { + statusbar->setStyleSheet("background-color: lightyellow; font: bold"); + statusbar->showMessage(QString("Outdated source file")); + } + else + { + statusbar->setStyleSheet("background-color: tomato; font: bold"); + statusbar->showMessage(QString("Unavailable source file")); + } +#endif } else { - // Referenced filename doesn't exist + // Referenced filename does exist sprintf(string, "%s
", PtrFullSource); +#if MD_LAYOUTFILE == 1 + // Display status bar + statusbar->setStyleSheet("background-color: transparent; font: bold"); + statusbar->showMessage(QString("")); +#endif } nbr++; s += QString(string); @@ -118,7 +146,7 @@ void m68KDasmWindow::RefreshContents(void) else { // Display line number based on the program address - if ((NumLine = DBGManager_GetNumLineFromAdr(oldpc, DBG_NO_TAG)) && ((signed)NumLine > (signed)CurrentNumLine)) + if ((NumLine = DBGManager_GetNumLineFromAdr(oldpc, DBG_NO_TAG)) && ((signed)NumLine > (signed)CurrentNumLine) && !Status) { #if MD_LAYOUTFILE != 1 if ((signed)CurrentNumLine < 0) diff --git a/src/debugger/m68kDasmWin.h b/src/debugger/m68kDasmWin.h index e10ba93..77e31cc 100644 --- a/src/debugger/m68kDasmWin.h +++ b/src/debugger/m68kDasmWin.h @@ -6,7 +6,7 @@ // Who When What // --- ---------- ------------------------------------------------------------- // JPM 06/27/2016 Created this file -// JPM Aug./2020 Added different layouts +// JPM Aug./2020 Added different layouts, and a status bar // #ifndef __M68KDASMWIN_H__ @@ -38,6 +38,9 @@ class m68KDasmWindow: public QWidget private: QVBoxLayout *layout; +#if MD_LAYOUTFILE == 1 + QStatusBar *statusbar; +#endif #ifdef MD_LAYOUTTEXTS QTextBrowser *text; #endif diff --git a/src/file.cpp b/src/file.cpp index 73d255e..288f97a 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -17,6 +17,7 @@ // JPM 07/15/2016 DWARF format support // JPM 04/06/2019 Added ELF sections check // JPM 03/12/2020 Added ELF section types check and new error messages +// JPM Aug./2020 ELF executable file information // #include "file.h" @@ -25,6 +26,8 @@ #endif // _MSC_VER #include #include +#include +#include #include "crc32.h" #include "filedb.h" #include "eeprom.h" @@ -147,6 +150,7 @@ bool JaguarLoadFile(char * path) int DBGType = DBG_NO_TYPE; bool error; int err; + struct _stat _statbuf; jaguarROMSize = JaguarLoadROM(buffer, path); @@ -200,9 +204,13 @@ WriteLog("FILE: Cartridge run address is reported as $%X...\n", jaguarRunAddress if (PtrELFExe != NULL) { + // check the ELF version if ((elf_version(EV_CURRENT) != EV_NONE) && (ElfMem = ELFManager_MemOpen(PtrELFExe, jaguarROMSize))) { - if (ELFManager_DwarfInit(ElfMem)) + // get the file information + _stat(path, &_statbuf); + + if (ELFManager_DwarfInit(ElfMem, _statbuf)) { DBGType |= DBG_ELFDWARF; }