Changeset 319
- Timestamp:
- Jun 11, 2003, 7:11:16 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/emxomf/stabshll.c
-
Property cvs2svn:cvs-rev
changed from
1.7
to1.8
r318 r319 264 264 static const char *parse_ptr; 265 265 266 /* Start of the stabs string we're parsing. Usful when printing 267 messages. */ 268 static const char *parse_start; 269 266 270 /* The next HLL type index. When creating a complex type, this index 267 271 is used. Then, this variable is incremented. */ … … 345 349 static int unnamed_struct_number; 346 350 347 #ifndef HLL_DEBUG 348 /* Suppress several kinds of warnings since newer gccs generates lots of 349 warnings... */ 350 351 static void no_warning (char *format, ...) 352 { 353 (void)format; 354 } 355 #else 351 /* kso #456 2003-06-11: Reversed quiet workaround. */ 356 352 #define no_warning warning 357 #endif358 353 359 354 … … 555 550 int i; 556 551 557 if (src->tag == ty_alias)558 abort ();559 552 for (p = type_head; p != NULL; p = p->next) 560 553 if (p->tag == src->tag) 561 554 switch (p->tag) 562 555 { 556 case ty_alias: 557 if (p->d.alias == src->d.alias) 558 return p; 559 break; 563 560 case ty_stabs_ref: 564 561 if (p->d.stabs_ref == src->d.stabs_ref) … … 610 607 case ty_func: 611 608 if (p->d.func.ret == src->d.func.ret 612 && p->d.func.args == src->d.func.args) 609 && p->d.func.args == src->d.func.args 610 && p->d.func.domain == src->d.func.domain 611 && p->d.func.arg_count == src->d.func.arg_count) 613 612 return p; 614 613 break; … … 740 739 #ifdef HLL_DEBUG 741 740 printf (" type: stabs %d => HLL 0x%x\n", number, hll->index); 741 #endif 742 742 if (stype_list[number-1] != NULL && stype_list[number-1] != hll) 743 743 warning ("Type stabs %d allready mapped to HLL 0x%x, new HLL 0x%x!!\n", number, stype_list[number-1]->index, hll->index); 744 #endif745 744 746 745 stype_list[number-1] = hll; … … 941 940 return 4; 942 941 case 0x89: /* 64 bit real */ 942 case 0x8c: /* 64 bit complex */ 943 943 return 8; 944 944 case 0x8a: /* 80 bit real (96 bits of storage) */ 945 945 return 12; 946 case 0x8d: /* 128 bit complex */ 947 return 16; 948 case 0x8e: /* 160 bit complex */ 949 return 24; 950 case 0x8f: /* 256 bit complex (birds invention) */ 951 return 32; 946 952 } 947 953 error ("type_size: Unknown primitive type: %d", tp->index); … … 1214 1220 if (*parse_ptr != c) 1215 1221 { 1216 no_warning ("Invalid symbol data: `%c' expected", c); 1222 no_warning ("Invalid symbol data: `%c' expected, found '%c' (off %ld)\n stabs: %s", 1223 c, *parse_ptr, parse_ptr - parse_start, parse_start); 1217 1224 return FALSE; 1218 1225 } … … 1278 1285 char tmp[32]; 1279 1286 1287 /* Some names have only spaces for gdb safety, let's make an 1288 fake name for those. */ 1289 if (type_name != NULL) 1290 { 1291 const char *psz = type_name; 1292 while (*psz == ' ' || *psz == '\t') 1293 psz++; 1294 if (!*psz) 1295 type_name = NULL; 1296 } 1297 1280 1298 if (type_name == NULL) 1281 1299 { … … 1284 1302 } 1285 1303 return strpool_add (str_pool, type_name); 1304 } 1305 1306 /** 1307 * Finds the next colon in the string and returns pointer to it. 1308 * For C++ template support, colons within <> are not considered. 1309 * 1310 * @returns Pointer to next colon within psz. 1311 * @returns NULL if not found. 1312 * @param psz String to search. 1313 */ 1314 static const char *nextcolon(const char *psz) 1315 { 1316 int cNesting; /* <> level */ 1317 1318 for (cNesting = 0;;psz++) 1319 switch (*psz) 1320 { 1321 case '<': 1322 cNesting++; 1323 break; 1324 case '>': 1325 cNesting--; 1326 break; 1327 case ':': 1328 if (cNesting <= 0) 1329 return psz; 1330 break; 1331 case '\0': 1332 return NULL; 1333 } 1334 psz++; 1335 1336 return NULL; 1286 1337 } 1287 1338 … … 1457 1508 case 'k': 1458 1509 1459 /* A const type: k<type> */ 1510 /* A const type: k<type> 1511 HLL don't have const typedefs afaik, so we just make it an alias. */ 1460 1512 1461 1513 ++parse_ptr; 1462 if (!parse_number (&num1)) 1463 goto syntax; 1464 1465 result = stype_find (num1); 1466 if (result == NULL) 1467 { 1468 t.tag = ty_stabs_ref; 1469 t.d.stabs_ref = num1; 1470 } 1471 break; 1514 t1 = parse_type (NULL); 1515 t.tag = ty_alias; 1516 t.d.alias = t1; 1517 break; 1518 1519 case 'B': 1520 1521 /* A volatile type: B<type> 1522 This is a SUN extension, and right now we don't care to generate 1523 specific HLL for it and stick with an alias. */ 1524 1525 ++parse_ptr; 1526 t1 = parse_type (NULL); 1527 t.tag = ty_alias; 1528 t.d.alias = t1; 1529 break; 1530 1472 1531 1473 1532 case '&': … … 1500 1559 if (!parse_char (';')) 1501 1560 goto syntax; 1561 no_warning ("We don't understand '##' methods."); 1502 1562 } 1503 1563 else … … 1519 1579 1520 1580 t3 = NULL; 1521 #if 0 1581 #if 0 /* this doesn't really seems to be required, but can just as well leave it in. */ 1522 1582 if (args_grow.count) 1523 1583 { … … 1614 1674 } 1615 1675 ++parse_ptr; 1616 p1 = strchr (parse_ptr, ':');1676 p1 = nextcolon (parse_ptr); 1617 1677 if (p1 == NULL) 1618 1678 { … … 1705 1765 break; 1706 1766 case ty_struc: 1707 struct_to_class (t1); 1767 /* kso #456 2003-06-11: Don't mess with forward defines! */ 1768 if (!( (t1->d.struc.flags & STRUC_FORWARD) 1769 && t1->d.struc.types == NULL 1770 && t1->d.struc.fields == NULL)) 1771 struct_to_class (t1); 1708 1772 break; 1709 1773 default: … … 1718 1782 while (*parse_ptr != ';') 1719 1783 { 1720 p1 = strchr (parse_ptr, ':');1784 p1 = nextcolon (parse_ptr); 1721 1785 if (p1 == NULL) 1722 1786 { … … 2024 2088 while (*parse_ptr != ';') 2025 2089 { 2026 p1 = strchr (parse_ptr, ':');2090 p1 = nextcolon (parse_ptr); 2027 2091 if (p1 == NULL) 2028 2092 { … … 2118 2182 t.tag = ty_func; 2119 2183 t.d.func.ret = t1; 2184 t.d.func.domain = NULL; 2120 2185 t.d.func.args = NULL; 2121 2186 t.d.func.arg_count = 0; … … 2134 2199 2135 2200 syntax: 2136 no_warning ("syntax error in stabs: %c", *parse_ptr); 2201 no_warning ("syntax error in stabs: %c (off %ld)\n stabs: %s", 2202 *parse_ptr, parse_ptr - parse_start, parse_start); 2203 2137 2204 grow_free (&g1); 2138 2205 t.tag = ty_prim; … … 2153 2220 tp = parse_type (type_name); 2154 2221 if (*parse_ptr != 0) 2155 no_warning ("unexpected character at end of stabs type: %c", *parse_ptr); 2222 no_warning ("unexpected character at end of stabs type: %c (off %ld)\n stabs: %s", 2223 *parse_ptr, parse_ptr - parse_start, parse_start); 2156 2224 return tp; 2157 2225 } … … 2530 2598 2531 2599 alloc_flag = concat_symbols (index, &str); 2532 p = strchr (str, ':');2600 p = nextcolon (str); 2533 2601 if (p != NULL) 2534 2602 { … … 2540 2608 printf ("LSYM/LCSYM/GSYM/PSYM/RSYM/STSYM/FUN %s\n", str); 2541 2609 #endif 2542 parse_ ptr = p + 1;2610 parse_start = parse_ptr = p + 1; 2543 2611 switch (*parse_ptr) 2544 2612 { … … 2660 2728 if (s->n_type != N_FUN) 2661 2729 return FALSE; 2662 p = strchr (str_ptr + s->n_un.n_strx, ':');2730 p = nextcolon (str_ptr + s->n_un.n_strx); 2663 2731 if (p == NULL) 2664 2732 return FALSE; … … 2755 2823 2756 2824 str = str_ptr + symbol->n_un.n_strx; 2757 p = strchr (str, ':');2825 p = nextcolon (str); 2758 2826 if (p == NULL) 2759 2827 abort (); … … 2774 2842 if (t1) 2775 2843 { /* C++ member function */ 2844 ti = t1->index; 2845 if (ti == -1) 2846 make_type (t1, &ti); 2776 2847 sst_start (SST_memfunc); 2777 2848 r.r_address = sst.size; 2778 2849 buffer_dword (&sst, symbol->n_value); /* Segment offset */ 2779 buffer_word (&sst, t 1->index);/* Type index */2850 buffer_word (&sst, ti); /* Type index */ 2780 2851 proc_patch_base = sst.size; 2781 2852 buffer_dword (&sst, 0); /* Length of proc */ … … 2876 2947 symbol = &sym_ptr[*index]; 2877 2948 alloc_flag = concat_symbols (index, &str); 2878 p = strchr (str, ':');2949 p = nextcolon (str); 2879 2950 if (p != NULL) 2880 2951 { … … 2886 2957 printf ("%s %s\n", msg, str); 2887 2958 #endif 2888 parse_ ptr = p + 1;2959 parse_start = parse_ptr = p + 1; 2889 2960 switch (*parse_ptr) 2890 2961 { … … 3072 3143 last_fun_type.tag = ty_func; 3073 3144 last_fun_type.index = -1; 3145 last_fun_type.d.func.domain = NULL; 3074 3146 last_fun_type.d.func.ret = parse_type (NULL); 3075 3147 … … 3143 3215 { 3144 3216 if (name != NULL) 3145 { 3217 { /* kso #456 2003-06-11: Templates can make very long names. 3218 Clip them and let the debugger burn on them if it doesn't like it. */ 3219 char achName[256]; 3220 int cch = strlen(name); 3221 if (cch > 250) 3222 { 3223 warning ("type_tag: name is longer than 250 bytes (%d).", cch); 3224 cch = 250; 3225 } 3226 memcpy (achName, name, cch); 3227 achName[cch] = '\0'; 3228 3146 3229 sst_start (type); 3147 3230 buffer_word (&sst, index); 3148 3231 if (type == SST_class) 3149 buffer_enc (&sst, name);3232 buffer_enc (&sst, achName); 3150 3233 else 3151 buffer_nstr (&sst, name);3234 buffer_nstr (&sst, achName); 3152 3235 sst_end (); 3153 3236 } … … 3313 3396 type_tag (SST_class, t1->index, t1->d.class.name); 3314 3397 break; 3398 case ty_enu: 3399 type_tag (SST_tag, t1->index, t1->d.enu.name); 3400 break; 3315 3401 default: 3316 3402 break; -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.