Lines Matching refs:info

339 stab_write_symbol (struct stab_write_handle *info, int type, int desc,
351 h = string_hash_lookup (&info->strhash, string, TRUE, TRUE);
362 strx = info->strings_size;
364 if (info->last_string == NULL)
365 info->strings = h;
367 info->last_string->next = h;
368 info->last_string = h;
369 info->strings_size += strlen (string) + 1;
374 bfd_put_32 (info->abfd, strx, sym);
375 bfd_put_8 (info->abfd, type, sym + 4);
376 bfd_put_8 (info->abfd, 0, sym + 5);
377 bfd_put_16 (info->abfd, desc, sym + 6);
378 bfd_put_32 (info->abfd, value, sym + 8);
380 if (info->symbols_size + STAB_SYMBOL_SIZE > info->symbols_alloc)
382 info->symbols_alloc *= 2;
383 info->symbols = (bfd_byte *) xrealloc (info->symbols,
384 info->symbols_alloc);
387 memcpy (info->symbols + info->symbols_size, sym, STAB_SYMBOL_SIZE);
389 info->symbols_size += STAB_SYMBOL_SIZE;
397 stab_push_string (struct stab_write_handle *info, const char *string,
413 s->next = info->type_stack;
414 info->type_stack = s;
422 stab_push_defined_type (struct stab_write_handle *info, long index,
428 return stab_push_string (info, buf, index, FALSE, size);
435 stab_pop_type (struct stab_write_handle *info)
440 s = info->type_stack;
443 info->type_stack = s->next;
469 struct stab_write_handle info;
473 info.abfd = abfd;
475 info.symbols_size = 0;
476 info.symbols_alloc = 500;
477 info.symbols = (bfd_byte *) xmalloc (info.symbols_alloc);
479 info.strings = NULL;
480 info.last_string = NULL;
482 info.strings_size = 1;
484 if (!bfd_hash_table_init (&info.strhash.table, string_hash_newfunc,
486 || !bfd_hash_table_init (&info.typedef_hash.table, string_hash_newfunc,
494 info.type_stack = NULL;
495 info.type_index = 1;
496 memset (&info.type_cache, 0, sizeof info.type_cache);
497 info.so_offset = -1;
498 info.fun_offset = -1;
499 info.last_text_address = 0;
500 info.nesting = 0;
501 info.fnaddr = 0;
502 info.pending_lbrac = (bfd_vma) -1;
505 if (! stab_write_symbol (&info, 0, 0, 0, (const char *) NULL))
509 info.so_offset = info.symbols_size;
510 if (! stab_write_symbol (&info, N_SO, 0, 0, bfd_get_filename (abfd)))
513 if (! debug_write (dhandle, &stab_fns, (void *) &info))
516 assert (info.pending_lbrac == (bfd_vma) -1);
519 if (! stab_write_symbol (&info, N_SO, 0, info.last_text_address,
524 bfd_put_32 (abfd, info.strings_size, info.symbols + 8);
526 *psyms = info.symbols;
527 *psymsize = info.symbols_size;
529 *pstringsize = info.strings_size;
530 *pstrings = (bfd_byte *) xmalloc (info.strings_size);
534 for (h = info.strings; h != NULL; h = h->next)
548 struct stab_write_handle *info = (struct stab_write_handle *) p;
555 info->lineno_filename = filename;
557 return stab_write_symbol (info, N_SOL, 0, 0, filename);
565 struct stab_write_handle *info = (struct stab_write_handle *) p;
571 info->lineno_filename = filename;
573 return stab_write_symbol (info, N_SOL, 0, 0, filename);
582 struct stab_write_handle *info = (struct stab_write_handle *) p;
587 if (info->type_cache.void_type != 0)
588 return stab_push_defined_type (info, info->type_cache.void_type, 0);
594 index = info->type_index;
595 ++info->type_index;
599 return stab_push_string (info, buf, index, FALSE, 0);
608 struct stab_write_handle *info = (struct stab_write_handle *) p;
610 if (info->type_cache.void_type != 0)
611 return stab_push_defined_type (info, info->type_cache.void_type, 0);
617 index = info->type_index;
618 ++info->type_index;
620 info->type_cache.void_type = index;
624 return stab_push_string (info, buf, index, TRUE, 0);
633 struct stab_write_handle *info = (struct stab_write_handle *) p;
643 cache = info->type_cache.signed_integer_types;
645 cache = info->type_cache.unsigned_integer_types;
648 return stab_push_defined_type (info, cache[size - 1], size);
654 index = info->type_index;
655 ++info->type_index;
684 return stab_push_string (info, buf, index, TRUE, size);
693 struct stab_write_handle *info = (struct stab_write_handle *) p;
696 && size - 1 < (sizeof info->type_cache.float_types
697 / sizeof info->type_cache.float_types[0])
698 && info->type_cache.float_types[size - 1] != 0)
699 return stab_push_defined_type (info,
700 info->type_cache.float_types[size - 1],
709 if (! stab_int_type (info, 4, FALSE))
711 int_type = stab_pop_type (info);
713 index = info->type_index;
714 ++info->type_index;
717 && size - 1 < (sizeof info->type_cache.float_types
718 / sizeof info->type_cache.float_types[0]))
719 info->type_cache.float_types[size - 1] = index;
725 return stab_push_string (info, buf, index, TRUE, size);
734 struct stab_write_handle *info = (struct stab_write_handle *) p;
738 index = info->type_index;
739 ++info->type_index;
743 return stab_push_string (info, buf, index, TRUE, size * 2);
752 struct stab_write_handle *info = (struct stab_write_handle *) p;
775 return stab_push_defined_type (info, index, size);
784 struct stab_write_handle *info = (struct stab_write_handle *) p;
798 if (! stab_push_string (info, buf, 0, FALSE, 4))
816 index = info->type_index;
817 ++info->type_index;
828 if (! stab_push_string (info, buf, 0, FALSE, 4))
834 if (! stab_write_symbol (info, N_LSYM, 0, 0, buf)
835 || ! stab_push_defined_type (info, index, 4))
848 stab_modify_type (struct stab_write_handle *info, int mod,
855 assert (info->type_stack != NULL);
856 targindex = info->type_stack->index;
866 definition = info->type_stack->definition;
867 s = stab_pop_type (info);
871 if (! stab_push_string (info, buf, 0, definition, size))
893 if (index != 0 && ! info->type_stack->definition)
901 free (stab_pop_type (info));
902 if (! stab_push_defined_type (info, index, size))
907 index = info->type_index;
908 ++info->type_index;
910 s = stab_pop_type (info);
917 if (! stab_push_string (info, buf, index, TRUE, size))
932 struct stab_write_handle *info = (struct stab_write_handle *) p;
935 return stab_modify_type (info, '*', 4, &info->type_cache.pointer_types,
936 &info->type_cache.pointer_types_alloc);
945 struct stab_write_handle *info = (struct stab_write_handle *) p;
953 if (! info->type_stack->definition)
954 free (stab_pop_type (info));
959 s = stab_pop_type (info);
965 if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
972 return stab_modify_type (info, 'f', 0, &info->type_cache.function_types,
973 &info->type_cache.function_types_alloc);
981 struct stab_write_handle *info = (struct stab_write_handle *) p;
984 return stab_modify_type (info, '&', 4, &info->type_cache.reference_types,
985 &info->type_cache.reference_types_alloc);
993 struct stab_write_handle *info = (struct stab_write_handle *) p;
998 definition = info->type_stack->definition;
999 size = info->type_stack->size;
1001 s = stab_pop_type (info);
1006 if (! stab_push_string (info, buf, 0, definition, size))
1020 struct stab_write_handle *info = (struct stab_write_handle *) p;
1027 definition = info->type_stack->definition;
1028 range = stab_pop_type (info);
1030 definition = definition || info->type_stack->definition;
1031 element_size = info->type_stack->size;
1032 element = stab_pop_type (info);
1045 index = info->type_index;
1046 ++info->type_index;
1060 if (! stab_push_string (info, buf, index, definition, size))
1073 struct stab_write_handle *info = (struct stab_write_handle *) p;
1078 definition = info->type_stack->definition;
1080 s = stab_pop_type (info);
1092 index = info->type_index;
1093 ++info->type_index;
1101 if (! stab_push_string (info, buf, index, definition, 0))
1114 struct stab_write_handle *info = (struct stab_write_handle *) p;
1118 definition = info->type_stack->definition;
1119 target = stab_pop_type (info);
1121 definition = definition || info->type_stack->definition;
1122 base = stab_pop_type (info);
1129 if (! stab_push_string (info, buf, 0, definition, 0))
1143 struct stab_write_handle *info = (struct stab_write_handle *) p;
1162 definition = info->type_stack->definition;
1163 domain = stab_pop_type (info);
1182 definition = definition || info->type_stack->definition;
1183 args[0] = stab_pop_type (info);
1192 definition = definition || info->type_stack->definition;
1193 args[i] = stab_pop_type (info);
1199 definition = definition || info->type_stack->definition;
1200 args[argcount] = stab_pop_type (info);
1205 definition = definition || info->type_stack->definition;
1206 return_type = stab_pop_type (info);
1228 if (! stab_push_string (info, buf, 0, definition, 0))
1241 struct stab_write_handle *info = (struct stab_write_handle *) p;
1243 return stab_modify_type (info, 'k', info->type_stack->size,
1252 struct stab_write_handle *info = (struct stab_write_handle *) p;
1254 return stab_modify_type (info, 'B', info->type_stack->size,
1262 stab_get_struct_index (struct stab_write_handle *info, const char *tag,
1266 if (id >= info->type_cache.struct_types_alloc)
1270 alloc = info->type_cache.struct_types_alloc;
1275 info->type_cache.struct_types =
1276 (struct stab_tag *) xrealloc (info->type_cache.struct_types,
1278 memset ((info->type_cache.struct_types
1279 + info->type_cache.struct_types_alloc),
1281 ((alloc - info->type_cache.struct_types_alloc)
1283 info->type_cache.struct_types_alloc = alloc;
1286 if (info->type_cache.struct_types[id].index == 0)
1288 info->type_cache.struct_types[id].index = info->type_index;
1289 ++info->type_index;
1290 info->type_cache.struct_types[id].tag = tag;
1291 info->type_cache.struct_types[id].kind = kind;
1297 info->type_cache.struct_types[id].kind = kind;
1298 info->type_cache.struct_types[id].size = *psize;
1301 *psize = info->type_cache.struct_types[id].size;
1303 return info->type_cache.struct_types[id].index;
1313 struct stab_write_handle *info = (struct stab_write_handle *) p;
1328 index = stab_get_struct_index (info, tag, id, DEBUG_KIND_ILLEGAL,
1340 if (! stab_push_string (info, buf, index, definition, size))
1343 info->type_stack->fields = (char *) xmalloc (1);
1344 info->type_stack->fields[0] = '\0';
1355 struct stab_write_handle *info = (struct stab_write_handle *) p;
1361 definition = info->type_stack->definition;
1362 size = info->type_stack->size;
1363 s = stab_pop_type (info);
1368 assert (info->type_stack->fields != NULL);
1369 n = (char *) xmalloc (strlen (info->type_stack->fields)
1397 bfd_get_filename (info->abfd), name);
1400 sprintf (n, "%s%s:%s%s,%ld,%ld;", info->type_stack->fields, name, vis, s,
1403 free (info->type_stack->fields);
1404 info->type_stack->fields = n;
1407 info->type_stack->definition = TRUE;
1417 struct stab_write_handle *info = (struct stab_write_handle *) p;
1423 assert (info->type_stack != NULL && info->type_stack->fields != NULL);
1425 definition = info->type_stack->definition;
1426 index = info->type_stack->index;
1427 size = info->type_stack->size;
1428 fields = info->type_stack->fields;
1429 first = stab_pop_type (info);
1436 if (! stab_push_string (info, buf, index, definition, size))
1449 struct stab_write_handle *info = (struct stab_write_handle *) p;
1460 definition = info->type_stack->definition;
1461 vstring = stab_pop_type (info);
1473 assert (info->type_stack->index > 0);
1475 sprintf (vtable, "~%%%ld", info->type_stack->index);
1484 info->type_stack->vtable = vtable;
1488 info->type_stack->definition = TRUE;
1499 struct stab_write_handle *info = (struct stab_write_handle *) p;
1504 definition = info->type_stack->definition;
1505 s = stab_pop_type (info);
1510 assert (info->type_stack->fields != NULL);
1511 n = (char *) xmalloc (strlen (info->type_stack->fields)
1535 sprintf (n, "%s%s:%s%s:%s;", info->type_stack->fields, name, vis, s,
1538 free (info->type_stack->fields);
1539 info->type_stack->fields = n;
1542 info->type_stack->definition = TRUE;
1553 struct stab_write_handle *info = (struct stab_write_handle *) p;
1560 definition = info->type_stack->definition;
1561 s = stab_pop_type (info);
1590 assert (info->type_stack != NULL && info->type_stack->fields != NULL);
1592 if (info->type_stack->baseclasses == NULL)
1597 while (info->type_stack->baseclasses[c] != NULL)
1601 baseclasses = (char **) xrealloc (info->type_stack->baseclasses,
1606 info->type_stack->baseclasses = baseclasses;
1609 info->type_stack->definition = TRUE;
1619 struct stab_write_handle *info = (struct stab_write_handle *) p;
1622 assert (info->type_stack != NULL && info->type_stack->fields != NULL);
1624 if (info->type_stack->methods == NULL)
1631 m = (char *) xrealloc (info->type_stack->methods,
1632 (strlen (info->type_stack->methods)
1639 info->type_stack->methods = m;
1647 stab_class_method_var (struct stab_write_handle *info, const char *physname,
1658 definition = info->type_stack->definition;
1659 type = stab_pop_type (info);
1663 definition = definition || info->type_stack->definition;
1664 context = stab_pop_type (info);
1667 assert (info->type_stack != NULL && info->type_stack->methods != NULL);
1709 info->type_stack->methods =
1710 (char *) xrealloc (info->type_stack->methods,
1711 (strlen (info->type_stack->methods)
1717 sprintf (info->type_stack->methods + strlen (info->type_stack->methods),
1723 sprintf (info->type_stack->methods + strlen (info->type_stack->methods),
1729 info->type_stack->definition = TRUE;
1742 struct stab_write_handle *info = (struct stab_write_handle *) p;
1744 return stab_class_method_var (info, physname, visibility, FALSE, constp,
1755 struct stab_write_handle *info = (struct stab_write_handle *) p;
1757 return stab_class_method_var (info, physname, visibility, TRUE, constp,
1766 struct stab_write_handle *info = (struct stab_write_handle *) p;
1768 assert (info->type_stack != NULL && info->type_stack->methods != NULL);
1770 /* We allocated enough room on info->type_stack->methods to add the
1772 strcat (info->type_stack->methods, ";");
1782 struct stab_write_handle *info = (struct stab_write_handle *) p;
1787 assert (info->type_stack != NULL && info->type_stack->fields != NULL);
1791 len = (strlen (info->type_stack->string)
1792 + strlen (info->type_stack->fields)
1794 if (info->type_stack->baseclasses != NULL)
1797 for (i = 0; info->type_stack->baseclasses[i] != NULL; i++)
1798 len += strlen (info->type_stack->baseclasses[i]);
1800 if (info->type_stack->methods != NULL)
1801 len += strlen (info->type_stack->methods);
1802 if (info->type_stack->vtable != NULL)
1803 len += strlen (info->type_stack->vtable);
1809 strcpy (buf, info->type_stack->string);
1811 if (info->type_stack->baseclasses != NULL)
1814 for (i = 0; info->type_stack->baseclasses[i] != NULL; i++)
1816 strcat (buf, info->type_stack->baseclasses[i]);
1817 free (info->type_stack->baseclasses[i]);
1819 free (info->type_stack->baseclasses);
1820 info->type_stack->baseclasses = NULL;
1823 strcat (buf, info->type_stack->fields);
1824 free (info->type_stack->fields);
1825 info->type_stack->fields = NULL;
1827 if (info->type_stack->methods != NULL)
1829 strcat (buf, info->type_stack->methods);
1830 free (info->type_stack->methods);
1831 info->type_stack->methods = NULL;
1836 if (info->type_stack->vtable != NULL)
1838 strcat (buf, info->type_stack->vtable);
1839 free (info->type_stack->vtable);
1840 info->type_stack->vtable = NULL;
1845 free (info->type_stack->string);
1846 info->type_stack->string = buf;
1856 struct stab_write_handle *info = (struct stab_write_handle *) p;
1859 h = string_hash_lookup (&info->typedef_hash, name, FALSE, FALSE);
1862 return stab_push_defined_type (info, h->index, h->size);
1871 struct stab_write_handle *info = (struct stab_write_handle *) p;
1875 index = stab_get_struct_index (info, name, id, kind, &size);
1879 return stab_push_defined_type (info, index, size);
1887 struct stab_write_handle *info = (struct stab_write_handle *) p;
1893 index = info->type_stack->index;
1894 size = info->type_stack->size;
1895 s = stab_pop_type (info);
1903 index = info->type_index;
1904 ++info->type_index;
1910 if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
1915 h = string_hash_lookup (&info->typedef_hash, name, TRUE, FALSE);
1936 struct stab_write_handle *info = (struct stab_write_handle *) p;
1939 s = stab_pop_type (info);
1946 if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
1959 struct stab_write_handle *info = (struct stab_write_handle *) p;
1965 if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
1978 struct stab_write_handle *info = (struct stab_write_handle *) p;
1984 if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
1997 struct stab_write_handle *info = (struct stab_write_handle *) p;
2000 s = stab_pop_type (info);
2006 if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
2020 struct stab_write_handle *info = (struct stab_write_handle *) p;
2025 s = stab_pop_type (info);
2057 index = info->type_index;
2058 ++info->type_index;
2076 if (! stab_write_symbol (info, stab_type, 0, val, buf))
2089 struct stab_write_handle *info = (struct stab_write_handle *) p;
2092 assert (info->nesting == 0 && info->fun_offset == -1);
2094 rettype = stab_pop_type (info);
2102 info->fun_offset = info->symbols_size;
2104 if (! stab_write_symbol (info, N_FUN, 0, 0, buf))
2117 struct stab_write_handle *info = (struct stab_write_handle *) p;
2122 s = stab_pop_type (info);
2154 if (! stab_write_symbol (info, stab_type, 0, val, buf))
2167 struct stab_write_handle *info = (struct stab_write_handle *) p;
2172 if (info->so_offset != -1)
2174 bfd_put_32 (info->abfd, addr, info->symbols + info->so_offset + 8);
2175 info->so_offset = -1;
2178 if (info->fun_offset != -1)
2180 bfd_put_32 (info->abfd, addr, info->symbols + info->fun_offset + 8);
2181 info->fun_offset = -1;
2184 ++info->nesting;
2190 if (info->nesting == 1)
2192 info->fnaddr = addr;
2201 if (info->pending_lbrac != (bfd_vma) -1)
2203 if (! stab_write_symbol (info, N_LBRAC, 0, info->pending_lbrac,
2210 info->pending_lbrac = addr - info->fnaddr;
2220 struct stab_write_handle *info = (struct stab_write_handle *) p;
2222 if (addr > info->last_text_address)
2223 info->last_text_address = addr;
2226 if (info->pending_lbrac != (bfd_vma) -1)
2228 if (! stab_write_symbol (info, N_LBRAC, 0, info->pending_lbrac,
2231 info->pending_lbrac = (bfd_vma) -1;
2234 assert (info->nesting > 0);
2236 --info->nesting;
2239 if (info->nesting == 0)
2242 return stab_write_symbol (info, N_RBRAC, 0, addr - info->fnaddr,
2259 struct stab_write_handle *info = (struct stab_write_handle *) p;
2261 assert (info->lineno_filename != NULL);
2263 if (addr > info->last_text_address)
2264 info->last_text_address = addr;
2266 if (strcmp (file, info->lineno_filename) != 0)
2268 if (! stab_write_symbol (info, N_SOL, 0, addr, file))
2270 info->lineno_filename = file;
2273 return stab_write_symbol (info, N_SLINE, lineno, addr - info->fnaddr,