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.
70 // case TypeTypedObject, TypeAnyObject, TypeClassPointer:
77 static bool ExpressionIsError(Expression exp)
79 return (exp.type == dereferenceErrorExp || exp.type == symbolErrorExp || exp.type == classMemberSymbolErrorExp ||
80 exp.type == structMemberSymbolErrorExp || exp.type == memoryErrorExp || exp.type == unknownErrorExp ||
81 exp.type == noDebuggerErrorExp || exp.type == debugStateErrorExp);
84 void DebugComputeExpression(Expression exp)
87 char expString[1024] = "";
90 PrintExpression(exp, expString);
91 // printf("%s (exp.type = %s)\n", expString, exp.type.OnGetString(temp, null, null));
97 Expression prev = exp.prev, next = exp.next;
98 char * evaluation = null;
99 ExpressionType evalError = dummyExp;
101 TypeKind kind = dummyType;
102 Type dataType = exp.expType;
107 bool isPointer = false;
109 if(dataType && dataType.kind == classType && dataType._class.registered)
111 Class _class = dataType._class.registered;
112 if(_class.type == bitClass || _class.type == unitClass || _class.type == enumClass)
115 _class.dataType = ProcessTypeString(_class.dataTypeString, false);
116 dataType = _class.dataType;
118 else if(_class.type == normalClass || _class.type == noHeadClass || _class.type == systemClass) // Added systemClass here for Instance
123 else if(dataType && dataType.kind == classType && !dataType._class.registered)
126 kind = dataType.kind;
128 exp.type = symbolErrorExp;
132 case charType: case shortType: case intType: case int64Type: case longType: case floatType: case doubleType:
138 sprintf(temp, "&%s", exp.identifier.string);
141 if(exp.byReference && dataType._class && dataType._class.registered && dataType._class.registered.type == structClass)
142 // if(!dataType._class || !dataType._class.registered || dataType._class.registered.type != structClass || exp.byReference)
143 strcpy(temp, exp.identifier.string);
145 sprintf(temp, "&%s", exp.identifier.string);
151 // case TypeTypedObject, TypeAnyObject, TypeClassPointer:
157 evaluation = Debugger::EvaluateExpression(temp, &evalError);
160 address = (unsigned int)strtoul(evaluation, null, 0);
175 evaluation = Debugger::EvaluateExpression(exp.identifier.string, &evalError);
180 temp = strstr(evaluation, " '");
181 //len = strlen(temp);
185 for(c = 0; c < len; c++)
187 eString_TrimRSpaces(evaluation, evaluation);
192 exp.type = evalError;
193 exp.constant = PrintHexUInt(address);
205 evaluation = Debugger::EvaluateExpression(exp.identifier.string, &evalError);
208 if(kind == pointerType)
211 value = (unsigned int)strtoul(evaluation, null, 0);
213 evaluation = PrintHexUInt(value);
218 exp.constant = CopyString("");
219 exp.type = evalError;
228 //evaluation = Debugger::EvaluateExpression(exp.identifier.string, &evalError);
229 size = ComputeTypeSize(exp.expType); //exp.expType.arrayType.size;
230 format = GetGdbFormatChar(exp.expType);
231 evaluation = Debugger::ReadMemory(address, size, format, &evalError);
233 StripQuotes(evaluation, evaluation);
239 //evaluation = Debugger::EvaluateExpression(exp.identifier.string, &evalError);
245 // for classType --> if(_class.type == structClass) ?
247 //sprintf(temp, "&%s", exp.identifier.string);
248 //evaluation = Debugger::EvaluateExpression(temp, &evalError);
254 // case TypeTypedObject, TypeAnyObject, TypeClassPointer:
257 evaluation = Debugger::EvaluateExpression(exp.identifier.string, &evalError);
262 exp.constant = CopyString("");
263 exp.type = evalError;
267 if(evalError != dummyExp)
269 exp.type = evalError;
270 exp.constant = CopyString("");
276 //expNew = ParseExpressionString(evaluation);
277 expNew = MkExpConstant(evaluation);
278 //printf("Evaluation = %s\n", evaluation);
280 expNew.destType = exp.expType;
282 // WHY EXACTLY MUST WE PROCESS THIS EXPRESSION TYPE AGAIN ? ADDED THIS FOR 0x00000000
283 if(exp.expType && exp.expType.kind == pointerType && expNew.destType)
285 expNew.expType = expNew.destType;
286 expNew.destType.refCount++;
289 ProcessExpressionType(expNew);
290 FreeType(exp.destType);
291 FreeExpContents(exp);
293 DebugComputeExpression(expNew);
296 expNew.isConstant = true;
297 expNew.address = address;
298 expNew.hasAddress = hasAddress;
303 exp.address = address;
304 exp.hasAddress = hasAddress;
305 //exp.type = ExpUnknownError;
309 // exp.type = ExpUnknownError;
315 ComputeInstantiation(exp);
324 Expression expError = null;
325 Expression exp1, exp2 = null;
326 Operand op1 = { 0 }, op2 = { 0 };
329 if(exp.op.op == '&' || exp.op.op == '*')
331 if(!exp.op.exp1 && exp.op.exp2)
333 if(exp.op.exp2.type == identifierExp)
335 Expression prev = exp.prev, next = exp.next;
336 char * evaluation = null;
337 ExpressionType evalError = dummyExp;
340 sprintf(temp, "%c%s", exp.op.op, exp.op.exp2.identifier.string);
341 evaluation = Debugger::EvaluateExpression(temp, &evalError);
342 if(evalError != dummyExp)
344 exp.type = evalError;
345 exp.constant = CopyString("");
349 expNew = ParseExpressionString(evaluation);
351 expNew.destType = exp.expType;
352 FreeType(exp.destType);
353 FreeExpContents(exp);
354 ProcessExpressionType(expNew);
355 DebugComputeExpression(expNew);
358 expNew.isConstant = true;
362 exp.type = ExpUnknownError;
372 DebugComputeExpression(exp.op.exp2);
373 size = ComputeTypeSize(exp.op.exp2.expType);
374 format = GetGdbFormatChar(exp.op.exp2.expType);
375 GetInt(exp.op.exp2, &address);
376 //sprintf(temp, "%c%s", exp.op.op, exp.op.exp2.constant);
377 evaluation = Debug_ReadMemory(address, size, format, &evalError);
380 evalError = ExpUnknownError;
386 // We don't care about operations with only exp2 (INC_OP, DEC_OP...)
389 DebugComputeExpression(exp.op.exp2);
390 if(ExpressionIsError(exp.op.exp2))
391 expError = exp.op.exp2;
397 DebugComputeExpression(exp.op.exp1);
398 if(ExpressionIsError(exp.op.exp1))
399 expError = exp.op.exp1;
404 if(ExpressionIsError(exp.op.exp2))
405 expError = exp.op.exp2;
410 op1 = GetOperand(exp1);
411 if(op1.type) op1.type.refCount++;
412 op2 = GetOperand(exp2);
413 if(op2.type) op2.type.refCount++;
420 if(ExpressionIsError(exp.op.exp2))
421 expError = exp.op.exp2;
425 if(exp.op.op == '&' || exp.op.op == '*')
427 Expression prev = exp1.prev, next = exp1.next;
429 ExpressionType evalError = dummyExp;
430 char * evaluation = null;
436 //sprintf(temp, "%u", exp1.address);
437 temp = PrintHexUInt(exp1.address);
438 expNew = ParseExpressionString(temp);
440 //expNew.address = exp1.address;
441 expNew.expType = exp.expType;
443 expNew.destType = exp.expType;
444 expNew.destType.refCount++;
446 FreeType(exp.destType);
447 FreeExpContents(exp);
448 ProcessExpressionType(expNew);
449 DebugComputeExpression(expNew);
452 expNew.isConstant = true;
458 else if(exp.op.op == '*')
463 GetUInt(exp1, &address);
464 size = ComputeTypeSize(exp.expType); //exp.expType.arrayType.size;
465 format = GetGdbFormatChar(exp.expType);
466 evaluation = Debugger::ReadMemory(address, size, format, &evalError);
467 if(evalError != dummyExp)
469 exp1.type = evalError;
470 exp.constant = CopyString("");
477 expNew = ParseExpressionString(evaluation);
478 expNew.address = address;
479 expNew.hasAddress = true;
481 expNew.destType = exp.expType;
482 FreeType(exp.destType);
483 FreeExpContents(exp);
484 ProcessExpressionType(expNew);
485 DebugComputeExpression(expNew);
488 expNew.isConstant = true;
493 exp1.type = unknownErrorExp;
500 op1 = GetOperand(exp1);
501 if(op1.type) op1.type.refCount++;
506 CarryExpressionError(exp, expError);
507 else if(exp.type == opExp)
509 // TODO: check condition
510 if((exp.op.op == '+' || exp.op.op == '-') && op1.type && op2.type &&
511 (op1.type.kind == arrayType || op1.type.kind == pointerType) && op2.type.kind == intType)
513 // TODO: Do pointer operations
514 if(exp1.expType && exp1.expType.type)
516 uint size = ComputeTypeSize(exp1.expType.type);
519 op1.ui /= exp1.expType.type.size;
520 CallOperator(exp, exp1, exp2, op1, op2);
521 if(exp.type == constantExp)
523 exp.address = (unsigned int)strtoul(exp.constant, null, 0);
531 CallOperator(exp, exp1, exp2, op1, op2);
533 if(op1.type) FreeType(op1.type);
534 if(op2.type) FreeType(op2.type);
535 exp.isConstant = true;
543 // e = (*exp.list).first, n = e ? e.next : null;
545 // e = n, n = n?(n.next) : null)
547 for(e = exp.list->first; e; e = n)
552 OldList * list = exp.list;
553 DebugComputeExpression(e);
554 //if(ExpressionIsError(e)) //.type == ExpSymbolError
555 // CarryExpressionError(exp, e);
556 //FreeExpContents(exp);
557 FreeType(exp.expType);
558 FreeType(exp.destType);
575 exp.isConstant = true;
577 DebugComputeExpression(exp.index.exp);
578 if(ExpressionIsError(exp.index.exp)) //.type == ExpSymbolError
579 CarryExpressionError(exp, exp.index.exp);
582 Expression prev = exp.prev, next = exp.next;
583 char * evaluation = null;
584 ExpressionType evalError = dummyExp;
586 if(!exp.index.exp.isConstant)
587 exp.isConstant = false;
590 // 4 == size = ComputeTypeSize(exp.expType);
591 // 0 == size = ComputeTypeSize(exp.expType.arrayType);
592 // 4 == size = ComputeTypeSize(exp.index.exp.expType);
593 // 0 == size = ComputeTypeSize(exp.index.exp.expType.arrayType);
594 size = ComputeTypeSize(exp.expType);
595 format = GetGdbFormatChar(exp.expType);
597 for(e = exp.index.index->first; e; e = e.next)
599 DebugComputeExpression(e);
600 if(ExpressionIsError(e)) //.type == ExpSymbolError
602 CarryExpressionError(exp, e);
607 // Check if this type is int
610 exp.isConstant = false;
612 if(!ExpressionIsError(exp))
614 exp.expType = Dereference(exp.index.exp.expType);
616 if(exp.index.index && exp.index.index->last && ((Expression)exp.index.index->last) && ((Expression)exp.index.index->last).expType &&
617 ((Expression)exp.index.index->last).expType.kind == intType)
619 uint address, offset;
620 Expression expNew, last = (Expression)exp.index.index->last;
621 //GetUInt(exp.index.exp, &address);
623 // TOFIX: Check if it has address: TESTING
624 if(exp.index.exp.hasAddress && (exp.index.exp.expType.kind == arrayType))
625 address = exp.index.exp.address;
626 else if(exp.index.exp.type == constantExp)
627 GetUInt(exp.index.exp, &address);
629 GetUInt(last, &offset);
630 //size = ComputeTypeSize(exp.expType.arrayType); //exp.expType.arrayType.size;
631 address += offset * size;
632 evaluation = Debugger::ReadMemory(address, size, format, &evalError);
633 if(evalError != dummyExp)
635 exp.type = evalError;
636 exp.constant = CopyString("");
640 expNew = ParseExpressionString(evaluation);
642 expNew.destType = exp.expType;
643 FreeType(exp.destType);
644 FreeExpContents(exp);
645 ProcessExpressionType(expNew);
646 DebugComputeExpression(expNew);
648 // TOFIX: Only for Array Types
649 expNew.address = address;
651 expNew.hasAddress = true;
654 expNew.isConstant = true;
658 exp.type = unknownErrorExp;
660 //FreeExpContents(exp);
661 //exp.constant = PrintUInt64(value);
662 //exp.type = constantExp;
670 Expression memberExp = exp.member.exp;
671 Identifier memberID = exp.member.member;
673 Property prop = null;
674 DataMember member = null;
675 Class convertTo = null;
676 uint offset = 0; // THIS WASN'T INITIALIZED... IS IT ALWAYS SET?
678 Type type; // = memberExp.expType;
679 DebugComputeExpression(memberExp);
680 type = memberExp.expType;
681 if(ExpressionIsError(memberExp))
682 CarryExpressionError(exp, memberExp);
685 // _class = (memberID && memberID.classSym) ? memberID.classSym.registered : ((type.kind == classType && type._class) ? type._class.registered : null);
686 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);
689 char string[256] = "";
691 PrintType(type, string, false, true);
692 classSym = FindClass(string);
693 _class = classSym ? classSym.registered : null;
696 if(memberID && _class)
699 prop = eClass_FindProperty(_class, memberID.string);
701 member = eClass_FindDataMember(_class, memberID.string);
703 // member = eClass_FindDataMember(_class, memberID.string);
704 member = eClass_FindDataMemberAndOffset(_class, memberID.string, &offset, _class.module.application, null, null);
706 prop = eClass_FindProperty(_class, memberID.string, _class.module.application);
708 if(!prop && !member && _class && memberID)
710 Symbol classSym = FindClass(memberID.string);
712 _class = classSym ? classSym.registered : null;
714 prop = eClass_FindProperty(_class, convertTo.name, _class.module.application);
717 //DebugComputeExpression(memberExp);
718 if(ExpressionIsError(memberExp))
719 CarryExpressionError(exp, memberExp);
726 Type type = prop.dataType;
727 // TODO: Assuming same base type for units...
728 if(_class.type == unitClass)
730 if(type.kind == classType)
732 Class _class = type._class.registered;
733 if(_class.type == unitClass)
736 _class.dataType = ProcessTypeString(_class.dataTypeString, false);
737 type = _class.dataType;
745 float (*Get)(float) = (void *)prop.Get;
746 GetFloat(memberExp, &value);
747 exp.constant = PrintFloat(Get ? Get(value) : value);
748 exp.type = constantExp;
754 double (*Get)(double);
755 GetDouble(memberExp, &value);
758 Get = (void *)prop.Set;
760 Get = (void *)prop.Get;
761 exp.constant = PrintDouble(Get ? Get(value) : value);
762 exp.type = constantExp;
771 Expression value = memberExp;
772 Type type = prop.dataType;
773 if(_class.type == structClass)
779 Class propertyClass = type._class.registered;
780 if(propertyClass.type == structClass && value.type == instanceExp)
782 void (*Set)(void *, void *) = (void *)prop.Set;
783 exp.instance = Instantiation
785 data = new0 byte[_class.structSize];
786 _class = MkSpecifierName/*MkClassName*/(_class.name);
788 exp.type = instanceExp;
790 Set(exp.instance.data, value.instance.data);
791 PopulateInstance(exp.instance);
798 void (*Set)(void *, int) = (void *)prop.Set;
800 exp.instance = Instantiation
802 data = new0 byte[_class.structSize];
803 _class = MkSpecifierName/*MkClassName*/(_class.name);
806 exp.type = instanceExp;
808 GetInt(value, &intValue);
810 Set(exp.instance.data, intValue);
811 PopulateInstance(exp.instance);
817 void (*Set)(void *, int64) = (void *)prop.Set;
819 exp.instance = Instantiation
821 data = new0 byte[_class.structSize];
822 _class = MkSpecifierName/*MkClassName*/(_class.name);
825 exp.type = instanceExp;
827 GetInt64(value, &intValue);
829 Set(exp.instance.data, intValue);
830 PopulateInstance(exp.instance);
836 void (*Set)(void *, double) = (void *)prop.Set;
838 exp.instance = Instantiation
840 data = new0 byte[_class.structSize];
841 _class = MkSpecifierName/*MkClassName*/(_class.name);
844 exp.type = instanceExp;
846 GetDouble(value, &doubleValue);
848 Set(exp.instance.data, doubleValue);
849 PopulateInstance(exp.instance);
854 else if(_class.type == bitClass)
860 Class propertyClass = type._class.registered;
861 if(propertyClass.type == structClass && value.instance.data)
863 unsigned int (*Set)(void *) = (void *)prop.Set;
864 unsigned int bits = Set(value.instance.data);
865 exp.constant = PrintHexUInt(bits);
866 exp.type = constantExp;
869 else if(_class.type == bitClass)
872 unsigned int (*Set)(unsigned int) = (void *)prop.Set;
875 GetUInt(memberExp, &value);
877 exp.constant = PrintHexUInt(bits);
878 exp.type = constantExp;
886 if(_class.type == bitClass)
889 GetUInt(memberExp, &value);
895 Class _class = type._class.registered;
896 if(_class.type == structClass)
898 void (*Get)(unsigned int, void *) = (void *)prop.Get;
900 exp.instance = Instantiation
902 data = new0 byte[_class.structSize];
903 _class = MkSpecifierName/*MkClassName*/(_class.name);
906 //exp.instance.fullSet = true;
907 exp.type = instanceExp;
908 Get(value, exp.instance.data);
909 PopulateInstance(exp.instance);
911 else if(_class.type == bitClass)
913 unsigned int (*Get)(unsigned int) = (void *)prop.Get;
914 uint64 bits = Get(value);
915 exp.constant = PrintHexUInt64(bits);
916 exp.type = constantExp;
922 else if(_class.type == structClass)
924 char * value = (memberExp.type == instanceExp ) ? memberExp.instance.data : null;
929 Class _class = type._class.registered;
930 if(_class.type == structClass && value)
932 void (*Get)(void *, void *) = (void *)prop.Get;
934 exp.instance = Instantiation
936 data = new0 byte[_class.structSize];
937 _class = MkSpecifierName/*MkClassName*/(_class.name);
940 //exp.instance.fullSet = true;
941 exp.type = instanceExp;
942 Get(value, exp.instance.data);
943 PopulateInstance(exp.instance);
951 char * value = memberExp.instance.data;
956 Class _class = type._class.registered;
957 if(_class.type == normalClass)
959 void *(*Get)(void *) = (void *)prop.Get;
961 exp.instance = Instantiation
963 data = Get(value, exp.instance.data); ?????
964 _class = MkSpecifierName(_class.name); //MkClassName(_class.name);
967 exp.type = instanceExp;
979 exp.isConstant = false;
984 if(memberExp.hasAddress || memberExp.type == constantExp)
985 //if(memberExp.expType && memberExp.expType.kind == intType) // && !exp.index.exp.expType.isSigned
987 if(_class.type == bitClass)
989 if(memberExp.type == constantExp)
991 // Unfinished business...
992 BitMember bitMember = (BitMember)member;
994 GetUInt64(memberExp, &bits);
995 bits &= bitMember.mask;
996 bits >>= bitMember.pos;
998 FreeExpression(exp.member.exp);
999 FreeIdentifier(exp.member.member);
1001 exp.constant = PrintUInt64(bits);
1003 exp.isConstant = true;
1004 exp.type = constantExp;
1005 exp.hasAddress = false;
1010 char * evaluation = null;
1011 ExpressionType evalError = dummyExp;
1013 Expression prev = exp.prev, next = exp.next;
1017 TypeKind kind = dummyType;
1018 Type dataType = member.dataType;
1021 dataType = member.dataType = ProcessTypeString(member.dataTypeString, false);
1023 if(dataType.kind == classType && dataType._class.registered &&
1024 (dataType._class.registered.type == enumClass || dataType._class.registered.type == bitClass || dataType._class.registered.type == unitClass))
1026 if(dataType._class.registered.dataTypeString)
1027 dataType._class.registered.dataType = ProcessTypeString(dataType._class.registered.dataTypeString, false);
1028 dataType = dataType._class.registered.dataType;
1030 dataType = ProcessTypeString("int", false);
1033 size = ComputeTypeSize(member.dataType);
1035 format = GetGdbFormatChar(dataType);
1036 //if(memberExp.address)
1038 //GetInt(memberExp, &address);
1039 //offset = member.offset;
1041 // TESTING NOHEAD HERE?
1042 if(_class.type == normalClass || _class.type == noHeadClass || _class.type == systemClass)
1043 offset += member._class.offset;
1045 // VERIFY THIS: (trying to fix primitive.type)
1046 // if(memberExp.type == constantExp)
1047 if(memberExp.hasAddress && (_class.type != normalClass && _class.type != noHeadClass && _class.type != systemClass))
1048 address = memberExp.address;
1049 else if(memberExp.type == constantExp)
1050 GetUInt(memberExp, &address);
1054 GetUInt(memberExp, &address);
1055 //printf("Unhandled !!\n");
1057 //printf("memberExp.hasAddress = %d\n", memberExp.hasAddress);
1058 //printf("memberExp.type = %d\n", memberExp.type);
1059 //printf("_class.name = %s, _class.type = %d\n", _class.name, _class.type);
1064 if((dataType.kind == classType && dataType._class &&
1065 (!dataType._class.registered || dataType._class.registered.type == normalClass || dataType._class.registered.type == noHeadClass || dataType._class.registered.type == systemClass)) ||
1066 (dataType.kind != classType && dataType.kind != arrayType && dataType.kind != structType && dataType.kind != unionType))
1068 evaluation = Debugger::ReadMemory(address, size, format, &evalError);
1069 if(evalError != dummyExp)
1071 exp.type = evalError;
1072 exp.constant = PrintHexUInt(address);
1076 //printf("evaluation = %s\n", evaluation);
1077 expNew = ParseExpressionString(evaluation);
1079 expNew.destType = exp.expType;
1081 exp.expType.refCount++;
1082 //FreeType(memberExp.destType);
1083 FreeType(exp.expType);
1084 FreeType(exp.destType);
1085 FreeExpContents(exp);
1086 ProcessExpressionType(expNew);
1087 DebugComputeExpression(expNew);
1090 expNew.isConstant = true;
1091 expNew.address = address;
1092 expNew.hasAddress = true;
1096 exp.type = unknownErrorExp;
1100 // TESTING THIS HERE...
1101 exp.type = constantExp;
1102 exp.constant = PrintHexUInt(address);
1104 exp.address = address;
1105 exp.hasAddress = true;
1106 exp.isConstant = true;
1111 // exp.type = ExpUnknownError;
1113 //FreeExpContents(exp);
1114 //exp.constant = PrintUInt64(value);
1115 //exp.type = constantExp;
1120 if(type && (type.kind == structType || type.kind == unionType))
1123 Type memberType = exp.member.member ? FindMemberAndOffset(type, exp.member.member.string, &offset) : null;
1126 char * evaluation = null;
1127 ExpressionType evalError = dummyExp;
1129 Expression prev = exp.prev, next = exp.next;
1131 int size = memberType.size;
1133 Type dataType = memberType;
1134 TypeKind kind = dummyType;
1136 if(dataType.kind == classType && dataType._class.registered &&
1137 (dataType._class.registered.type == enumClass || dataType._class.registered.type == bitClass || dataType._class.registered.type == unitClass))
1138 dataType = dataType._class.registered.dataType;
1140 format = GetGdbFormatChar(dataType);
1142 if(memberExp.hasAddress)
1143 address = memberExp.address;
1144 else if(memberExp.type == constantExp)
1145 GetUInt(memberExp, &address);
1149 if((dataType.kind == classType && dataType._class &&
1150 (!dataType._class.registered || dataType._class.registered.type == normalClass || dataType._class.registered.type == noHeadClass || dataType._class.registered.type == systemClass)) ||
1151 (dataType.kind != classType && dataType.kind != arrayType && dataType.kind != structType && dataType.kind != unionType))
1153 evaluation = Debugger::ReadMemory(address, size, format, &evalError);
1154 if(evalError != dummyExp)
1156 exp.type = evalError;
1157 exp.constant = PrintHexUInt(address);
1161 expNew = ParseExpressionString(evaluation);
1163 expNew.destType = exp.expType;
1165 exp.expType.refCount++;
1166 //FreeType(memberExp.destType);
1167 FreeType(exp.expType);
1168 FreeType(exp.destType);
1169 FreeExpContents(exp);
1170 ProcessExpressionType(expNew);
1171 DebugComputeExpression(expNew);
1174 expNew.isConstant = true;
1175 expNew.address = address;
1176 expNew.hasAddress = true;
1180 exp.type = unknownErrorExp;
1184 // TESTING THIS HERE...
1185 exp.type = constantExp;
1186 exp.constant = PrintHexUInt(address);
1188 exp.address = address;
1189 exp.hasAddress = true;
1190 exp.isConstant = true;
1195 exp.type = classMemberSymbolErrorExp;
1199 //if(exp.type != memberExp)
1201 //FreeExpression(memberExp);
1202 //FreeIdentifier(memberID);
1207 exp.type = classMemberSymbolErrorExp;
1213 Type type = ProcessType(exp.typeName.qualifiers, exp.typeName.declarator);
1214 FreeExpContents(exp);
1215 exp.constant = PrintUInt(ComputeTypeSize(type));
1216 exp.type = constantExp;
1222 Symbol classSym = FindClass(exp._class.name);
1223 if(classSym && classSym.registered)
1225 //exp.constant = PrintUInt(classSym.registered.size);
1226 //exp.type = constantExp;
1228 char className[1024];
1229 sprintf(className, "__ecereClass_%s", classSym.string);
1230 FreeExpContents(exp);
1231 exp.type = pointerExp;
1232 exp.member.exp = MkExpIdentifier(MkIdentifier(className));
1233 exp.member.member = MkIdentifier("size");
1239 DebugComputeExpression(exp.cast.exp);
1241 if(ExpressionIsError(exp.cast.exp)) //.type == ExpSymbolError
1242 CarryExpressionError(exp, exp.cast.exp);
1245 exp.hasAddress = exp.cast.exp.hasAddress;
1246 exp.address = exp.cast.exp.address;
1247 if(exp.cast.exp.type == constantExp && exp.expType)
1249 Type type = exp.expType;
1250 if(type.kind == classType && type._class && type._class.registered)
1252 Class _class = type._class.registered;
1253 if(_class.type == unitClass || _class.type == bitClass || _class.type == enumClass)
1255 if(!_class.dataType)
1256 _class.dataType = ProcessTypeString(_class.dataTypeString, false);
1257 type = _class.dataType;
1267 GetChar(exp.cast.exp, &value);
1268 FreeExpContents(exp);
1269 exp.constant = PrintChar(value);
1270 exp.type = constantExp;
1271 exp.isConstant = true;
1275 unsigned char value;
1276 GetUChar(exp.cast.exp, &value);
1277 FreeExpContents(exp);
1278 exp.constant = PrintUChar(value);
1279 exp.type = constantExp;
1280 exp.isConstant = true;
1287 GetShort(exp.cast.exp, &value);
1288 FreeExpContents(exp);
1289 exp.constant = PrintShort(value);
1290 exp.type = constantExp;
1291 exp.isConstant = true;
1295 unsigned short value;
1296 GetUShort(exp.cast.exp, &value);
1297 FreeExpContents(exp);
1298 exp.constant = PrintUShort(value);
1299 exp.type = constantExp;
1300 exp.isConstant = true;
1306 if(type.kind == intType && type.isSigned)
1309 GetInt(exp.cast.exp, &value);
1310 FreeExpContents(exp);
1311 exp.constant = PrintInt(value);
1312 exp.type = constantExp;
1313 exp.isConstant = true;
1318 GetUInt(exp.cast.exp, &value);
1319 FreeExpContents(exp);
1320 if(type.kind == pointerType || type.kind == classType)
1321 exp.constant = PrintHexUInt(value);
1323 exp.constant = PrintUInt(value);
1324 exp.type = constantExp;
1325 exp.isConstant = true;
1332 GetInt64(exp.cast.exp, &value);
1333 FreeExpContents(exp);
1334 exp.constant = PrintInt64(value);
1335 exp.type = constantExp;
1336 exp.isConstant = true;
1341 GetUInt64(exp.cast.exp, &value);
1342 FreeExpContents(exp);
1343 exp.constant = PrintUInt64(value);
1344 exp.type = constantExp;
1345 exp.isConstant = true;
1351 GetFloat(exp.cast.exp, &value);
1352 FreeExpContents(exp);
1353 exp.constant = PrintFloat(value);
1354 exp.type = constantExp;
1355 exp.isConstant = true;
1361 GetDouble(exp.cast.exp, &value);
1362 FreeExpContents(exp);
1363 exp.constant = PrintDouble(value);
1364 exp.type = constantExp;
1365 exp.isConstant = true;
1377 exp.isConstant = true;
1379 FreeType(exp.cond.cond.destType);
1380 exp.cond.cond.destType = MkClassType("bool");
1381 DebugComputeExpression(exp.cond.cond);
1382 if(!exp.cond.cond.isConstant)
1383 exp.isConstant = false;
1384 for(e = exp.cond.exp->first; e; e = e.next)
1386 FreeType(e.destType);
1387 e.destType = exp.destType;
1388 DebugComputeExpression(e);
1390 exp.isConstant = false;
1392 if(!exp.cond.elseExp.isConstant)
1393 exp.isConstant = false;
1395 FreeType(exp.cond.elseExp.destType);
1396 exp.cond.elseExp.destType = exp.destType;
1397 DebugComputeExpression(exp.cond.elseExp);