Fixed a crash, in Release mode, when the HW labels setting is turned on.
authorJean-Paul Mari <djipi.mari@gmail.com>
Mon, 9 Oct 2017 01:08:06 +0000 (21:08 -0400)
committerJean-Paul Mari <djipi.mari@gmail.com>
Mon, 9 Oct 2017 01:08:06 +0000 (21:08 -0400)
VS2015/virtualjaguar.vcxproj.user
docs/vj_ReleaseNotes.txt
src/debugger/DBGManager.cpp
src/debugger/DBGManager.h
src/debugger/HWLABELManager.cpp
src/debugger/debuggertab.cpp
src/gui/mainwin.cpp

index 315a626..daed425 100644 (file)
@@ -7,7 +7,7 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
     <LocalDebuggerEnvironment>PATH=$(QTDIR)\bin%3b$(PATH)</LocalDebuggerEnvironment>\r
     <QTDIR>C:\Qt\Qt5.5.1\msvc2015_64</QTDIR>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
     <LocalDebuggerEnvironment>PATH=$(QTDIR)\bin%3b$(PATH)</LocalDebuggerEnvironment>\r
     <QTDIR>C:\Qt\Qt5.5.1\msvc2015_64</QTDIR>\r
-    <LocalDebuggerCommandArguments>C:\Projects\GLib-M68K\Lib-Test-M68K\Debug\LibTestM68K_Debug.elf --debugger --no-log</LocalDebuggerCommandArguments>\r
+    <LocalDebuggerCommandArguments>--debugger --no-log</LocalDebuggerCommandArguments>\r
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
     <LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>\r
   </PropertyGroup>\r
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
     <LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>\r
   </PropertyGroup>\r
@@ -38,7 +38,7 @@
     <QTDIR>C:\Qt\Qt5.5.1\msvc2015_64</QTDIR>\r
     <LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>\r
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
     <QTDIR>C:\Qt\Qt5.5.1\msvc2015_64</QTDIR>\r
     <LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>\r
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
-    <LocalDebuggerCommandArguments>C:\Projects\GLib-M68K\Lib-Test-M68K\Debug\LibTestM68K_Debug.elf --debugger</LocalDebuggerCommandArguments>\r
+    <LocalDebuggerCommandArguments>--debugger</LocalDebuggerCommandArguments>\r
   </PropertyGroup>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
     <LocalDebuggerEnvironment>PATH=$(QTDIR)\bin%3bC:\Qt\qt5-5.5.1-vs2015\qt5-x86-shared-debug\bin%3b$(PATH)</LocalDebuggerEnvironment>\r
   </PropertyGroup>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
     <LocalDebuggerEnvironment>PATH=$(QTDIR)\bin%3bC:\Qt\qt5-5.5.1-vs2015\qt5-x86-shared-debug\bin%3b$(PATH)</LocalDebuggerEnvironment>\r
index 174524d..b28596b 100644 (file)
@@ -1,6 +1,6 @@
 Release 3 (TBC)\r
 ---------------\r
 Release 3 (TBC)\r
 ---------------\r
-0) Fixed the windows respawning in the next emulator launch without --alpine or --debugger options\r
+0) Fixed the windows respawning in the next emulator launch within --alpine or --debugger options\r
 1) Added an Exception Vector Table browser window\r
 2) Modified the About window to update the credits list in a more appropriate way\r
 -- Updated the emulator application credits line\r
 1) Added an Exception Vector Table browser window\r
 2) Modified the About window to update the credits list in a more appropriate way\r
 -- Updated the emulator application credits line\r
@@ -11,6 +11,9 @@ Release 3 (TBC)
 7) Added the --es-all, --es-ui, --es-alpine & --es-debugger options to erase specific settings\r
 8) Added a keybindings tab and adapted the configuration dialog tabs\r
 -- User can modify the keybindings where appropriate\r
 7) Added the --es-all, --es-ui, --es-alpine & --es-debugger options to erase specific settings\r
 8) Added a keybindings tab and adapted the configuration dialog tabs\r
 -- User can modify the keybindings where appropriate\r
+9) Fixed a crash, in Release mode, when the HW labels setting is turn on\r
+10) Solved an interference between the HW labels setting and the one used by the debugger\r
+-- The setting is now only the reference used\r
 \r
 Release 2 (3rd September 2017)\r
 ------------------------------\r
 \r
 Release 2 (3rd September 2017)\r
 ------------------------------\r
@@ -96,6 +99,7 @@ Legacy issues/hints
 ===================\r
 1) Emulator seems to have easter egg(s)\r
 -- The option --yarrr displays a single message and end the application\r
 ===================\r
 1) Emulator seems to have easter egg(s)\r
 -- The option --yarrr displays a single message and end the application\r
+-- Pressing F8, while in the main window, will create an extra message in the log file\r
 2) The --alpine option force the log file but it can be override if --no-log option is set after the --alpine option\r
 \r
 Project information\r
 2) The --alpine option force the log file but it can be override if --no-log option is set after the --alpine option\r
 \r
 Project information\r
index b74b011..d4df274 100644 (file)
-//
-// DBGManager.cpp: Debugger information manager
-//
-// by Jean-Paul Mari
-//
-// JPM = Jean-Paul Mari <djipi.mari@gmail.com>
-//
-// WHO  WHEN        WHAT
-// ---  ----------  ------------------------------------------------------------
-// JPM  12/21/2016  Created this file
-// JPM              Various efforts to set the ELF format support
-// JPM              Various efforts to set the DWARF format support
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include "libelf/libelf.h"
-#include "libelf/gelf.h"
-#include "log.h"
-#include "ELFManager.h"
-#include "DwarfManager.h"
-#include "DBGManager.h"
-#include "HWLABELManager.h"
-#include "settings.h"
-#include "memory.h"
-
-
-// 
-char *DBGManager_GetVariableValueFromAdr(uint32_t Adr, uint32_t TypeEncoding, uint32_t TypeByteSize);
-
-
-//
-struct Value
-{
-       union
-       {
-               char C[10];
-               double D;
-               float F;
-               int32_t SI;
-               int64_t SL;
-               uint32_t UI;
-               uint64_t UL;
-       };
-}S_Value;
-
-
-// Common debugger variables
-int    DBGType;
-char value[1000];
-
-
-// Common debugger initialisation
-void DBGManager_Init(void)
-{
-       DBGType = DBG_NO_TYPE;
-       ELFManager_Init();
-       DWARFManager_Init();
-}
-
-
-// Common debugger reset
-void DBGManager_Reset(void)
-{
-       if ((DBGType & DBG_DWARF))
-       {
-               DWARFManager_Reset();
-       }
-
-       if ((DBGType & DBG_ELF))
-       {
-               ELFManager_Reset();
-       }
-
-       DBGType = vjs.displayHWlabels ? DBG_HWLABEL : DBG_NO_TYPE;
-}
-
-
-// Common debugger set
-void DBGManager_SetType(int DBGTypeSet)
-{
-       DBGType |= DBGTypeSet;
-}
-
-
-// Common debugger close
-void DBGManager_Close(void)
-{
-       if ((DBGType & DBG_DWARF))
-       {
-               DWARFManager_Close();
-       }
-
-       if ((DBGType & DBG_ELF))
-       {
-               ELFManager_Close();
-       }
-}
-
-
-// Get source filename based on the memeory address
-// return NULL if no source filename
-char *DBGManager_GetFullSourceFilenameFromAdr(size_t Adr, bool *Error)
-{
-       if ((DBGType & DBG_ELFDWARF))
-       {
-               return DWARFManager_GetFullSourceFilenameFromAdr(Adr, Error);
-       }
-       else
-       {
-               return  NULL;
-       }
-}
-
-
-// Get number of external variables
-// Return 0 if none has been found
-size_t DBGManager_GetNbExternalVariables(void)
-{
-       if ((DBGType & DBG_ELFDWARF))
-       {
-               return DWARFManager_GetNbExternalVariables();
-       }
-       else
-       {
-               return  0;
-       }
-}
-
-
-//
-size_t DBGManager_GetAdrFromSymbolName(char *SymbolName)
-{
-       if ((DBGType & DBG_ELF))
-       {
-               return ELFManager_GetAdrFromSymbolName(SymbolName);
-       }
-       else
-       {
-               return 0;
-       }
-}
-
-
-// Get external variable's Address based on his Name
-// Return found Address
-// Return NULL if no Address has been found
-size_t DBGManager_GetExternalVariableAdrFromName(char *VariableName)
-{
-       if ((DBGType & DBG_ELFDWARF))
-       {
-               return DWARFManager_GetExternalVariableAdrFromName(VariableName);
-       }
-       else
-       {
-               return 0;
-       }
-}
-
-
-//
-size_t DBGManager_GetExternalVariableTypeTag(size_t Index)
-{
-       if ((DBGType & DBG_ELFDWARF))
-       {
-               return DWARFManager_GetExternalVariableTypeTag(Index);
-       }
-       else
-       {
-               return  0;
-       }
-}
-
-
-// Get external variable's type name based on his Index
-// Return type name's text pointer found
-// Return NULL if no type name has been found
-char *DBGManager_GetExternalVariableTypeName(size_t Index)
-{
-       if ((DBGType & DBG_ELFDWARF))
-       {
-               return DWARFManager_GetExternalVariableTypeName(Index);
-       }
-       else
-       {
-               return  NULL;
-       }
-}
-
-
-// Get external variable's Address based on his Index
-// Return the Address found
-// Return 0 if no Address has been found
-size_t DBGManager_GetExternalVariableAdr(size_t Index)
-{
-       if ((DBGType & DBG_ELFDWARF))
-       {
-               return DWARFManager_GetExternalVariableAdr(Index);
-       }
-       else
-       {
-               return  0;
-       }
-}
-
-
-// Get external variable's type byte size based on his Index
-// Return the type's byte size found
-// Return 0 if no type's byte size has been found
-size_t DBGManager_GetExternalVariableTypeByteSize(size_t Index)
-{
-       if ((DBGType & DBG_ELFDWARF))
-       {
-               return DWARFManager_GetExternalVariableTypeByteSize(Index);
-       }
-       else
-       {
-               return  0;
-       }
-}
-
-
-// Get external variable's type encoding based on his Index
-// Return the type encoding found
-// Return 0 if no type encoding has been found
-size_t DBGManager_GetExternalVariableTypeEncoding(size_t Index)
-{
-       if ((DBGType & DBG_ELFDWARF))
-       {
-               return DWARFManager_GetExternalVariableTypeEncoding(Index);
-       }
-       else
-       {
-               return  0;
-       }
-}
-
-
-// Get external variable value based on his Index
-// Return value as a text pointer
-// Note: Pointer may point on a 0 lenght text
-char *DBGManager_GetExternalVariableValue(size_t Index)
-{
-       uint32_t Adr = 0;
-       uint32_t TypeEncoding = DBG_NO_TYPEENCODING;
-       uint32_t TypeByteSize = 0;
-
-       if ((DBGType & DBG_ELFDWARF))
-       {
-               Adr = DWARFManager_GetExternalVariableAdr(Index);
-               TypeEncoding = DWARFManager_GetExternalVariableTypeEncoding(Index);
-               TypeByteSize = DWARFManager_GetExternalVariableTypeByteSize(Index);
-       }
-
-       return DBGManager_GetVariableValueFromAdr(Adr, TypeEncoding, TypeByteSize);
-}
-
-
-// Get variable value based on his Adresse, Encoding Type and Size
-// Return value as a text pointer
-// Note: Pointer may point on a 0 lenght text if Adress is NULL
-char *DBGManager_GetVariableValueFromAdr(uint32_t Adr, uint32_t TypeEncoding, uint32_t TypeByteSize)
-{
-       Value V;
-       char *Ptrvalue = value;
-
-       value[0] = 0;
-
-       if (Adr)
-       {
-               memset(&V, 0, sizeof(Value));
-#if 0
-               for (uint32_t i = 0; i < TypeByteSize; i++)
-                       jaguarMainRAM[Adr + i] = 0;
-                       //jaguarMainRAM[Adr + i] = rand();
-               jaguarMainRAM[Adr + TypeByteSize - 1] = 0x10;
-#endif
-#if 1
-               for (uint32_t i = 0, j = TypeByteSize; i < TypeByteSize; i++, j--)
-               {
-                       V.C[i] = jaguarMainRAM[Adr + j - 1];
-               }
-#endif
-
-               switch (TypeEncoding)
-               {
-               case DBG_ATE_address:
-                       break;
-
-               case DBG_ATE_boolean:
-                       break;
-
-               case DBG_ATE_complex_float:
-                       break;
-
-               case DBG_ATE_float:
-                       switch (TypeByteSize)
-                       {
-                       case 4:
-                               sprintf(value, "%F", V.F);
-                               break;
-
-                       case 8:
-                               //V.D = (double)jaguarMainRAM[Adr];
-                               //sprintf(value, "%10.10F", V.D);
-                               sprintf(value, "%F", V.D);
-                               break;
-
-                       default:
-                               break;
-                       }
-                       break;
-
-               case DBG_ATE_signed:
-                       switch (TypeByteSize)
-                       {
-                       case 4:
-                               sprintf(value, "%i", V.SI);
-                               break;
-
-                       case 8:
-                               sprintf(value, "%i", V.SL);
-                               break;
-
-                       default:
-                               break;
-                       }
-                       break;
-
-               case DBG_ATE_signed_char:
-                       break;
-
-               case DBG_ATE_unsigned:
-                       switch (TypeByteSize)
-                       {
-                       case 4:
-                               sprintf(value, "%u", V.UI);
-                               break;
-
-                       case 8:
-                               sprintf(value, "%u", V.UL);
-                               break;
-
-                       default:
-                               break;
-                       }
-                       break;
-
-               case DBG_ATE_unsigned_char:
-                       break;
-
-               case DBG_ATE_ptr:
-                       switch (TypeByteSize)
-                       {
-                       case 4:
-                               sprintf(value, "0x%06x", V.UI);
-                               break;
-
-                       default:
-                               break;
-                       }
-
-               default:
-                       break;
-               }
-       }
-
-       return Ptrvalue;
-}
-
-
-// Get external variable name based on his Index
-// Return variable name's text pointer found
-// Return NULL if no variable name has been found
-char *DBGManager_GetExternalVariableName(size_t Index)
-{
-       if ((DBGType & DBG_ELFDWARF))
-       {
-               return DWARFManager_GetExternalVariableName(Index);
-       }
-       else
-       {
-               return  NULL;
-       }
-}
-
-
-// Get line number from address and his tag
-// Return line number on the symbol name found
-// Return 0 if no symbol name has been found
-size_t DBGManager_GetNumLineFromAdr(size_t Adr, size_t Tag)
-{
-       if ((DBGType & DBG_ELFDWARF))
-       {
-               return DWARFManager_GetNumLineFromAdr(Adr, Tag);
-       }
-       else
-       {
-               return  0;
-       }
-}
-
-
-// Get symbol name from address
-// Return text pointer on the symbol name found
-// Return NULL if no symbol name has been found
-char *DBGManager_GetSymbolnameFromAdr(size_t Adr)
-{
-       char *Symbolname = NULL;
-
-       if ((DBGType & DBG_HWLABEL) || vjs.displayHWlabels)
-       {
-               Symbolname = HWLABELManager_GetSymbolnameFromAdr(Adr);
-       }
-
-       if (Symbolname == NULL)
-       {
-               if ((DBGType & DBG_ELFDWARF))
-               {
-                       Symbolname = DWARFManager_GetSymbolnameFromAdr(Adr);
-               }
-
-               if ((DBGType & DBG_ELF) && (Symbolname == NULL))
-               {
-                       Symbolname = ELFManager_GetSymbolnameFromAdr(Adr);
-               }
-       }
-
-       return  Symbolname;
-}
-
-
-// Get source line based on the Address and his Tag
-// Return text pointer on the source line found
-// Return NULL if no source line has been found
-char *DBGManager_GetLineSrcFromAdr(size_t Adr, size_t Tag)
-{
-       char *Symbolname = NULL;
-
-       if ((DBGType & DBG_ELFDWARF))
-       {
-               Symbolname = DWARFManager_GetLineSrcFromAdr(Adr, Tag);
-       }
-
-       return  Symbolname;
-}
-
-
-// Get text line from source based on address and num line (starting by 1)
-// Return NULL if no text line has been found
-char *DBGManager_GetLineSrcFromAdrNumLine(size_t Adr, size_t NumLine)
-{
-       char *Symbolname = NULL;
-
-       if ((DBGType & DBG_ELFDWARF))
-       {
-               Symbolname = DWARFManager_GetLineSrcFromAdrNumLine(Adr, NumLine);
-       }
-
-       return  Symbolname;
-}
-
-
-// Get text line from source based on address and num line (starting by 1)
-// Return NULL if no text line has been found
-char *DBGManager_GetLineSrcFromNumLineBaseAdr(size_t Adr, size_t NumLine)
-{
-       char *Symbolname = NULL;
-
-       if ((DBGType & DBG_ELFDWARF))
-       {
-               Symbolname = DWARFManager_GetLineSrcFromNumLineBaseAdr(Adr, NumLine);
-       }
-
-       return  Symbolname;
-}
-
+//\r
+// DBGManager.cpp: Debugger information manager\r
+//\r
+// by Jean-Paul Mari\r
+//\r
+// JPM = Jean-Paul Mari <djipi.mari@gmail.com>\r
+//\r
+// WHO  WHEN        WHAT\r
+// ---  ----------  ------------------------------------------------------------\r
+// JPM  12/21/2016  Created this file\r
+// JPM              Various efforts to set the ELF format support\r
+// JPM              Various efforts to set the DWARF format support\r
+\r
+#include <stdlib.h>\r
+#include <string.h>\r
+#include <stdint.h>\r
+#include "libelf/libelf.h"\r
+#include "libelf/gelf.h"\r
+#include "log.h"\r
+#include "ELFManager.h"\r
+#include "DwarfManager.h"\r
+#include "DBGManager.h"\r
+#include "HWLABELManager.h"\r
+#include "settings.h"\r
+#include "memory.h"\r
+\r
+\r
+// \r
+char *DBGManager_GetVariableValueFromAdr(uint32_t Adr, uint32_t TypeEncoding, uint32_t TypeByteSize);\r
+\r
+\r
+//\r
+struct Value\r
+{\r
+       union\r
+       {\r
+               char C[10];\r
+               double D;\r
+               float F;\r
+               int32_t SI;\r
+               int64_t SL;\r
+               uint32_t UI;\r
+               uint64_t UL;\r
+       };\r
+}S_Value;\r
+\r
+\r
+// Common debugger variables\r
+size_t DBGType;\r
+char value[1000];\r
+\r
+\r
+// Common debugger initialisation\r
+void DBGManager_Init(void)\r
+{\r
+       DBGType = DBG_NO_TYPE;\r
+       ELFManager_Init();\r
+       DWARFManager_Init();\r
+}\r
+\r
+\r
+// Common debugger reset\r
+void DBGManager_Reset(void)\r
+{\r
+       if ((DBGType & DBG_DWARF))\r
+       {\r
+               DWARFManager_Reset();\r
+       }\r
+\r
+       if ((DBGType & DBG_ELF))\r
+       {\r
+               ELFManager_Reset();\r
+       }\r
+\r
+       //DBGType = vjs.displayHWlabels ? DBG_HWLABEL : DBG_NO_TYPE;\r
+       DBGType = DBG_NO_TYPE;\r
+}\r
+\r
+\r
+// Common debugger set\r
+void DBGManager_SetType(size_t DBGTypeSet)\r
+{\r
+       DBGType |= DBGTypeSet;\r
+}\r
+\r
+\r
+// Common debugger close\r
+void DBGManager_Close(void)\r
+{\r
+       if ((DBGType & DBG_DWARF))\r
+       {\r
+               DWARFManager_Close();\r
+       }\r
+\r
+       if ((DBGType & DBG_ELF))\r
+       {\r
+               ELFManager_Close();\r
+       }\r
+}\r
+\r
+\r
+// Get source filename based on the memeory address\r
+// return NULL if no source filename\r
+char *DBGManager_GetFullSourceFilenameFromAdr(size_t Adr, bool *Error)\r
+{\r
+       if ((DBGType & DBG_ELFDWARF))\r
+       {\r
+               return DWARFManager_GetFullSourceFilenameFromAdr(Adr, Error);\r
+       }\r
+       else\r
+       {\r
+               return  NULL;\r
+       }\r
+}\r
+\r
+\r
+// Get number of external variables\r
+// Return 0 if none has been found\r
+size_t DBGManager_GetNbExternalVariables(void)\r
+{\r
+       if ((DBGType & DBG_ELFDWARF))\r
+       {\r
+               return DWARFManager_GetNbExternalVariables();\r
+       }\r
+       else\r
+       {\r
+               return  0;\r
+       }\r
+}\r
+\r
+\r
+//\r
+size_t DBGManager_GetAdrFromSymbolName(char *SymbolName)\r
+{\r
+       if ((DBGType & DBG_ELF))\r
+       {\r
+               return ELFManager_GetAdrFromSymbolName(SymbolName);\r
+       }\r
+       else\r
+       {\r
+               return 0;\r
+       }\r
+}\r
+\r
+\r
+// Get external variable's Address based on his Name\r
+// Return found Address\r
+// Return NULL if no Address has been found\r
+size_t DBGManager_GetExternalVariableAdrFromName(char *VariableName)\r
+{\r
+       if ((DBGType & DBG_ELFDWARF))\r
+       {\r
+               return DWARFManager_GetExternalVariableAdrFromName(VariableName);\r
+       }\r
+       else\r
+       {\r
+               return 0;\r
+       }\r
+}\r
+\r
+\r
+//\r
+size_t DBGManager_GetExternalVariableTypeTag(size_t Index)\r
+{\r
+       if ((DBGType & DBG_ELFDWARF))\r
+       {\r
+               return DWARFManager_GetExternalVariableTypeTag(Index);\r
+       }\r
+       else\r
+       {\r
+               return  0;\r
+       }\r
+}\r
+\r
+\r
+// Get external variable's type name based on his Index\r
+// Return type name's text pointer found\r
+// Return NULL if no type name has been found\r
+char *DBGManager_GetExternalVariableTypeName(size_t Index)\r
+{\r
+       if ((DBGType & DBG_ELFDWARF))\r
+       {\r
+               return DWARFManager_GetExternalVariableTypeName(Index);\r
+       }\r
+       else\r
+       {\r
+               return  NULL;\r
+       }\r
+}\r
+\r
+\r
+// Get external variable's Address based on his Index\r
+// Return the Address found\r
+// Return 0 if no Address has been found\r
+size_t DBGManager_GetExternalVariableAdr(size_t Index)\r
+{\r
+       if ((DBGType & DBG_ELFDWARF))\r
+       {\r
+               return DWARFManager_GetExternalVariableAdr(Index);\r
+       }\r
+       else\r
+       {\r
+               return  0;\r
+       }\r
+}\r
+\r
+\r
+// Get external variable's type byte size based on his Index\r
+// Return the type's byte size found\r
+// Return 0 if no type's byte size has been found\r
+size_t DBGManager_GetExternalVariableTypeByteSize(size_t Index)\r
+{\r
+       if ((DBGType & DBG_ELFDWARF))\r
+       {\r
+               return DWARFManager_GetExternalVariableTypeByteSize(Index);\r
+       }\r
+       else\r
+       {\r
+               return  0;\r
+       }\r
+}\r
+\r
+\r
+// Get external variable's type encoding based on his Index\r
+// Return the type encoding found\r
+// Return 0 if no type encoding has been found\r
+size_t DBGManager_GetExternalVariableTypeEncoding(size_t Index)\r
+{\r
+       if ((DBGType & DBG_ELFDWARF))\r
+       {\r
+               return DWARFManager_GetExternalVariableTypeEncoding(Index);\r
+       }\r
+       else\r
+       {\r
+               return  0;\r
+       }\r
+}\r
+\r
+\r
+// Get external variable value based on his Index\r
+// Return value as a text pointer\r
+// Note: Pointer may point on a 0 lenght text\r
+char *DBGManager_GetExternalVariableValue(size_t Index)\r
+{\r
+       uint32_t Adr = 0;\r
+       uint32_t TypeEncoding = DBG_NO_TYPEENCODING;\r
+       uint32_t TypeByteSize = 0;\r
+\r
+       if ((DBGType & DBG_ELFDWARF))\r
+       {\r
+               Adr = DWARFManager_GetExternalVariableAdr(Index);\r
+               TypeEncoding = DWARFManager_GetExternalVariableTypeEncoding(Index);\r
+               TypeByteSize = DWARFManager_GetExternalVariableTypeByteSize(Index);\r
+       }\r
+\r
+       return DBGManager_GetVariableValueFromAdr(Adr, TypeEncoding, TypeByteSize);\r
+}\r
+\r
+\r
+// Get variable value based on his Adresse, Encoding Type and Size\r
+// Return value as a text pointer\r
+// Note: Pointer may point on a 0 lenght text if Adress is NULL\r
+char *DBGManager_GetVariableValueFromAdr(uint32_t Adr, uint32_t TypeEncoding, uint32_t TypeByteSize)\r
+{\r
+       Value V;\r
+       char *Ptrvalue = value;\r
+\r
+       value[0] = 0;\r
+\r
+       if (Adr)\r
+       {\r
+               memset(&V, 0, sizeof(Value));\r
+#if 0\r
+               for (uint32_t i = 0; i < TypeByteSize; i++)\r
+                       jaguarMainRAM[Adr + i] = 0;\r
+                       //jaguarMainRAM[Adr + i] = rand();\r
+               jaguarMainRAM[Adr + TypeByteSize - 1] = 0x10;\r
+#endif\r
+#if 1\r
+               for (uint32_t i = 0, j = TypeByteSize; i < TypeByteSize; i++, j--)\r
+               {\r
+                       V.C[i] = jaguarMainRAM[Adr + j - 1];\r
+               }\r
+#endif\r
+\r
+               switch (TypeEncoding)\r
+               {\r
+               case DBG_ATE_address:\r
+                       break;\r
+\r
+               case DBG_ATE_boolean:\r
+                       break;\r
+\r
+               case DBG_ATE_complex_float:\r
+                       break;\r
+\r
+               case DBG_ATE_float:\r
+                       switch (TypeByteSize)\r
+                       {\r
+                       case 4:\r
+                               sprintf(value, "%F", V.F);\r
+                               break;\r
+\r
+                       case 8:\r
+                               //V.D = (double)jaguarMainRAM[Adr];\r
+                               //sprintf(value, "%10.10F", V.D);\r
+                               sprintf(value, "%F", V.D);\r
+                               break;\r
+\r
+                       default:\r
+                               break;\r
+                       }\r
+                       break;\r
+\r
+               case DBG_ATE_signed:\r
+                       switch (TypeByteSize)\r
+                       {\r
+                       case 4:\r
+                               sprintf(value, "%i", V.SI);\r
+                               break;\r
+\r
+                       case 8:\r
+                               sprintf(value, "%i", V.SL);\r
+                               break;\r
+\r
+                       default:\r
+                               break;\r
+                       }\r
+                       break;\r
+\r
+               case DBG_ATE_signed_char:\r
+                       break;\r
+\r
+               case DBG_ATE_unsigned:\r
+                       switch (TypeByteSize)\r
+                       {\r
+                       case 4:\r
+                               sprintf(value, "%u", V.UI);\r
+                               break;\r
+\r
+                       case 8:\r
+                               sprintf(value, "%u", V.UL);\r
+                               break;\r
+\r
+                       default:\r
+                               break;\r
+                       }\r
+                       break;\r
+\r
+               case DBG_ATE_unsigned_char:\r
+                       break;\r
+\r
+               case DBG_ATE_ptr:\r
+                       switch (TypeByteSize)\r
+                       {\r
+                       case 4:\r
+                               sprintf(value, "0x%06x", V.UI);\r
+                               break;\r
+\r
+                       default:\r
+                               break;\r
+                       }\r
+\r
+               default:\r
+                       break;\r
+               }\r
+       }\r
+\r
+       return Ptrvalue;\r
+}\r
+\r
+\r
+// Get external variable name based on his Index\r
+// Return variable name's text pointer found\r
+// Return NULL if no variable name has been found\r
+char *DBGManager_GetExternalVariableName(size_t Index)\r
+{\r
+       if ((DBGType & DBG_ELFDWARF))\r
+       {\r
+               return DWARFManager_GetExternalVariableName(Index);\r
+       }\r
+       else\r
+       {\r
+               return  NULL;\r
+       }\r
+}\r
+\r
+\r
+// Get line number from address and his tag\r
+// Return line number on the symbol name found\r
+// Return 0 if no symbol name has been found\r
+size_t DBGManager_GetNumLineFromAdr(size_t Adr, size_t Tag)\r
+{\r
+       if ((DBGType & DBG_ELFDWARF))\r
+       {\r
+               return DWARFManager_GetNumLineFromAdr(Adr, Tag);\r
+       }\r
+       else\r
+       {\r
+               return  0;\r
+       }\r
+}\r
+\r
+\r
+// Get symbol name from address\r
+// Return text pointer on the symbol name found\r
+// Return NULL if no symbol name has been found\r
+char *DBGManager_GetSymbolnameFromAdr(size_t Adr)\r
+{\r
+       char *Symbolname;\r
+\r
+       //if ((DBGType & DBG_HWLABEL) || vjs.displayHWlabels)\r
+       if (vjs.displayHWlabels)\r
+       {\r
+               Symbolname = HWLABELManager_GetSymbolnameFromAdr(Adr);\r
+       }\r
+       else\r
+       {\r
+               Symbolname = NULL;\r
+       }\r
+#ifdef _MSC_VER
+#pragma message("Warning: !!! Need to set the DBG_HWLABEL in DBGType instead to use the setting value !!!")
+#else
+       #warning "!!! Need to set the DBG_HWLABEL in DBGType instead to use the setting value !!!"
+#endif // _MSC_VER\r
+\r
+       if (Symbolname == NULL)\r
+       {\r
+               if ((DBGType & DBG_ELFDWARF))\r
+               {\r
+                       Symbolname = DWARFManager_GetSymbolnameFromAdr(Adr);\r
+               }\r
+\r
+               if ((DBGType & DBG_ELF) && (Symbolname == NULL))\r
+               {\r
+                       Symbolname = ELFManager_GetSymbolnameFromAdr(Adr);\r
+               }\r
+       }\r
+\r
+       return  Symbolname;\r
+}\r
+\r
+\r
+// Get source line based on the Address and his Tag\r
+// Return text pointer on the source line found\r
+// Return NULL if no source line has been found\r
+char *DBGManager_GetLineSrcFromAdr(size_t Adr, size_t Tag)\r
+{\r
+       char *Symbolname = NULL;\r
+\r
+       if ((DBGType & DBG_ELFDWARF))\r
+       {\r
+               Symbolname = DWARFManager_GetLineSrcFromAdr(Adr, Tag);\r
+       }\r
+\r
+       return  Symbolname;\r
+}\r
+\r
+\r
+// Get text line from source based on address and num line (starting by 1)\r
+// Return NULL if no text line has been found\r
+char *DBGManager_GetLineSrcFromAdrNumLine(size_t Adr, size_t NumLine)\r
+{\r
+       char *Symbolname = NULL;\r
+\r
+       if ((DBGType & DBG_ELFDWARF))\r
+       {\r
+               Symbolname = DWARFManager_GetLineSrcFromAdrNumLine(Adr, NumLine);\r
+       }\r
+\r
+       return  Symbolname;\r
+}\r
+\r
+\r
+// Get text line from source based on address and num line (starting by 1)\r
+// Return NULL if no text line has been found\r
+char *DBGManager_GetLineSrcFromNumLineBaseAdr(size_t Adr, size_t NumLine)\r
+{\r
+       char *Symbolname = NULL;\r
+\r
+       if ((DBGType & DBG_ELFDWARF))\r
+       {\r
+               Symbolname = DWARFManager_GetLineSrcFromNumLineBaseAdr(Adr, NumLine);\r
+       }\r
+\r
+       return  Symbolname;\r
+}\r
+\r
index 865c96f..87e0900 100644 (file)
@@ -1,77 +1,77 @@
-
-
-#ifndef __DBGMANAGER_H__
-#define __DBGMANAGER_H__
-
-
-typedef enum {
-       DBG_NO_TYPE = 0x0,
-       DBG_ELF = 0x1,
-       DBG_DWARF = 0x2,
-       DBG_ELFDWARF = 0x4,
-       DBG_HWLABEL = 0x8,
-       DBG_END_TYPE
-}DBGTYPE;
-
-// Tag based in the DW_TAG_... list from the dwarf.h
-typedef enum {
-       DBG_NO_TAG = 0x0,
-       DBG_TAG_pointer_type = 0x0f,
-       DBG_TAG_compile_unit = 0x11,
-       DBG_TAG_base_type = 0x24,
-       DBG_TAG_subprogram = 0x2e,
-       DBG_END_TAG
-}DBGTAG;
-
-// Encoding based in the DW_ATE_... list from the dwarf.h
-// Except for the DBG_ATE_ptr
-typedef enum {
-       DBG_NO_TYPEENCODING,
-       DBG_ATE_address = 0x1,                                  // linear machine address
-       DBG_ATE_boolean = 0x2,                                  // true or false
-       DBG_ATE_complex_float = 0x3,                    // complex floating-point number
-       DBG_ATE_float = 0x4,                                    // floating-point number
-       DBG_ATE_signed = 0x5,                                   // signed binary integer
-       DBG_ATE_signed_char = 0x6,                              // signed character
-       DBG_ATE_unsigned = 0x7,                                 // unsigned binary integer
-       DBG_ATE_unsigned_char = 0x8,                    // unsigned character
-       DBG_ATE_imaginary_float = 0x9,                  /* DWARF3 */
-       DBG_ATE_packed_decimal = 0xa,                   /* DWARF3f */
-       DBG_ATE_numeric_string = 0xb,                   /* DWARF3f */
-       DBG_ATE_edited = 0xc,                                   /* DWARF3f */
-       DBG_ATE_signed_fixed = 0xd,                             /* DWARF3f */
-       DBG_ATE_unsigned_fixed = 0xe,                   /* DWARF3f */
-       DBG_ATE_decimal_float = 0xf,                    /* DWARF3f */
-       DBG_ATE_ptr = 0x10,                                             // Specific to DBG Manager to represent pointer type
-       DBG_END_TYPEENCODING
-}DBGTYPEENCODING;
-
-
-//
-extern void    DBGManager_Init(void);
-extern void    DBGManager_SetType(int DBGTypeSet);
-extern void    DBGManager_Reset(void);
-extern void    DBGManager_Close(void);
-
-//
-extern char    *DBGManager_GetSymbolnameFromAdr(size_t Adr);
-extern char    *DBGManager_GetFullSourceFilenameFromAdr(size_t Adr, bool *Error);
-extern size_t DBGManager_GetNumLineFromAdr(size_t Adr, size_t Tag);
-extern char *DBGManager_GetLineSrcFromAdr(size_t Adr, size_t Tag);
-extern char *DBGManager_GetLineSrcFromAdrNumLine(size_t Adr, size_t NumLine);
-extern char *DBGManager_GetLineSrcFromNumLineBaseAdr(size_t Adr, size_t NumLine);
-
-// External variables manager
-extern size_t DBGManager_GetNbExternalVariables(void);
-extern char *DBGManager_GetExternalVariableName(size_t Index);
-extern size_t DBGManager_GetExternalVariableTypeEncoding(size_t Index);
-extern char *DBGManager_GetExternalVariableTypeName(size_t Index);
-extern size_t DBGManager_GetExternalVariableTypeByteSize(size_t Index);
-extern size_t DBGManager_GetExternalVariableAdr(size_t Index);
-extern size_t DBGManager_GetExternalVariableAdrFromName(char *VariableName);
-extern size_t DBGManager_GetAdrFromSymbolName(char *SymbolName);
-extern char *DBGManager_GetExternalVariableValue(size_t Index);
-extern size_t DBGManager_GetExternalVariableTypeTag(size_t Index);
-
-
-#endif // __DBGMANAGER_H__
+\r
+\r
+#ifndef __DBGMANAGER_H__\r
+#define __DBGMANAGER_H__\r
+\r
+\r
+typedef enum {\r
+       DBG_NO_TYPE = 0x0,\r
+       DBG_ELF = 0x1,\r
+       DBG_DWARF = 0x2,\r
+       DBG_ELFDWARF = 0x4,\r
+       DBG_HWLABEL = 0x8,\r
+       DBG_END_TYPE\r
+}DBGTYPE;\r
+\r
+// Tag based in the DW_TAG_... list from the dwarf.h\r
+typedef enum {\r
+       DBG_NO_TAG = 0x0,\r
+       DBG_TAG_pointer_type = 0x0f,\r
+       DBG_TAG_compile_unit = 0x11,\r
+       DBG_TAG_base_type = 0x24,\r
+       DBG_TAG_subprogram = 0x2e,\r
+       DBG_END_TAG\r
+}DBGTAG;\r
+\r
+// Encoding based in the DW_ATE_... list from the dwarf.h\r
+// Except for the DBG_ATE_ptr\r
+typedef enum {\r
+       DBG_NO_TYPEENCODING,\r
+       DBG_ATE_address = 0x1,                                  // linear machine address\r
+       DBG_ATE_boolean = 0x2,                                  // true or false\r
+       DBG_ATE_complex_float = 0x3,                    // complex floating-point number\r
+       DBG_ATE_float = 0x4,                                    // floating-point number\r
+       DBG_ATE_signed = 0x5,                                   // signed binary integer\r
+       DBG_ATE_signed_char = 0x6,                              // signed character\r
+       DBG_ATE_unsigned = 0x7,                                 // unsigned binary integer\r
+       DBG_ATE_unsigned_char = 0x8,                    // unsigned character\r
+       DBG_ATE_imaginary_float = 0x9,                  /* DWARF3 */\r
+       DBG_ATE_packed_decimal = 0xa,                   /* DWARF3f */\r
+       DBG_ATE_numeric_string = 0xb,                   /* DWARF3f */\r
+       DBG_ATE_edited = 0xc,                                   /* DWARF3f */\r
+       DBG_ATE_signed_fixed = 0xd,                             /* DWARF3f */\r
+       DBG_ATE_unsigned_fixed = 0xe,                   /* DWARF3f */\r
+       DBG_ATE_decimal_float = 0xf,                    /* DWARF3f */\r
+       DBG_ATE_ptr = 0x10,                                             // Specific to DBG Manager to represent pointer type\r
+       DBG_END_TYPEENCODING\r
+}DBGTYPEENCODING;\r
+\r
+\r
+//\r
+extern void    DBGManager_Init(void);\r
+extern void    DBGManager_SetType(size_t DBGTypeSet);\r
+extern void    DBGManager_Reset(void);\r
+extern void    DBGManager_Close(void);\r
+\r
+//\r
+extern char    *DBGManager_GetSymbolnameFromAdr(size_t Adr);\r
+extern char    *DBGManager_GetFullSourceFilenameFromAdr(size_t Adr, bool *Error);\r
+extern size_t DBGManager_GetNumLineFromAdr(size_t Adr, size_t Tag);\r
+extern char *DBGManager_GetLineSrcFromAdr(size_t Adr, size_t Tag);\r
+extern char *DBGManager_GetLineSrcFromAdrNumLine(size_t Adr, size_t NumLine);\r
+extern char *DBGManager_GetLineSrcFromNumLineBaseAdr(size_t Adr, size_t NumLine);\r
+\r
+// External variables manager\r
+extern size_t DBGManager_GetNbExternalVariables(void);\r
+extern char *DBGManager_GetExternalVariableName(size_t Index);\r
+extern size_t DBGManager_GetExternalVariableTypeEncoding(size_t Index);\r
+extern char *DBGManager_GetExternalVariableTypeName(size_t Index);\r
+extern size_t DBGManager_GetExternalVariableTypeByteSize(size_t Index);\r
+extern size_t DBGManager_GetExternalVariableAdr(size_t Index);\r
+extern size_t DBGManager_GetExternalVariableAdrFromName(char *VariableName);\r
+extern size_t DBGManager_GetAdrFromSymbolName(char *SymbolName);\r
+extern char *DBGManager_GetExternalVariableValue(size_t Index);\r
+extern size_t DBGManager_GetExternalVariableTypeTag(size_t Index);\r
+\r
+\r
+#endif // __DBGMANAGER_H__\r
index 85262a5..ac69f90 100644 (file)
-//
-// ELFManager.cpp: HW Label manager
-//
-// by Jean-Paul Mari
-//
-// JPM = Jean-Paul Mari <djipi.mari@gmail.com>
-//
-// WHO  WHEN        WHAT
-// ---  ----------  ------------------------------------------------------------
-// JPM  02/08/2017  Created this file
-// JPM  02/08/2017  HW Label support
-//
-
-#include <stdlib.h>
-#include <string.h>
-#include "libelf/libelf.h"
-#include "libelf/gelf.h"
-#include "log.h"
-#include "ELFManager.h"
-
-
-typedef enum {
-       HWLABEL_NO_SIZE = 0,
-       HWLABEL_8BITS = 1,
-       HWLABEL_16BITS = 2,
-       HWLABEL_32BITS = 4,
-       HWLABEL_64BITS = 8
-}HWLABELSIZE;
-
-
-typedef enum {
-       HWLABEL_NO_ACCESS = 0,
-       HWLABEL_R = 0x1,
-       HWLABEL_W = 0x2,
-       HWLABEL_O = 0x4
-}HWLABELACCESS;
-
-
-typedef struct {
-       size_t HWLABELAdr;
-       const char *HWLABELSymbolName;
-       const char *HWLABELFulllName;
-       size_t HWLABELSize;
-       size_t HWLABELAccess;
-}HWLABELTab;
-
-
-// Memory map list based on the scans from the Version 2.4 - June 7, 1995
-HWLABELTab     HWLABELTabSectionType[] =       {
-// Internal Memory Map
-       {       0xF00000, "MEMCON1", "Memory Configuration Register One", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },
-       {       0xF00002, "MEMCON2", "Memory Configuration Register Two", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },
-       {       0xF00004, "HC", "Horizontal Count", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },
-       {       0xF00006, "VC", "Vertical Count", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },
-       {       0xF00008, "LPH", "Horizontal Light-pen", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O)        },
-       {       0xF0000A, "LPV", "Vertical Light-pen", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O)  },
-       {       0xF00010, "OB[0]", "Object Code", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O)       },
-       {       0xF00012, "OB[1]", "Object Code", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O)       },
-       {       0xF00014, "OB[2]", "Object Code", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O)       },
-       {       0xF00016, "OB[3]", "Object Code", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O)       },
-       {       0xF00020, "OLP", "Object List Pointer", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF00026, "OBF", "Object Processor flag", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF00028, "VMODE", "Video Mode", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF0002A, "BORD1", "Border Colour (Red & Green)", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF0002C, "BORD2", "Border Colour (Blue)", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF0002E, "HP", "Horizontal Period", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF00030, "HBB", "Horizontal Blanking Begin", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF00032, "HBE", "Horizontal Blanking End", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF00034, "HS", "Horizontal Sync", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF00036, "HVS", "Horizontal Vertical Sync", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF00038, "HDB1", "Horizontal Display Begin 1", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF0003A, "HDB2", "Horizontal Display Begin 2", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF0003C, "HDE", "Horizontal Display End", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF0003E, "VP", "Vertical Period", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF00040, "VBB", "Vertical Blanking Begin", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF00042, "VBE", "Vertical Blanking End", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF00044, "VS", "Vertical Sync", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF00046, "VDB", "Vertical Display Begin", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF00048, "VDE", "Vertical Display End", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF0004A, "VEB", "Vertical Equalization Begin", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF0004C, "VEE", "Vertical Equalization End", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF0004E, "VI", "Vertical Interrupt", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF00050, "PIT[0]", "Programmable Interrupt Timer", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF00052, "PIT[1]", "Programmable Interrupt Timer", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF00054, "HEQ", "Horizontal equalization end", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF00058, "BG", "Background Colour", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF000E0, "INT1", "CPU Interrupt Control Register", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },
-       {       0xF000E2, "INT2", "CPU Interrupt resume register", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF00400, "CLUT", "Colour Look-Up Table", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },
-       {       0xF00800, "LBUF", "Line Buffer A", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },
-       {       0xF01000, "LBUF", "Line Buffer B", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },
-       {       0xF01800, "LBUF", "Line Buffer selected for writing", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },
-// Internal registers of the Graphics processor
-       {       0xF02100, "G_FLAGS", "GPU Flags Register", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },
-       {       0xF02104, "G_MTXC", "Matrix Control Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02108, "G_MTXA", "Matrix Address Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF0210C, "G_END", "Data Organisation Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02110, "G_PC", "GPU Program Counter", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },
-       {       0xF02114, "G_CTRL", "GPU Control/Status Register", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W)      },
-       {       0xF02118, "G_HIDATA", "High Data Register", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W)     },
-       {       0xF0211C, "G_REMAIN", "Divide unit remainder", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_O) },
-       {       0xF0211C, "G_DIVCTRL", "Divide unit Control", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-// List of all the externally accessible locations within the Blitter.
-       {       0xF02200, "A1_BASE", "A1 Base Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02204, "A1_FLAGS", "A1 Flags Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02208, "A1_CLIP", "A1 Clipping Size", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF0220C, "A1_PIXEL", "A1 Pixel Pointer", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W)       },
-       {       0xF02210, "A1_STEP", "A1 Step Value", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02214, "A1_FSTEP", "A1 Step Fraction Value", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02218, "A1_FPIXEL", "A1 Pixel Pointer Fraction", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },
-       {       0xF0221C, "A1_INC", "A1 Increment", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02220, "A1_FINC", "A1 Increment Fraction", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02224, "A2_BASE", "A2 Base Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02228, "A2_FLAGS", "A2 Flags Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF0222C, "A2_MASK", "A2 Window Mask", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02230, "A2_PIXEL", "A2 Pixel Pointer", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },
-       {       0xF02234, "A2_STEP", "A2 Step Value", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02238, "B_CMD", "Command Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02238, "B_CMD", "Status Register", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_O) },
-       {       0xF0223C, "B_COUNT", "Counters Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02240, "B_SRCD", "Source Data Register", HWLABEL_64BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02248, "B_DSTD", "Destination Data Register", HWLABEL_64BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02250, "B_DSTZ", "Destination Z Register", HWLABEL_64BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02258, "B_SRCZ1", "Source Z Register 1", HWLABEL_64BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02260, "B_SRCZ2", "Source Z Register 2", HWLABEL_64BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02268, "B_PATD", "Pattern Data Register", HWLABEL_64BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02270, "B_IINC", "Intensity Increment", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02274, "B_ZINC", "Z Increment", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02278, "B_STOP", "Collision control", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF0227C, "B_I3", "Intensity 3", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02280, "B_I2", "Intensity 2", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02284, "B_I1", "Intensity 1", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02288, "B_I0", "Intensity 0", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF0228C, "B_Z3", "Z 3", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02290, "B_Z2", "Z 2", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02294, "B_Z1", "Z 1", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF02298, "B_Z0", "Z 0", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-// GPU Ram base
-       //{     0xF03000, "GPU_RAMBASE", "Local RAM base", HWLABEL_8BITS, (HWLABEL_R | HWLABEL_W) },
-// Frequency dividers
-       {       0xF10010, "CLK1", "Processor clock divider", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF10012, "CLK2", "Video clock divider", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF10014, "CLK3", "Chroma clock divider", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-// Programmable Timers
-       {       0xF10000, "JPIT1", "Timer 1 Pre-scaler", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF10004, "JPIT3", "Timer 2 Pre-scaler", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF10002, "JPIT2", "Timer 1 Divider", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF10006, "JPIT4", "Timer 2 Divider", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       //{     0xF10036, "JPIT1", "Timer 1 Pre-scaler", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O) },
-       //{     0xF10038, "JPIT2", "Timer 1 Divider", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O) },
-       //{     0xF1003A, "JPIT3", "Timer 2 Pre-scaler", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O) },
-       //{     0xF1003C, "JPIT4", "Timer 2 Divider", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O) },
-// Interrupts
-       {       0xF10020, "JINTCTRL", "Interrupt Control Register", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },
-// JERRY Pulse Width Modulation DACs
-       //{     0xF1A140, "DAC1", "Left DAC", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       //{     0xF1A144, "DAC2", "Right DAC", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-// Synchronous Serial Interface
-       {       0xF1A150, "SCLK", "Serial Clock Frequency", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF1A154, "SMODE", "Serial Mode", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF1A148, "R_DAC", "Right transmit data (to DACs)", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF1A14C, "L_DAC", "Left transmit data (to DACs)", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF1A148, "LTXD", "Left transmit data (to I2S)", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF1A14C, "RTXD", "Right transmit data (to I2S)", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF1A148, "LRXD", "Left receive data (to I2S)", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_O) },
-       {       0xF1A14C, "RRXD", "Right receive data (to I2S)", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_O) },
-       {       0xF1A150, "SSTAT", "Serial Status", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_O) },
-// Asynchronous Serial Interface (ComLynx and Midi)
-       {       0xF10034, "ASICLK", "Asynchronous Serial Interface Clock", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },
-       {       0xF10032, "ASICTRL", "Asynchronous Serial Control", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF10032, "ASISTAT", "Asynchronous Serial Status", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O) },
-       {       0xF10030, "ASIDATA", "Asynchronous Serial Data", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },
-// Joystick Interface
-       {       0xF14000, "JOYSTICK", "Joystick register", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },
-       {       0xF14002, "JOYBUTS", "Button register", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },
-// Internal Registers
-       {       0xF1A100, "D_FLAGS", "DSP Flags Register", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },
-       {       0xF1A104, "D_MTXC", "DSP Matrix Control Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF1A108, "D_MTXA", "DSP Matrix Address Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF1A10C, "D_END", "DSP Data Organisation Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF1A110, "D_PC", "DSP Program Counter", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },
-       {       0xF1A114, "D_CTRL", "DSP Control/Status Register", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },
-       {       0xF1A118, "D_MOD", "Modulo instruction mask", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF1A11C, "D_REMAIN", "Divide unit remainder", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },
-       {       0xF1A11C, "D_DIVCTRL", "Divide unit Control", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },
-       {       0xF1A120, "D_MACHI", "Multiply & Acccumulate High Bits", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_O) },
-// End of the Memory map list
-       {       (size_t)-1, NULL, NULL, HWLABEL_NO_SIZE, HWLABEL_NO_ACCESS }
-};
-
-
-// Get Symbol name from his address
-char *HWLABELManager_GetSymbolnameFromAdr(size_t Adr)
-{
-       int i = 0;
-       while ((HWLABELTabSectionType[i].HWLABELAdr != Adr) && (HWLABELTabSectionType[i++].HWLABELAdr != (size_t)-1));
-       return (char *)HWLABELTabSectionType[i].HWLABELSymbolName;
-}
-
+//\r
+// ELFManager.cpp: HW Label manager\r
+//\r
+// by Jean-Paul Mari\r
+//\r
+// JPM = Jean-Paul Mari <djipi.mari@gmail.com>\r
+//\r
+// WHO  WHEN        WHAT\r
+// ---  ----------  ------------------------------------------------------------\r
+// JPM  02/08/2017  Created this file\r
+// JPM  02/08/2017  HW Label support\r
+//\r
+\r
+#include <stdlib.h>\r
+#include <string.h>\r
+#include "libelf/libelf.h"\r
+#include "libelf/gelf.h"\r
+#include "log.h"\r
+#include "ELFManager.h"\r
+\r
+\r
+typedef enum {\r
+       HWLABEL_NO_SIZE = 0,\r
+       HWLABEL_8BITS = 1,\r
+       HWLABEL_16BITS = 2,\r
+       HWLABEL_32BITS = 4,\r
+       HWLABEL_64BITS = 8\r
+}HWLABELSIZE;\r
+\r
+typedef enum {\r
+       HWLABEL_NO_ACCESS = 0,\r
+       HWLABEL_R = 0x1,\r
+       HWLABEL_W = 0x2,\r
+       HWLABEL_O = 0x4\r
+}HWLABELACCESS;\r
+\r
+typedef struct {\r
+       size_t HWLABELAdr;\r
+       const char *HWLABELSymbolName;\r
+       const char *HWLABELFulllName;\r
+       size_t HWLABELSize;\r
+       size_t HWLABELAccess;\r
+}HWLABELTab;\r
+\r
+#define NBHWLABELS (sizeof(HWLABELTabSectionType) / sizeof(HWLABELTab))\r
+\r
+\r
+// Memory map list based on the scans from the Version 2.4 - June 7, 1995\r
+HWLABELTab     HWLABELTabSectionType[] =       {\r
+// Internal Memory Map\r
+       {       0xF00000, "MEMCON1", "Memory Configuration Register One", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },\r
+       {       0xF00002, "MEMCON2", "Memory Configuration Register Two", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },\r
+       {       0xF00004, "HC", "Horizontal Count", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },\r
+       {       0xF00006, "VC", "Vertical Count", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },\r
+       {       0xF00008, "LPH", "Horizontal Light-pen", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O)        },\r
+       {       0xF0000A, "LPV", "Vertical Light-pen", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O)  },\r
+       {       0xF00010, "OB[0]", "Object Code", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O)       },\r
+       {       0xF00012, "OB[1]", "Object Code", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O)       },\r
+       {       0xF00014, "OB[2]", "Object Code", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O)       },\r
+       {       0xF00016, "OB[3]", "Object Code", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O)       },\r
+       {       0xF00020, "OLP", "Object List Pointer", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF00026, "OBF", "Object Processor flag", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF00028, "VMODE", "Video Mode", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF0002A, "BORD1", "Border Colour (Red & Green)", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF0002C, "BORD2", "Border Colour (Blue)", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF0002E, "HP", "Horizontal Period", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF00030, "HBB", "Horizontal Blanking Begin", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF00032, "HBE", "Horizontal Blanking End", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF00034, "HS", "Horizontal Sync", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF00036, "HVS", "Horizontal Vertical Sync", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF00038, "HDB1", "Horizontal Display Begin 1", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF0003A, "HDB2", "Horizontal Display Begin 2", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF0003C, "HDE", "Horizontal Display End", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF0003E, "VP", "Vertical Period", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF00040, "VBB", "Vertical Blanking Begin", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF00042, "VBE", "Vertical Blanking End", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF00044, "VS", "Vertical Sync", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF00046, "VDB", "Vertical Display Begin", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF00048, "VDE", "Vertical Display End", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF0004A, "VEB", "Vertical Equalization Begin", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF0004C, "VEE", "Vertical Equalization End", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF0004E, "VI", "Vertical Interrupt", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF00050, "PIT[0]", "Programmable Interrupt Timer", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF00052, "PIT[1]", "Programmable Interrupt Timer", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF00054, "HEQ", "Horizontal equalization end", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF00058, "BG", "Background Colour", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF000E0, "INT1", "CPU Interrupt Control Register", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },\r
+       {       0xF000E2, "INT2", "CPU Interrupt resume register", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF00400, "CLUT", "Colour Look-Up Table", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },\r
+       {       0xF00800, "LBUF", "Line Buffer A", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },\r
+       {       0xF01000, "LBUF", "Line Buffer B", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },\r
+       {       0xF01800, "LBUF", "Line Buffer selected for writing", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },\r
+// Internal registers of the Graphics processor\r
+       {       0xF02100, "G_FLAGS", "GPU Flags Register", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },\r
+       {       0xF02104, "G_MTXC", "Matrix Control Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02108, "G_MTXA", "Matrix Address Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF0210C, "G_END", "Data Organisation Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02110, "G_PC", "GPU Program Counter", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },\r
+       {       0xF02114, "G_CTRL", "GPU Control/Status Register", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W)      },\r
+       {       0xF02118, "G_HIDATA", "High Data Register", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W)     },\r
+       {       0xF0211C, "G_REMAIN", "Divide unit remainder", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_O) },\r
+       {       0xF0211C, "G_DIVCTRL", "Divide unit Control", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+// List of all the externally accessible locations within the Blitter.\r
+       {       0xF02200, "A1_BASE", "A1 Base Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02204, "A1_FLAGS", "A1 Flags Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02208, "A1_CLIP", "A1 Clipping Size", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF0220C, "A1_PIXEL", "A1 Pixel Pointer", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W)       },\r
+       {       0xF02210, "A1_STEP", "A1 Step Value", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02214, "A1_FSTEP", "A1 Step Fraction Value", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02218, "A1_FPIXEL", "A1 Pixel Pointer Fraction", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },\r
+       {       0xF0221C, "A1_INC", "A1 Increment", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02220, "A1_FINC", "A1 Increment Fraction", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02224, "A2_BASE", "A2 Base Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02228, "A2_FLAGS", "A2 Flags Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF0222C, "A2_MASK", "A2 Window Mask", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02230, "A2_PIXEL", "A2 Pixel Pointer", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },\r
+       {       0xF02234, "A2_STEP", "A2 Step Value", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02238, "B_CMD", "Command Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02238, "B_CMD", "Status Register", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_O) },\r
+       {       0xF0223C, "B_COUNT", "Counters Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02240, "B_SRCD", "Source Data Register", HWLABEL_64BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02248, "B_DSTD", "Destination Data Register", HWLABEL_64BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02250, "B_DSTZ", "Destination Z Register", HWLABEL_64BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02258, "B_SRCZ1", "Source Z Register 1", HWLABEL_64BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02260, "B_SRCZ2", "Source Z Register 2", HWLABEL_64BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02268, "B_PATD", "Pattern Data Register", HWLABEL_64BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02270, "B_IINC", "Intensity Increment", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02274, "B_ZINC", "Z Increment", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02278, "B_STOP", "Collision control", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF0227C, "B_I3", "Intensity 3", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02280, "B_I2", "Intensity 2", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02284, "B_I1", "Intensity 1", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02288, "B_I0", "Intensity 0", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF0228C, "B_Z3", "Z 3", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02290, "B_Z2", "Z 2", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02294, "B_Z1", "Z 1", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF02298, "B_Z0", "Z 0", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+// GPU Ram base\r
+       //{     0xF03000, "GPU_RAMBASE", "Local RAM base", HWLABEL_8BITS, (HWLABEL_R | HWLABEL_W) },\r
+// Frequency dividers\r
+       {       0xF10010, "CLK1", "Processor clock divider", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF10012, "CLK2", "Video clock divider", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF10014, "CLK3", "Chroma clock divider", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+// Programmable Timers\r
+       {       0xF10000, "JPIT1", "Timer 1 Pre-scaler", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF10004, "JPIT3", "Timer 2 Pre-scaler", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF10002, "JPIT2", "Timer 1 Divider", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF10006, "JPIT4", "Timer 2 Divider", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       //{     0xF10036, "JPIT1", "Timer 1 Pre-scaler", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O) },\r
+       //{     0xF10038, "JPIT2", "Timer 1 Divider", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O) },\r
+       //{     0xF1003A, "JPIT3", "Timer 2 Pre-scaler", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O) },\r
+       //{     0xF1003C, "JPIT4", "Timer 2 Divider", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O) },\r
+// Interrupts\r
+       {       0xF10020, "JINTCTRL", "Interrupt Control Register", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },\r
+// JERRY Pulse Width Modulation DACs\r
+       //{     0xF1A140, "DAC1", "Left DAC", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       //{     0xF1A144, "DAC2", "Right DAC", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+// Synchronous Serial Interface\r
+       {       0xF1A150, "SCLK", "Serial Clock Frequency", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF1A154, "SMODE", "Serial Mode", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF1A148, "R_DAC", "Right transmit data (to DACs)", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF1A14C, "L_DAC", "Left transmit data (to DACs)", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF1A148, "LTXD", "Left transmit data (to I2S)", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF1A14C, "RTXD", "Right transmit data (to I2S)", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF1A148, "LRXD", "Left receive data (to I2S)", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_O) },\r
+       {       0xF1A14C, "RRXD", "Right receive data (to I2S)", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_O) },\r
+       {       0xF1A150, "SSTAT", "Serial Status", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_O) },\r
+// Asynchronous Serial Interface (ComLynx and Midi)\r
+       {       0xF10034, "ASICLK", "Asynchronous Serial Interface Clock", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },\r
+       {       0xF10032, "ASICTRL", "Asynchronous Serial Control", HWLABEL_16BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF10032, "ASISTAT", "Asynchronous Serial Status", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_O) },\r
+       {       0xF10030, "ASIDATA", "Asynchronous Serial Data", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },\r
+// Joystick Interface\r
+       {       0xF14000, "JOYSTICK", "Joystick register", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },\r
+       {       0xF14002, "JOYBUTS", "Button register", HWLABEL_16BITS, (HWLABEL_R | HWLABEL_W) },\r
+// Internal Registers\r
+       {       0xF1A100, "D_FLAGS", "DSP Flags Register", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },\r
+       {       0xF1A104, "D_MTXC", "DSP Matrix Control Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF1A108, "D_MTXA", "DSP Matrix Address Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF1A10C, "D_END", "DSP Data Organisation Register", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF1A110, "D_PC", "DSP Program Counter", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },\r
+       {       0xF1A114, "D_CTRL", "DSP Control/Status Register", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },\r
+       {       0xF1A118, "D_MOD", "Modulo instruction mask", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF1A11C, "D_REMAIN", "Divide unit remainder", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_W) },\r
+       {       0xF1A11C, "D_DIVCTRL", "Divide unit Control", HWLABEL_32BITS, (HWLABEL_W | HWLABEL_O) },\r
+       {       0xF1A120, "D_MACHI", "Multiply & Acccumulate High Bits", HWLABEL_32BITS, (HWLABEL_R | HWLABEL_O) },\r
+// End of the Memory map list\r
+//     {       (size_t)-1, NULL, NULL, HWLABEL_NO_SIZE, HWLABEL_NO_ACCESS }\r
+};\r
+\r
+\r
+// Get Symbol name from his address\r
+char *HWLABELManager_GetSymbolnameFromAdr(size_t Adr)\r
+{\r
+       size_t i;\r
+\r
+       if ((Adr >= 0xF00000) && (Adr < 0xF1A124))\r
+       {\r
+               for (i = 0; i < NBHWLABELS; i++)\r
+               {\r
+                       if ((HWLABELTabSectionType[i].HWLABELAdr == Adr))\r
+                       {\r
+                               return (char *)HWLABELTabSectionType[i].HWLABELSymbolName;\r
+                       }\r
+               }\r
+       }\r
+\r
+       return NULL;\r
+\r
+       //while ((HWLABELTabSectionType[i].HWLABELAdr != Adr) && (HWLABELTabSectionType[i++].HWLABELAdr != (size_t)-1));\r
+       //return (char *)HWLABELTabSectionType[i].HWLABELSymbolName;\r
+}\r
+\r
index 2a29a40..032db33 100644 (file)
@@ -53,31 +53,31 @@ DebuggerTab::~DebuggerTab()
 }\r
 \r
 \r
 }\r
 \r
 \r
-// Save / Update the settings from the tabs dialog
-void DebuggerTab::SetSettings(void)
-{
-       bool ok;
-
-       //strcpy(vjs.debuggerROMPath, debuggerTab->edit1->text().toUtf8().data());
-       //strcpy(vjs.absROMPath, debuggerTab->edit2->text().toUtf8().data());
-       vjs.nbrdisasmlines = edit3->text().toUInt(&ok, 10);
-       //vjs.allowWritesToROM = debuggerTab->writeROM->isChecked();
-       vjs.displayHWlabels = displayHWlabels->isChecked();
-       vjs.disasmopcodes = disasmopcodes->isChecked();
-       vjs.displayFullSourceFilename = displayFullSourceFilename->isChecked();
-}
-
-
-// Load / Update the tabs dialog from the settings
-void DebuggerTab::GetSettings(void)
-{
-       QVariant v(vjs.nbrdisasmlines);
-       //debuggerTab->edit1->setText(vjs.debuggerROMPath);
-       //debuggerTab->edit2->setText(vjs.absROMPath);
-       edit3->setText(v.toString());
-       //debuggerTab->writeROM->setChecked(vjs.allowWritesToROM
-       displayHWlabels->setChecked(vjs.displayHWlabels);
-       disasmopcodes->setChecked(vjs.disasmopcodes);
-       displayFullSourceFilename->setChecked(vjs.displayFullSourceFilename);
-}
-
+// Save / Update the settings from the tabs dialog\r
+void DebuggerTab::SetSettings(void)\r
+{\r
+       bool ok;\r
+\r
+       //strcpy(vjs.debuggerROMPath, debuggerTab->edit1->text().toUtf8().data());\r
+       //strcpy(vjs.absROMPath, debuggerTab->edit2->text().toUtf8().data());\r
+       vjs.nbrdisasmlines = edit3->text().toUInt(&ok, 10);\r
+       //vjs.allowWritesToROM = debuggerTab->writeROM->isChecked();\r
+       vjs.displayHWlabels = displayHWlabels->isChecked();\r
+       vjs.disasmopcodes = disasmopcodes->isChecked();\r
+       vjs.displayFullSourceFilename = displayFullSourceFilename->isChecked();\r
+}\r
+\r
+\r
+// Load / Update the tabs dialog from the settings\r
+void DebuggerTab::GetSettings(void)\r
+{\r
+       QVariant v(vjs.nbrdisasmlines);\r
+       //debuggerTab->edit1->setText(vjs.debuggerROMPath);\r
+       //debuggerTab->edit2->setText(vjs.absROMPath);\r
+       edit3->setText(v.toString());\r
+       //debuggerTab->writeROM->setChecked(vjs.allowWritesToROM\r
+       displayHWlabels->setChecked(vjs.displayHWlabels);\r
+       disasmopcodes->setChecked(vjs.disasmopcodes);\r
+       displayFullSourceFilename->setChecked(vjs.displayFullSourceFilename);\r
+}\r
+\r
index 17ed90d..5d228db 100644 (file)
@@ -603,8 +603,7 @@ MainWin::MainWin(bool autoRun): running(true), powerButtonOn(false),
        //      Create status bar
        statusBar()->showMessage(tr("Ready"));
        ReadUISettings();
        //      Create status bar
        statusBar()->showMessage(tr("Ready"));
        ReadUISettings();
-       // Do this in case original size isn't correct (mostly for the first-run
-       // case)
+       // Do this in case original size isn't correct (mostly for the first-run case)
        ResizeMainWindow();
 
        // Create our test pattern bitmaps
        ResizeMainWindow();
 
        // Create our test pattern bitmaps