From 7512bf055c57acbd510a7c6bcf9abebb5ff08366 Mon Sep 17 00:00:00 2001 From: Jean-Paul Mari Date: Mon, 24 May 2021 00:03:15 -0400 Subject: [PATCH] Added a search feature in the All Watch variables window --- docs/vj_HistoryNotes.txt | 1 + src/debugger/allwatchbrowser.cpp | 35 ++++++++++++++++---------------- src/debugger/allwatchbrowser.h | 6 +++++- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/docs/vj_HistoryNotes.txt b/docs/vj_HistoryNotes.txt index 1df2206..f438507 100644 --- a/docs/vj_HistoryNotes.txt +++ b/docs/vj_HistoryNotes.txt @@ -40,6 +40,7 @@ Release 5 (TBA) 26) Add a search feature in the all watches window 27) Added video output display in a specific window 28) Fixed potential crash with the debugger tabs reset +29) Added a search feature in the All Watch variables window Release 4a (15th August 2019) ----------------------------- diff --git a/src/debugger/allwatchbrowser.cpp b/src/debugger/allwatchbrowser.cpp index 638a2de..bd1fd9a 100644 --- a/src/debugger/allwatchbrowser.cpp +++ b/src/debugger/allwatchbrowser.cpp @@ -114,7 +114,7 @@ void AllWatchBrowserWindow::SearchSymbol(void) for (i = AW_STARTNUMVARIABLE; (i < NbWatch) && !found; i++) { // check symbol presence - if (!symbol->text().compare(PtrWatchInfo[i].PtrVariableName, Qt::CaseSensitive)) + if (!symbol->text().compare(((S_VariablesStruct*)PtrWatchInfo[i])->PtrName, Qt::CaseSensitive)) { found = true; } @@ -181,15 +181,16 @@ void AllWatchBrowserWindow::RefreshContents(void) QString WatchAll; size_t Error = AW_NOERROR; char *PtrValue; + //S_VariablesStruct* Var; if (isVisible()) { if (!NbWatch) { // Pre-catch the information for each global variables - if (NbWatch = DBGManager_GetNbGlobalVariables()) + if (NbWatch = DBGManager_GetNbVariables(NULL)) { - PtrWatchInfo = (WatchInfo *)calloc(NbWatch, sizeof(WatchInfo)); + PtrWatchInfo = (void**)calloc(NbWatch, sizeof(S_VariablesStruct*)); #ifndef AW_LAYOUTTEXTS #ifdef AW_SORTINGFILTER TableView->setSortingEnabled(false); @@ -198,18 +199,18 @@ void AllWatchBrowserWindow::RefreshContents(void) #endif for (uint32_t i = AW_STARTNUMVARIABLE; i < NbWatch; i++) { - PtrWatchInfo[i].PtrVariableName = DBGManager_GetGlobalVariableName(i + 1); - PtrWatchInfo[i].TypeTag = DBGManager_GetGlobalVariableTypeTag(i + 1); -#ifdef AW_LAYOUTTEXTS - PtrWatchInfo[i].addr = DBGManager_GetGlobalVariableAdr(i + 1); - if (!strlen(PtrWatchInfo[i].PtrVariableBaseTypeName = DBGManager_GetGlobalVariableTypeName(i + 1))) + if ((PtrWatchInfo[i] = (void*)DBGManager_GetInfosVariable(NULL, i + 1))) { - PtrWatchInfo[i].PtrVariableBaseTypeName = (char *)"N/A"; - } +#ifdef AW_LAYOUTTEXTS + PtrWatchInfo[i].addr = DBGManager_GetGlobalVariableAdr(i + 1); + if (!strlen(PtrWatchInfo[i].PtrVariableBaseTypeName = DBGManager_GetGlobalVariableTypeName(i + 1))) + { + PtrWatchInfo[i].PtrVariableBaseTypeName = (char *)"N/A"; + } #else - PtrWatchInfo[i].PtrVariableBaseTypeName = DBGManager_GetGlobalVariableTypeName(i + 1); - model->insertRow(i); + model->insertRow(i); #endif + } } } } @@ -218,7 +219,7 @@ void AllWatchBrowserWindow::RefreshContents(void) { for (uint32_t i = AW_STARTNUMVARIABLE; i < NbWatch; i++) { - if ((PtrWatchInfo[i].TypeTag & (DBG_TAG_TYPE_array | DBG_TAG_TYPE_structure))) + if (((S_VariablesStruct*)PtrWatchInfo[i])->TypeTag & (DBG_TAG_TYPE_array | DBG_TAG_TYPE_structure)) { #if defined(AW_SUPPORTARRAY) || defined(AW_SUPPORTSTRUCTURE) //PtrValue = (char *)memcpy(Value, &jaguarMainRAM[PtrWatchInfo[i].addr], 20); @@ -229,7 +230,7 @@ void AllWatchBrowserWindow::RefreshContents(void) } else { - PtrValue = DBGManager_GetGlobalVariableValue(i + 1); + PtrValue = DBGManager_GetVariableValueFromAdr(((S_VariablesStruct*)PtrWatchInfo[i])->Addr, ((S_VariablesStruct*)PtrWatchInfo[i])->TypeEncoding, ((S_VariablesStruct*)PtrWatchInfo[i])->TypeByteSize); } #ifdef AW_LAYOUTTEXTS if (i) @@ -239,9 +240,9 @@ void AllWatchBrowserWindow::RefreshContents(void) sprintf(string, "%i : %s | %s | 0x%06X | %s", (i + 1), PtrWatchInfo[i].PtrVariableBaseTypeName, PtrWatchInfo[i].PtrVariableName, (unsigned int)PtrWatchInfo[i].addr, PtrValue ? PtrValue : (char *)"N/A"); WatchAll += QString(string); #else - model->setItem(i, 0, new QStandardItem(QString("%1").arg(PtrWatchInfo[i].PtrVariableName))); + model->setItem(i, 0, new QStandardItem(QString("%1").arg(((S_VariablesStruct*)PtrWatchInfo[i])->PtrName))); model->setItem(i, 1, new QStandardItem(QString("%1").arg(PtrValue))); - model->setItem(i, 2, new QStandardItem(QString("%1").arg(PtrWatchInfo[i].PtrVariableBaseTypeName))); + model->setItem(i, 2, new QStandardItem(QString("%1").arg(((S_VariablesStruct*)PtrWatchInfo[i])->PtrTypeName))); #endif } #ifdef AW_LAYOUTTEXTS @@ -291,7 +292,7 @@ void AllWatchBrowserWindow::keyPressEvent(QKeyEvent * e) } else { - // select the + // search symbol if (e->key() == Qt::Key_Return) { SearchSymbol(); diff --git a/src/debugger/allwatchbrowser.h b/src/debugger/allwatchbrowser.h index 3f429ad..4f56817 100644 --- a/src/debugger/allwatchbrowser.h +++ b/src/debugger/allwatchbrowser.h @@ -26,6 +26,7 @@ class AllWatchBrowserWindow: public QWidget { Q_OBJECT +#if 0 // typedef struct WatchInfo { @@ -33,9 +34,11 @@ class AllWatchBrowserWindow: public QWidget size_t addr; #endif size_t TypeTag; + size_t Adr; char *PtrVariableName; char *PtrVariableBaseTypeName; }S_WatchInfo; +#endif public: AllWatchBrowserWindow(QWidget *parent = 0); @@ -61,7 +64,8 @@ class AllWatchBrowserWindow: public QWidget QStandardItemModel *model; #endif QStatusBar *statusbar; - WatchInfo *PtrWatchInfo; + //WatchInfo *PtrWatchInfo; + void **PtrWatchInfo; size_t NbWatch; QPushButton *search; QLineEdit* symbol; -- 2.20.1