ide/debugger: Improved fallback to GDB on watch evaluation
authorJerome St-Louis <jerome@ecere.com>
Fri, 16 Aug 2013 18:25:57 +0000 (14:25 -0400)
committerJerome St-Louis <jerome@ecere.com>
Fri, 16 Aug 2013 18:25:57 +0000 (14:25 -0400)
- Support for dumping whole structures

ide/src/debugger/Debugger.ec
ide/src/debugger/debugTools.ec

index aece6f6..08b36a1 100644 (file)
@@ -2771,7 +2771,7 @@ class Debugger
                            wh.value = CopyString(item.name);
                         else
                            wh.value = CopyString($"Invalid Enum Value");
-                        result = (bool)atoi(exp.constant);
+                        result = true;
                      }
                      else if(wh.type && (wh.type.kind == charType || (wh.type.kind == classType && wh.type._class && 
                               wh.type._class.registered && !strcmp(wh.type._class.registered.fullName, "ecere::com::unichar"))) )
@@ -2846,14 +2846,14 @@ class Debugger
                      else
                      {
                         wh.value = CopyString(exp.constant);
-                        result = (bool)atoi(exp.constant);
+                        result = true;
                      }
                      break;
                   default:
                      if(exp.hasAddress)
                      {
                         wh.value = PrintHexUInt64(exp.address);
-                        result = (bool)exp.address;
+                        result = true;
                      }
                      else
                      {
index c549a18..eada163 100644 (file)
@@ -59,7 +59,8 @@ static char GetGdbFormatChar(Type type)
       case unionType:
       case functionType:
       case arrayType:
-         return 'u';
+         // return 'u';
+         return 0;
       case ellipsisType:
       case enumType:
       case methodType:
@@ -463,37 +464,45 @@ void DebugComputeExpression(Expression exp)
                         GetUInt64(exp1, &address);
                         size = ComputeTypeSize(exp.expType); //exp.expType.arrayType.size;
                         format = GetGdbFormatChar(exp.expType);
-                        evaluation = Debugger::ReadMemory(address, size, format, &evalError);
-                        if(evalError != dummyExp)
+                        if(format)
                         {
-                           exp1.type = evalError;
-                           exp1.constant = PrintHexUInt64(address);
-                           expError = exp1;
-                        }
-                        else
-                        {
-                           if(evaluation)
+                           evaluation = Debugger::ReadMemory(address, size, format, &evalError);
+                           if(evalError != dummyExp)
                            {
-                              expNew = ParseExpressionString(evaluation);
-                              expNew.address = address;
-                              expNew.hasAddress = true;
-                              delete evaluation;
-                              expNew.destType = exp.expType;
-                              FreeType(exp.destType);
-                              FreeExpContents(exp);
-                              ProcessExpressionType(expNew);
-                              DebugComputeExpression(expNew);
-                              expNew.prev = prev;
-                              expNew.next = next;
-                              expNew.isConstant = true;
-                              *exp = *expNew;
+                              exp1.type = evalError;
+                              exp1.constant = PrintHexUInt64(address);
+                              expError = exp1;
                            }
                            else
                            {
-                              exp1.type = unknownErrorExp;
-                              expError = exp1;
+                              if(evaluation)
+                              {
+                                 expNew = ParseExpressionString(evaluation);
+                                 expNew.address = address;
+                                 expNew.hasAddress = true;
+                                 delete evaluation;
+                                 expNew.destType = exp.expType;
+                                 FreeType(exp.destType);
+                                 FreeExpContents(exp);
+                                 ProcessExpressionType(expNew);
+                                 DebugComputeExpression(expNew);
+                                 expNew.prev = prev;
+                                 expNew.next = next;
+                                 expNew.isConstant = true;
+                                 *exp = *expNew;
+                              }
+                              else
+                              {
+                                 exp1.type = unknownErrorExp;
+                                 expError = exp1;
+                              }
                            }
                         }
+                        else
+                        {
+                           exp1.type = unknownErrorExp;  // Not supported yet, generate error to fallback to GDB printout
+                           expError = exp1;
+                        }
                      }
                   }
                   else