3 static void CarryExpressionError(Expression exp, Expression expError)
7 // This function assumes that expError is contained within exp,
8 // and therefore these types will be freed when freeing the old contents
9 // of the expression we're carying into.
11 if(expError.destType) expError.destType.refCount++;
12 if(expError.expType) expError.expType.refCount++;
17 Identifier identifier = expError.identifier;
18 expError.identifier = null;
20 exp.identifier = identifier;
21 exp.type = expError.type;
24 *exp = *temp; //*expError;
26 // memset(expError, 0, sizeof(class Expression));
29 static char GetGdbFormatChar(Type type)
31 // x : Regard the bits of the value as an integer, and print the integer in hexadecimal.
32 // d : Print as integer in signed decimal.
33 // u : Print as integer in unsigned decimal.
34 // o : Print as integer in octal.
35 // t : Print as integer in binary. The letter `t' stands for "two". (4)
36 // a : Print as an address, both absolute in hexadecimal and as an offset from the nearest preceding symbol. You can use this format used to discover where (in what function) an unknown address is located:
37 // c : Regard as an integer and print it as a character constant. This prints both the numerical value and its character representation. The character representation is replaced with the octal escape `\nnn' for characters outside the 7-bit ASCII range.
38 // f : Regard the bits of the value as a floating point number and print using typical floating point syntax.
68 // case TypeTypedObject, TypeAnyObject, TypeClassPointer:
78 /*static */bool ExpressionIsError(Expression exp)
80 return (exp.type == dereferenceErrorExp || exp.type == symbolErrorExp || exp.type == classMemberSymbolErrorExp ||
81 exp.type == structMemberSymbolErrorExp || exp.type == memoryErrorExp || exp.type == unknownErrorExp ||
82 exp.type == noDebuggerErrorExp || exp.type == debugStateErrorExp);
85 void DebugComputeExpression(Expression exp)
88 char expString[1024] = "";
91 PrintExpression(exp, expString);
92 // printf("%s (exp.type = %s)\n", expString, exp.type.OnGetString(temp, null, null));
98 Expression prev = exp.prev, next = exp.next;
99 char * evaluation = null;
100 ExpressionType evalError = dummyExp;
102 TypeKind kind = dummyType;
103 Type dataType = exp.expType;
108 bool isPointer = false;
110 if(dataType && dataType.kind == classType && dataType._class.registered)
112 Class _class = dataType._class.registered;
113 if(_class.type == bitClass || _class.type == unitClass || _class.type == enumClass)
116 _class.dataType = ProcessTypeString(_class.dataTypeString, false);
117 dataType = _class.dataType;
119 else if(_class.type == normalClass || _class.type == noHeadClass || _class.type == systemClass) // Added systemClass here for Instance
124 else if(dataType && dataType.kind == classType && !dataType._class.registered)
127 kind = dataType.kind;
129 exp.type = symbolErrorExp;
133 case charType: case shortType: case intType: case int64Type: case longType: case floatType: case doubleType:
139 sprintf(temp, "&%s", exp.identifier.string);
142 if(exp.byReference && dataType._class && dataType._class.registered && dataType._class.registered.type == structClass)
143 // if(!dataType._class || !dataType._class.registered || dataType._class.registered.type != structClass || exp.byReference)
144 strcpy(temp, exp.identifier.string);
146 sprintf(temp, "&%s", exp.identifier.string);
152 // case TypeTypedObject, TypeAnyObject, TypeClassPointer:
158 evaluation = Debugger::EvaluateExpression(temp, &evalError);
161 address = _strtoui64(evaluation, null, 0);
176 evaluation = Debugger::EvaluateExpression(exp.identifier.string, &evalError);
181 temp = strstr(evaluation, " '");
182 //len = strlen(temp);
186 for(c = 0; c < len; c++)
188 eString_TrimRSpaces(evaluation, evaluation);
193 exp.type = evalError;
194 exp.constant = PrintHexUInt64(address);
206 evaluation = Debugger::EvaluateExpression(exp.identifier.string, &evalError);
209 if(kind == pointerType)
212 value = _strtoui64(evaluation, null, 0);
214 evaluation = PrintHexUInt64(value);
219 exp.constant = CopyString("");
220 exp.type = evalError;
229 //evaluation = Debugger::EvaluateExpression(exp.identifier.string, &evalError);
230 size = ComputeTypeSize(exp.expType); //exp.expType.arrayType.size;
231 format = GetGdbFormatChar(exp.expType);
232 evaluation = Debugger::ReadMemory(address, size, format, &evalError);
234 StripQuotes(evaluation, evaluation);
240 //evaluation = Debugger::EvaluateExpression(exp.identifier.string, &evalError);
246 // for classType --> if(_class.type == structClass) ?
248 //sprintf(temp, "&%s", exp.identifier.string);
249 //evaluation = Debugger::EvaluateExpression(temp, &evalError);
255 // case TypeTypedObject, TypeAnyObject, TypeClassPointer:
258 evaluation = Debugger::EvaluateExpression(exp.identifier.string, &evalError);
263 exp.constant = CopyString("");
264 exp.type = evalError;
268 if(evalError != dummyExp)
270 exp.type = evalError;
271 exp.constant = CopyString("");
277 //expNew = ParseExpressionString(evaluation);
278 expNew = MkExpConstant(evaluation);
279 //printf("Evaluation = %s\n", evaluation);
281 expNew.destType = exp.expType;
283 // WHY EXACTLY MUST WE PROCESS THIS EXPRESSION TYPE AGAIN ? ADDED THIS FOR 0x00000000
284 if(exp.expType && exp.expType.kind == pointerType && expNew.destType)
286 expNew.expType = expNew.destType;
287 expNew.destType.refCount++;
290 ProcessExpressionType(expNew);
291 FreeType(exp.destType);
292 FreeExpContents(exp);
294 DebugComputeExpression(expNew);
297 expNew.isConstant = true;
298 expNew.address = address;
299 expNew.hasAddress = hasAddress;
304 exp.address = address;
305 exp.hasAddress = hasAddress;
306 //exp.type = ExpUnknownError;
310 // exp.type = ExpUnknownError;
316 ComputeInstantiation(exp);
325 Expression expError = null;
326 Expression exp1, exp2 = null;
327 Operand op1 = { 0 }, op2 = { 0 };
330 if(exp.op.op == '&' || exp.op.op == '*')
332 if(!exp.op.exp1 && exp.op.exp2)
334 if(exp.op.exp2.type == identifierExp)
336 Expression prev = exp.prev, next = exp.next;
337 char * evaluation = null;
338 ExpressionType evalError = dummyExp;
341 sprintf(temp, "%c%s", exp.op.op, exp.op.exp2.identifier.string);
342 evaluation = Debugger::EvaluateExpression(temp, &evalError);
343 if(evalError != dummyExp)
345 exp.type = evalError;
346 exp.constant = CopyString("");
350 expNew = ParseExpressionString(evaluation);
352 expNew.destType = exp.expType;
353 FreeType(exp.destType);
354 FreeExpContents(exp);
355 ProcessExpressionType(expNew);
356 DebugComputeExpression(expNew);
359 expNew.isConstant = true;
363 exp.type = ExpUnknownError;
373 DebugComputeExpression(exp.op.exp2);
374 size = ComputeTypeSize(exp.op.exp2.expType);
375 format = GetGdbFormatChar(exp.op.exp2.expType);
376 GetInt(exp.op.exp2, &address);
377 //sprintf(temp, "%c%s", exp.op.op, exp.op.exp2.constant);
378 evaluation = Debug_ReadMemory(address, size, format, &evalError);
381 evalError = ExpUnknownError;
387 // We don't care about operations with only exp2 (INC_OP, DEC_OP...)
390 DebugComputeExpression(exp.op.exp2);
391 if(ExpressionIsError(exp.op.exp2))
392 expError = exp.op.exp2;
398 DebugComputeExpression(exp.op.exp1);
399 if(ExpressionIsError(exp.op.exp1))
400 expError = exp.op.exp1;
405 if(ExpressionIsError(exp.op.exp2))
406 expError = exp.op.exp2;
411 op1 = GetOperand(exp1);
412 if(op1.type) op1.type.refCount++;
413 op2 = GetOperand(exp2);
414 if(op2.type) op2.type.refCount++;
421 if(ExpressionIsError(exp.op.exp2))
422 expError = exp.op.exp2;
426 if(exp.op.op == '&' || exp.op.op == '*')
428 Expression prev = exp1.prev, next = exp1.next;
430 ExpressionType evalError = dummyExp;
431 char * evaluation = null;
437 //sprintf(temp, "%u", exp1.address);
438 temp = PrintHexUInt64(exp1.address);
439 expNew = ParseExpressionString(temp);
441 //expNew.address = exp1.address;
442 expNew.expType = exp.expType;
444 expNew.destType = exp.expType;
445 expNew.destType.refCount++;
447 FreeType(exp.destType);
448 FreeExpContents(exp);
449 ProcessExpressionType(expNew);
450 DebugComputeExpression(expNew);
453 expNew.isConstant = true;
459 else if(exp.op.op == '*')
464 GetUInt64(exp1, &address);
465 size = ComputeTypeSize(exp.expType); //exp.expType.arrayType.size;
466 format = GetGdbFormatChar(exp.expType);
469 evaluation = Debugger::ReadMemory(address, size, format, &evalError);
470 if(evalError != dummyExp)
472 exp1.type = evalError;
473 exp1.constant = PrintHexUInt64(address);
480 expNew = ParseExpressionString(evaluation);
481 expNew.address = address;
482 expNew.hasAddress = true;
484 expNew.destType = exp.expType;
485 FreeType(exp.destType);
486 FreeExpContents(exp);
487 ProcessExpressionType(expNew);
488 DebugComputeExpression(expNew);
491 expNew.isConstant = true;
496 exp1.type = unknownErrorExp;
503 exp1.type = unknownErrorExp; // Not supported yet, generate error to fallback to GDB printout
509 op1 = GetOperand(exp1);
510 if(op1.type) op1.type.refCount++;
515 CarryExpressionError(exp, expError);
516 else if(exp.type == opExp)
518 // TODO: check condition
519 if((exp.op.op == '+' || exp.op.op == '-') && op1.type && op2.type &&
520 (op1.type.kind == arrayType || op1.type.kind == pointerType) && op2.type.kind == intType)
522 // TODO: Do pointer operations
523 if(exp1.expType && exp1.expType.type)
525 uint size = ComputeTypeSize(exp1.expType.type);
528 op1.ui /= exp1.expType.type.size;
529 CallOperator(exp, exp1, exp2, op1, op2);
530 if(exp.type == constantExp)
532 exp.address = _strtoui64(exp.constant, null, 0);
540 CallOperator(exp, exp1, exp2, op1, op2);
542 if(op1.type) FreeType(op1.type);
543 if(op2.type) FreeType(op2.type);
544 exp.isConstant = true;
552 // e = (*exp.list).first, n = e ? e.next : null;
554 // e = n, n = n?(n.next) : null)
556 for(e = exp.list->first; e; e = n)
561 OldList * list = exp.list;
562 DebugComputeExpression(e);
563 //if(ExpressionIsError(e)) //.type == ExpSymbolError
564 // CarryExpressionError(exp, e);
565 //FreeExpContents(exp);
566 FreeType(exp.expType);
567 FreeType(exp.destType);
584 exp.isConstant = true;
586 DebugComputeExpression(exp.index.exp);
587 if(ExpressionIsError(exp.index.exp)) //.type == ExpSymbolError
588 CarryExpressionError(exp, exp.index.exp);
591 Expression prev = exp.prev, next = exp.next;
592 char * evaluation = null;
593 ExpressionType evalError = dummyExp;
595 if(!exp.index.exp.isConstant)
596 exp.isConstant = false;
599 // 4 == size = ComputeTypeSize(exp.expType);
600 // 0 == size = ComputeTypeSize(exp.expType.arrayType);
601 // 4 == size = ComputeTypeSize(exp.index.exp.expType);
602 // 0 == size = ComputeTypeSize(exp.index.exp.expType.arrayType);
603 size = ComputeTypeSize(exp.expType);
604 format = GetGdbFormatChar(exp.expType);
606 for(e = exp.index.index->first; e; e = e.next)
608 DebugComputeExpression(e);
609 if(ExpressionIsError(e)) //.type == ExpSymbolError
611 CarryExpressionError(exp, e);
616 // Check if this type is int
619 exp.isConstant = false;
621 if(!ExpressionIsError(exp))
623 exp.expType = Dereference(exp.index.exp.expType);
625 if(exp.index.index && exp.index.index->last && ((Expression)exp.index.index->last) && ((Expression)exp.index.index->last).expType &&
626 ((Expression)exp.index.index->last).expType.kind == intType)
628 uint64 address, offset;
629 Expression expNew, last = (Expression)exp.index.index->last;
630 //GetUInt(exp.index.exp, &address);
632 // TOFIX: Check if it has address: TESTING
633 if(exp.index.exp.hasAddress && (exp.index.exp.expType.kind == arrayType))
634 address = exp.index.exp.address;
635 else if(exp.index.exp.type == constantExp)
636 GetUInt64(exp.index.exp, &address);
638 GetUInt64(last, &offset);
639 //size = ComputeTypeSize(exp.expType.arrayType); //exp.expType.arrayType.size;
640 address += offset * size;
641 evaluation = Debugger::ReadMemory(address, size, format, &evalError);
642 if(evalError != dummyExp)
644 exp.type = evalError;
645 exp.constant = CopyString("");
649 expNew = ParseExpressionString(evaluation);
651 expNew.destType = exp.expType;
652 FreeType(exp.destType);
653 FreeExpContents(exp);
654 ProcessExpressionType(expNew);
655 DebugComputeExpression(expNew);
657 // TOFIX: Only for Array Types
658 expNew.address = address;
660 expNew.hasAddress = true;
663 expNew.isConstant = true;
667 exp.type = unknownErrorExp;
669 //FreeExpContents(exp);
670 //exp.constant = PrintUInt64(value);
671 //exp.type = constantExp;
679 Expression memberExp = exp.member.exp;
680 Identifier memberID = exp.member.member;
682 Property prop = null;
683 DataMember member = null;
684 Class convertTo = null;
685 uint offset = 0; // THIS WASN'T INITIALIZED... IS IT ALWAYS SET?
687 Type type; // = memberExp.expType;
688 DebugComputeExpression(memberExp);
689 type = memberExp.expType;
690 if(ExpressionIsError(memberExp))
691 CarryExpressionError(exp, memberExp);
694 // _class = (memberID && memberID.classSym) ? memberID.classSym.registered : ((type.kind == classType && type._class) ? type._class.registered : null);
695 Class _class = (exp.member.member && exp.member.member.classSym) ? exp.member.member.classSym.registered : (((type.kind == classType || type.kind == subClassType) && type._class) ? type._class.registered : null);
698 char string[256] = "";
700 PrintTypeNoConst(type, string, false, true);
701 classSym = FindClass(string);
702 _class = classSym ? classSym.registered : null;
705 if(memberID && _class)
708 prop = eClass_FindProperty(_class, memberID.string);
710 member = eClass_FindDataMember(_class, memberID.string);
712 // member = eClass_FindDataMember(_class, memberID.string);
713 member = eClass_FindDataMemberAndOffset(_class, memberID.string, &offset, _class.module.application, null, null);
715 prop = eClass_FindProperty(_class, memberID.string, _class.module.application);
717 if(!prop && !member && _class && memberID)
719 Symbol classSym = FindClass(memberID.string);
721 _class = classSym ? classSym.registered : null;
723 prop = eClass_FindProperty(_class, convertTo.name, _class.module.application);
726 //DebugComputeExpression(memberExp);
727 if(ExpressionIsError(memberExp))
728 CarryExpressionError(exp, memberExp);
735 Type type = prop.dataType;
736 // TODO: Assuming same base type for units...
737 if(_class.type == unitClass)
739 if(type.kind == classType)
741 Class _class = type._class.registered;
742 if(_class.type == unitClass)
745 _class.dataType = ProcessTypeString(_class.dataTypeString, false);
746 type = _class.dataType;
754 float (*Get)(float) = (void *)prop.Get;
755 GetFloat(memberExp, &value);
756 exp.constant = PrintFloat(Get ? Get(value) : value);
757 exp.type = constantExp;
763 double (*Get)(double);
764 GetDouble(memberExp, &value);
767 Get = (void *)prop.Set;
769 Get = (void *)prop.Get;
770 exp.constant = PrintDouble(Get ? Get(value) : value);
771 exp.type = constantExp;
780 Expression value = memberExp;
781 Type type = prop.dataType;
782 if(_class.type == structClass)
788 Class propertyClass = type._class.registered;
789 if(propertyClass.type == structClass && value.type == instanceExp)
791 void (*Set)(void *, void *) = (void *)prop.Set;
792 exp.instance = Instantiation
794 data = new0 byte[_class.structSize];
795 _class = MkSpecifierName/*MkClassName*/(_class.name);
797 exp.type = instanceExp;
799 Set(exp.instance.data, value.instance.data);
800 PopulateInstance(exp.instance);
807 void (*Set)(void *, int) = (void *)prop.Set;
809 exp.instance = Instantiation
811 data = new0 byte[_class.structSize];
812 _class = MkSpecifierName/*MkClassName*/(_class.name);
815 exp.type = instanceExp;
817 GetInt(value, &intValue);
819 Set(exp.instance.data, intValue);
820 PopulateInstance(exp.instance);
826 void (*Set)(void *, int64) = (void *)prop.Set;
828 exp.instance = Instantiation
830 data = new0 byte[_class.structSize];
831 _class = MkSpecifierName/*MkClassName*/(_class.name);
834 exp.type = instanceExp;
836 GetInt64(value, &intValue);
838 Set(exp.instance.data, intValue);
839 PopulateInstance(exp.instance);
845 void (*Set)(void *, double) = (void *)prop.Set;
847 exp.instance = Instantiation
849 data = new0 byte[_class.structSize];
850 _class = MkSpecifierName/*MkClassName*/(_class.name);
853 exp.type = instanceExp;
855 GetDouble(value, &doubleValue);
857 Set(exp.instance.data, doubleValue);
858 PopulateInstance(exp.instance);
863 else if(_class.type == bitClass)
869 Class propertyClass = type._class.registered;
870 if(propertyClass.type == structClass && value.instance.data)
872 unsigned int (*Set)(void *) = (void *)prop.Set;
873 unsigned int bits = Set(value.instance.data);
874 exp.constant = PrintHexUInt(bits);
875 exp.type = constantExp;
878 else if(_class.type == bitClass)
881 unsigned int (*Set)(unsigned int) = (void *)prop.Set;
884 GetUInt(memberExp, &value);
886 exp.constant = PrintHexUInt(bits);
887 exp.type = constantExp;
895 if(_class.type == bitClass)
898 GetUInt(memberExp, &value);
904 Class _class = type._class.registered;
905 if(_class.type == structClass)
907 void (*Get)(unsigned int, void *) = (void *)prop.Get;
909 exp.instance = Instantiation
911 data = new0 byte[_class.structSize];
912 _class = MkSpecifierName/*MkClassName*/(_class.name);
915 //exp.instance.fullSet = true;
916 exp.type = instanceExp;
917 Get(value, exp.instance.data);
918 PopulateInstance(exp.instance);
920 else if(_class.type == bitClass)
922 unsigned int (*Get)(unsigned int) = (void *)prop.Get;
923 uint64 bits = Get(value);
924 exp.constant = PrintHexUInt64(bits);
925 exp.type = constantExp;
931 else if(_class.type == structClass)
933 char * value = (memberExp.type == instanceExp ) ? memberExp.instance.data : null;
938 Class _class = type._class.registered;
939 if(_class.type == structClass && value)
941 void (*Get)(void *, void *) = (void *)prop.Get;
943 exp.instance = Instantiation
945 data = new0 byte[_class.structSize];
946 _class = MkSpecifierName/*MkClassName*/(_class.name);
949 //exp.instance.fullSet = true;
950 exp.type = instanceExp;
951 Get(value, exp.instance.data);
952 PopulateInstance(exp.instance);
960 char * value = memberExp.instance.data;
965 Class _class = type._class.registered;
966 if(_class.type == normalClass)
968 void *(*Get)(void *) = (void *)prop.Get;
970 exp.instance = Instantiation
972 data = Get(value, exp.instance.data); ?????
973 _class = MkSpecifierName(_class.name); //MkClassName(_class.name);
976 exp.type = instanceExp;
988 exp.isConstant = false;
993 if(memberExp.hasAddress || memberExp.type == constantExp)
994 //if(memberExp.expType && memberExp.expType.kind == intType) // && !exp.index.exp.expType.isSigned
996 if(_class.type == bitClass)
998 if(memberExp.type == constantExp)
1000 // Unfinished business...
1001 BitMember bitMember = (BitMember)member;
1003 GetUInt64(memberExp, &bits);
1004 bits &= bitMember.mask;
1005 bits >>= bitMember.pos;
1007 FreeExpression(exp.member.exp);
1008 FreeIdentifier(exp.member.member);
1010 exp.constant = PrintUInt64(bits);
1012 exp.isConstant = true;
1013 exp.type = constantExp;
1014 exp.hasAddress = false;
1019 char * evaluation = null;
1020 ExpressionType evalError = dummyExp;
1022 Expression prev = exp.prev, next = exp.next;
1026 TypeKind kind = dummyType;
1027 Type dataType = member.dataType;
1030 dataType = member.dataType = ProcessTypeString(member.dataTypeString, false);
1032 if(dataType.kind == classType && dataType._class.registered &&
1033 (dataType._class.registered.type == enumClass || dataType._class.registered.type == bitClass || dataType._class.registered.type == unitClass))
1035 if(dataType._class.registered.dataTypeString)
1036 dataType._class.registered.dataType = ProcessTypeString(dataType._class.registered.dataTypeString, false);
1037 dataType = dataType._class.registered.dataType;
1039 dataType = ProcessTypeString("int", false);
1042 size = ComputeTypeSize(member.dataType);
1044 format = GetGdbFormatChar(dataType);
1045 //if(memberExp.address)
1047 //GetInt(memberExp, &address);
1048 //offset = member.offset;
1050 // TESTING NOHEAD HERE?
1051 if(_class.type == normalClass || _class.type == noHeadClass || _class.type == systemClass)
1052 offset += member._class.offset;
1054 // VERIFY THIS: (trying to fix primitive.type)
1055 // if(memberExp.type == constantExp)
1056 if(memberExp.hasAddress && (_class.type != normalClass && _class.type != noHeadClass && _class.type != systemClass))
1057 address = memberExp.address;
1058 else if(memberExp.type == constantExp)
1059 GetUInt64(memberExp, &address);
1063 GetUInt64(memberExp, &address);
1064 //printf("Unhandled !!\n");
1066 //printf("memberExp.hasAddress = %d\n", memberExp.hasAddress);
1067 //printf("memberExp.type = %d\n", memberExp.type);
1068 //printf("_class.name = %s, _class.type = %d\n", _class.name, _class.type);
1073 if((dataType.kind == classType && dataType._class &&
1074 (!dataType._class.registered || dataType._class.registered.type == normalClass || dataType._class.registered.type == noHeadClass || dataType._class.registered.type == systemClass)) ||
1075 (dataType.kind != classType && dataType.kind != arrayType && dataType.kind != structType && dataType.kind != unionType))
1077 evaluation = Debugger::ReadMemory(address, size, format, &evalError);
1078 if(evalError != dummyExp)
1080 exp.type = evalError;
1081 exp.constant = PrintHexUInt64(address);
1085 //printf("evaluation = %s\n", evaluation);
1086 expNew = ParseExpressionString(evaluation);
1088 expNew.destType = exp.expType;
1090 exp.expType.refCount++;
1091 //FreeType(memberExp.destType);
1092 FreeType(exp.expType);
1093 FreeType(exp.destType);
1094 FreeExpContents(exp);
1095 ProcessExpressionType(expNew);
1096 DebugComputeExpression(expNew);
1099 expNew.isConstant = true;
1100 expNew.address = address;
1101 expNew.hasAddress = true;
1105 exp.type = unknownErrorExp;
1109 // TESTING THIS HERE...
1110 exp.type = constantExp;
1111 exp.constant = PrintHexUInt64(address);
1113 exp.address = address;
1114 exp.hasAddress = true;
1115 exp.isConstant = true;
1120 // exp.type = ExpUnknownError;
1122 //FreeExpContents(exp);
1123 //exp.constant = PrintUInt64(value);
1124 //exp.type = constantExp;
1129 if(type && (type.kind == structType || type.kind == unionType))
1132 Type memberType = exp.member.member ? FindMemberAndOffset(type, exp.member.member.string, &offset) : null;
1135 char * evaluation = null;
1136 ExpressionType evalError = dummyExp;
1138 Expression prev = exp.prev, next = exp.next;
1140 int size = memberType.size;
1142 Type dataType = memberType;
1143 TypeKind kind = dummyType;
1145 if(dataType.kind == classType && dataType._class.registered &&
1146 (dataType._class.registered.type == enumClass || dataType._class.registered.type == bitClass || dataType._class.registered.type == unitClass))
1147 dataType = dataType._class.registered.dataType;
1149 format = GetGdbFormatChar(dataType);
1151 if(memberExp.hasAddress)
1152 address = memberExp.address;
1153 else if(memberExp.type == constantExp)
1154 GetUInt64(memberExp, &address);
1158 if((dataType.kind == classType && dataType._class &&
1159 (!dataType._class.registered || dataType._class.registered.type == normalClass || dataType._class.registered.type == noHeadClass || dataType._class.registered.type == systemClass)) ||
1160 (dataType.kind != classType && dataType.kind != arrayType && dataType.kind != structType && dataType.kind != unionType))
1162 evaluation = Debugger::ReadMemory(address, size, format, &evalError);
1163 if(evalError != dummyExp)
1165 exp.type = evalError;
1166 exp.constant = PrintHexUInt64(address);
1170 expNew = ParseExpressionString(evaluation);
1172 expNew.destType = exp.expType;
1174 exp.expType.refCount++;
1175 //FreeType(memberExp.destType);
1176 FreeType(exp.expType);
1177 FreeType(exp.destType);
1178 FreeExpContents(exp);
1179 ProcessExpressionType(expNew);
1180 DebugComputeExpression(expNew);
1183 expNew.isConstant = true;
1184 expNew.address = address;
1185 expNew.hasAddress = true;
1189 exp.type = unknownErrorExp;
1193 // TESTING THIS HERE...
1194 exp.type = constantExp;
1195 exp.constant = PrintHexUInt64(address);
1197 exp.address = address;
1198 exp.hasAddress = true;
1199 exp.isConstant = true;
1204 exp.type = classMemberSymbolErrorExp;
1208 //if(exp.type != memberExp)
1210 //FreeExpression(memberExp);
1211 //FreeIdentifier(memberID);
1216 exp.type = classMemberSymbolErrorExp;
1222 Type type = ProcessType(exp.typeName.qualifiers, exp.typeName.declarator);
1223 FreeExpContents(exp);
1224 exp.constant = PrintUInt(ComputeTypeSize(type));
1225 exp.type = constantExp;
1231 Symbol classSym = FindClass(exp._class.name);
1232 if(classSym && classSym.registered)
1234 //exp.constant = PrintUInt(classSym.registered.size);
1235 //exp.type = constantExp;
1237 char className[1024];
1238 sprintf(className, "__ecereClass_%s", classSym.string);
1239 FreeExpContents(exp);
1240 exp.type = pointerExp;
1241 exp.member.exp = MkExpIdentifier(MkIdentifier(className));
1242 exp.member.member = MkIdentifier("size");
1248 DebugComputeExpression(exp.cast.exp);
1250 if(ExpressionIsError(exp.cast.exp)) //.type == ExpSymbolError
1251 CarryExpressionError(exp, exp.cast.exp);
1254 exp.hasAddress = exp.cast.exp.hasAddress;
1255 exp.address = exp.cast.exp.address;
1256 if(exp.cast.exp.type == constantExp && exp.expType)
1258 Type type = exp.expType;
1259 if(type.kind == classType && type._class && type._class.registered)
1261 Class _class = type._class.registered;
1262 if(_class.type == unitClass || _class.type == bitClass || _class.type == enumClass)
1264 if(!_class.dataType)
1265 _class.dataType = ProcessTypeString(_class.dataTypeString, false);
1266 type = _class.dataType;
1276 GetChar(exp.cast.exp, &value);
1277 FreeExpContents(exp);
1278 exp.constant = PrintChar(value);
1279 exp.type = constantExp;
1280 exp.isConstant = true;
1284 unsigned char value;
1285 GetUChar(exp.cast.exp, &value);
1286 FreeExpContents(exp);
1287 exp.constant = PrintUChar(value);
1288 exp.type = constantExp;
1289 exp.isConstant = true;
1296 GetShort(exp.cast.exp, &value);
1297 FreeExpContents(exp);
1298 exp.constant = PrintShort(value);
1299 exp.type = constantExp;
1300 exp.isConstant = true;
1304 unsigned short value;
1305 GetUShort(exp.cast.exp, &value);
1306 FreeExpContents(exp);
1307 exp.constant = PrintUShort(value);
1308 exp.type = constantExp;
1309 exp.isConstant = true;
1316 GetInt(exp.cast.exp, &value);
1317 FreeExpContents(exp);
1318 exp.constant = PrintInt(value);
1319 exp.type = constantExp;
1320 exp.isConstant = true;
1325 GetUInt(exp.cast.exp, &value);
1326 FreeExpContents(exp);
1327 exp.constant = PrintUInt(value);
1328 exp.type = constantExp;
1329 exp.isConstant = true;
1336 GetInt64(exp.cast.exp, &value);
1337 FreeExpContents(exp);
1338 exp.constant = PrintInt64(value);
1339 exp.type = constantExp;
1340 exp.isConstant = true;
1345 GetUInt64(exp.cast.exp, &value);
1346 FreeExpContents(exp);
1347 exp.constant = PrintUInt64(value);
1348 exp.type = constantExp;
1349 exp.isConstant = true;
1356 GetUInt64(exp.cast.exp, &value);
1357 FreeExpContents(exp);
1358 if(type.kind == pointerType || type.kind == classType)
1359 exp.constant = PrintHexUInt64(value);
1361 exp.constant = PrintUInt64(value);
1362 exp.type = constantExp;
1363 exp.isConstant = true;
1369 GetFloat(exp.cast.exp, &value);
1370 FreeExpContents(exp);
1371 exp.constant = PrintFloat(value);
1372 exp.type = constantExp;
1373 exp.isConstant = true;
1379 GetDouble(exp.cast.exp, &value);
1380 FreeExpContents(exp);
1381 exp.constant = PrintDouble(value);
1382 exp.type = constantExp;
1383 exp.isConstant = true;
1395 exp.isConstant = true;
1397 FreeType(exp.cond.cond.destType);
1398 exp.cond.cond.destType = MkClassType("bool");
1399 DebugComputeExpression(exp.cond.cond);
1400 if(!exp.cond.cond.isConstant)
1401 exp.isConstant = false;
1402 for(e = exp.cond.exp->first; e; e = e.next)
1404 FreeType(e.destType);
1405 e.destType = exp.destType;
1406 DebugComputeExpression(e);
1408 exp.isConstant = false;
1410 if(!exp.cond.elseExp.isConstant)
1411 exp.isConstant = false;
1413 FreeType(exp.cond.elseExp.destType);
1414 exp.cond.elseExp.destType = exp.destType;
1415 DebugComputeExpression(exp.cond.elseExp);