| 1084 | } |
| 1085 | |
| 1086 | void FillComplexVariableInfo(const ExternTypeInfo& type, char* ptr, HTREEITEM parent, bool update) |
| 1087 | { |
| 1088 | TVINSERTSTRUCT helpInsert; |
| 1089 | helpInsert.hParent = parent; |
| 1090 | helpInsert.hInsertAfter = TVI_LAST; |
| 1091 | helpInsert.item.mask = TVIF_TEXT; |
| 1092 | helpInsert.item.cchTextMax = 0; |
| 1093 | |
| 1094 | HTREEITEM child = update ? TreeView_GetChild(hWatch, parent) : NULL; |
| 1095 | |
| 1096 | char name[256]; |
| 1097 | unsigned localOffset = 0; |
| 1098 | |
| 1099 | const char *memberName = codeSymbols + type.offsetToName + (unsigned int)strlen(codeSymbols + type.offsetToName) + 1; |
| 1100 | for(unsigned int i = 0; i < type.memberCount; i++) |
| 1101 | { |
| 1102 | char *it = name; |
| 1103 | memset(name, 0, 256); |
| 1104 | |
| 1105 | ExternTypeInfo &memberType = codeTypes[codeTypeExtra[type.memberOffset + i]]; |
| 1106 | unsigned int alignment = memberType.defaultAlign > 4 ? 4 : memberType.defaultAlign; |
| 1107 | if(alignment && localOffset % alignment != 0) |
| 1108 | { |
| 1109 | ptr += alignment - (localOffset % alignment); |
| 1110 | localOffset += alignment - (localOffset % alignment); |
| 1111 | } |
| 1112 | |
| 1113 | it += safeprintf(it, 256 - int(it - name), "%s %s", codeSymbols + memberType.offsetToName, memberName); |
| 1114 | |
| 1115 | if(memberType.subCat == ExternTypeInfo::CAT_NONE || memberType.subCat == ExternTypeInfo::CAT_POINTER) |
| 1116 | it += safeprintf(it, 256 - int(it - name), " = %s", GetBasicVariableInfo(memberType, ptr)); |
| 1117 | else if(&memberType == &codeTypes[8]) // for typeid |
| 1118 | it += safeprintf(it, 256 - int(it - name), " = %s", *(unsigned*)(ptr) < codeTypeCount ? codeSymbols + codeTypes[*(int*)(ptr)].offsetToName : "invalid: out of range"); |
| 1119 | |
| 1120 | helpInsert.item.mask = TVIF_TEXT | TVIF_CHILDREN | TVIF_PARAM; |
| 1121 | helpInsert.item.pszText = name; |
| 1122 | helpInsert.item.cChildren = memberType.subCat == ExternTypeInfo::CAT_POINTER ? I_CHILDRENCALLBACK : (memberType.subCat == ExternTypeInfo::CAT_NONE ? 0 : 1); |
| 1123 | helpInsert.item.lParam = memberType.subCat == ExternTypeInfo::CAT_POINTER ? tiExtra.size() : 0; |
| 1124 | if(memberType.subCat == ExternTypeInfo::CAT_POINTER) |
| 1125 | tiExtra.push_back(TreeItemExtra()); |
| 1126 | |
| 1127 | HTREEITEM lastItem; |
| 1128 | if(update) |
| 1129 | { |
| 1130 | helpInsert.item.hItem = child; |
| 1131 | TreeView_SetItem(hWatch, &helpInsert.item); |
| 1132 | lastItem = child; |
| 1133 | }else{ |
| 1134 | lastItem = TreeView_InsertItem(hVars, &helpInsert); |
| 1135 | if(memberType.subCat == ExternTypeInfo::CAT_POINTER) |
| 1136 | tiExtra.back() = TreeItemExtra((void*)ptr, &memberType, lastItem, true); |
| 1137 | } |
| 1138 | |
| 1139 | FillVariableInfo(memberType, ptr, lastItem); |
| 1140 | |
| 1141 | memberName += (unsigned int)strlen(memberName) + 1; |
| 1142 | ptr += memberType.size; |
| 1143 | localOffset += memberType.size; |
no test coverage detected