Added a search feature in the All Watch variables window
[clinton/Virtual-Jaguar-Rx.git] / src / debugger / allwatchbrowser.cpp
index 638a2de..bd1fd9a 100644 (file)
@@ -114,7 +114,7 @@ void AllWatchBrowserWindow::SearchSymbol(void)
        for (i = AW_STARTNUMVARIABLE; (i < NbWatch) && !found; i++)\r
        {\r
                // check symbol presence\r
-               if (!symbol->text().compare(PtrWatchInfo[i].PtrVariableName, Qt::CaseSensitive))\r
+               if (!symbol->text().compare(((S_VariablesStruct*)PtrWatchInfo[i])->PtrName, Qt::CaseSensitive))\r
                {\r
                        found = true;\r
                }\r
@@ -181,15 +181,16 @@ void AllWatchBrowserWindow::RefreshContents(void)
        QString WatchAll;\r
        size_t Error = AW_NOERROR;\r
        char *PtrValue;\r
+       //S_VariablesStruct* Var;\r
 \r
        if (isVisible())\r
        {\r
                if (!NbWatch)\r
                {\r
                        // Pre-catch the information for each global variables\r
-                       if (NbWatch = DBGManager_GetNbGlobalVariables())\r
+                       if (NbWatch = DBGManager_GetNbVariables(NULL))\r
                        {\r
-                               PtrWatchInfo = (WatchInfo *)calloc(NbWatch, sizeof(WatchInfo));\r
+                               PtrWatchInfo = (void**)calloc(NbWatch, sizeof(S_VariablesStruct*));\r
 #ifndef AW_LAYOUTTEXTS\r
 #ifdef AW_SORTINGFILTER\r
                                TableView->setSortingEnabled(false);\r
@@ -198,18 +199,18 @@ void AllWatchBrowserWindow::RefreshContents(void)
 #endif\r
                                for (uint32_t i = AW_STARTNUMVARIABLE; i < NbWatch; i++)\r
                                {\r
-                                       PtrWatchInfo[i].PtrVariableName = DBGManager_GetGlobalVariableName(i + 1);\r
-                                       PtrWatchInfo[i].TypeTag = DBGManager_GetGlobalVariableTypeTag(i + 1);\r
-#ifdef AW_LAYOUTTEXTS\r
-                                       PtrWatchInfo[i].addr = DBGManager_GetGlobalVariableAdr(i + 1);\r
-                                       if (!strlen(PtrWatchInfo[i].PtrVariableBaseTypeName = DBGManager_GetGlobalVariableTypeName(i + 1)))\r
+                                       if ((PtrWatchInfo[i] = (void*)DBGManager_GetInfosVariable(NULL, i + 1)))\r
                                        {\r
-                                               PtrWatchInfo[i].PtrVariableBaseTypeName = (char *)"<font color='#ff0000'>N/A</font>";\r
-                                       }\r
+#ifdef AW_LAYOUTTEXTS\r
+                                               PtrWatchInfo[i].addr = DBGManager_GetGlobalVariableAdr(i + 1);\r
+                                               if (!strlen(PtrWatchInfo[i].PtrVariableBaseTypeName = DBGManager_GetGlobalVariableTypeName(i + 1)))\r
+                                               {\r
+                                                       PtrWatchInfo[i].PtrVariableBaseTypeName = (char *)"<font color='#ff0000'>N/A</font>";\r
+                                               }\r
 #else\r
-                                       PtrWatchInfo[i].PtrVariableBaseTypeName = DBGManager_GetGlobalVariableTypeName(i + 1);\r
-                                       model->insertRow(i);\r
+                                               model->insertRow(i);\r
 #endif\r
+                                       }\r
                                }\r
                        }\r
                }\r
@@ -218,7 +219,7 @@ void AllWatchBrowserWindow::RefreshContents(void)
                {\r
                        for (uint32_t i = AW_STARTNUMVARIABLE; i < NbWatch; i++)\r
                        {\r
-                               if ((PtrWatchInfo[i].TypeTag & (DBG_TAG_TYPE_array | DBG_TAG_TYPE_structure)))\r
+                               if (((S_VariablesStruct*)PtrWatchInfo[i])->TypeTag & (DBG_TAG_TYPE_array | DBG_TAG_TYPE_structure))\r
                                {\r
 #if defined(AW_SUPPORTARRAY) || defined(AW_SUPPORTSTRUCTURE)\r
                                        //PtrValue = (char *)memcpy(Value, &jaguarMainRAM[PtrWatchInfo[i].addr], 20);\r
@@ -229,7 +230,7 @@ void AllWatchBrowserWindow::RefreshContents(void)
                                }\r
                                else\r
                                {\r
-                                       PtrValue = DBGManager_GetGlobalVariableValue(i + 1);\r
+                                       PtrValue = DBGManager_GetVariableValueFromAdr(((S_VariablesStruct*)PtrWatchInfo[i])->Addr, ((S_VariablesStruct*)PtrWatchInfo[i])->TypeEncoding, ((S_VariablesStruct*)PtrWatchInfo[i])->TypeByteSize);\r
                                }\r
 #ifdef AW_LAYOUTTEXTS\r
                                if (i)\r
@@ -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 *)"<font color='#ff0000'>N/A</font>");\r
                                WatchAll += QString(string);\r
 #else\r
-                               model->setItem(i, 0, new QStandardItem(QString("%1").arg(PtrWatchInfo[i].PtrVariableName)));\r
+                               model->setItem(i, 0, new QStandardItem(QString("%1").arg(((S_VariablesStruct*)PtrWatchInfo[i])->PtrName)));\r
                                model->setItem(i, 1, new QStandardItem(QString("%1").arg(PtrValue)));\r
-                               model->setItem(i, 2, new QStandardItem(QString("%1").arg(PtrWatchInfo[i].PtrVariableBaseTypeName)));\r
+                               model->setItem(i, 2, new QStandardItem(QString("%1").arg(((S_VariablesStruct*)PtrWatchInfo[i])->PtrTypeName)));\r
 #endif\r
                        }\r
 #ifdef AW_LAYOUTTEXTS\r
@@ -291,7 +292,7 @@ void AllWatchBrowserWindow::keyPressEvent(QKeyEvent * e)
        }\r
        else\r
        {\r
-               // select the \r
+               // search symbol\r
                if (e->key() == Qt::Key_Return)\r
                {\r
                        SearchSymbol();\r