Bug #3776 » patch-gcc-cvt.diff
tools/ctf/cvt/ctf.c (copia locale) | ||
---|---|---|
52 | 52 |
#define CTF_BUF_CHUNK_SIZE (64 * 1024) |
53 | 53 |
#define RES_BUF_CHUNK_SIZE (64 * 1024) |
54 | 54 | |
55 |
static int ntypes=0; /* The number of types. */ |
|
56 | ||
55 | 57 |
struct ctf_buf { |
56 | 58 |
strtab_t ctb_strtab; /* string table */ |
57 | 59 |
caddr_t ctb_base; /* pointer to base of buffer */ |
... | ... | |
1143 | 1145 |
(*mpp)->ml_type = tdarr[ctm->ctm_type]; |
1144 | 1146 |
(*mpp)->ml_offset = ctm->ctm_offset; |
1145 | 1147 |
(*mpp)->ml_size = 0; |
1148 |
if (ctm->ctm_type > ntypes) { |
|
1149 |
parseterminate("Invalid member type ctm_type=%d", |
|
1150 |
ctm->ctm_type); |
|
1151 |
} |
|
1146 | 1152 |
} |
1147 | 1153 |
} else { |
1148 | 1154 |
for (i = 0, mpp = &tdp->t_members; i < vlen; |
... | ... | |
1159 | 1165 |
(*mpp)->ml_offset = |
1160 | 1166 |
(int)CTF_LMEM_OFFSET(ctlm); |
1161 | 1167 |
(*mpp)->ml_size = 0; |
1168 |
if (ctlm->ctlm_type > ntypes) { |
|
1169 |
parseterminate("Invalid lmember type ctlm_type=%d", |
|
1170 |
ctlm->ctlm_type); |
|
1171 |
} |
|
1162 | 1172 |
} |
1163 | 1173 |
} |
1164 | 1174 | |
... | ... | |
1272 | 1282 |
{ |
1273 | 1283 |
tdata_t *td = tdata_new(); |
1274 | 1284 |
tdesc_t **tdarr; |
1275 |
int ntypes = count_types(h, buf); |
|
1276 | 1285 |
int idx, i; |
1277 | 1286 | |
1287 |
ntypes = count_types(h, buf); |
|
1288 | ||
1278 | 1289 |
/* shudder */ |
1279 | 1290 |
tdarr = xcalloc(sizeof (tdesc_t *) * (ntypes + 1)); |
1280 | 1291 |
tdarr[0] = NULL; |
tools/ctf/cvt/ctftools.h (copia locale) | ||
---|---|---|
159 | 159 |
/* Auxiliary structure for structure/union tdesc_t */ |
160 | 160 |
typedef struct mlist { |
161 | 161 |
int ml_offset; /* Offset from start of structure (in bits) */ |
162 |
int ml_size; /* Member size (in bits) */
|
|
162 |
uint64_t ml_size; /* Member size (in bits) */
|
|
163 | 163 |
char *ml_name; /* Member name */ |
164 | 164 |
struct tdesc *ml_type; /* Member type */ |
165 | 165 |
struct mlist *ml_next; /* Next member */ |
... | ... | |
186 | 186 |
int _fformat; |
187 | 187 |
} _u; |
188 | 188 |
int intr_offset; |
189 |
int intr_nbits;
|
|
189 |
uint_t intr_nbits;
|
|
190 | 190 |
} intr_t; |
191 | 191 | |
192 | 192 |
#define intr_iformat _u._iformat |
tools/ctf/cvt/dwarf.c (copia locale) | ||
---|---|---|
674 | 674 |
tdesc_t *dimtdp; |
675 | 675 |
int flags; |
676 | 676 | |
677 |
/* Check for bogus gcc DW_AT_byte_size attribute */ |
|
678 |
if (uval == (unsigned)-1) { |
|
679 |
printf("dwarf.c:%s() working around bogus DW_AT_byte_size = 0xffffffff\n", |
|
680 |
__func__); |
|
681 |
uval = 0; |
|
682 |
} |
|
683 |
|
|
677 | 684 |
tdp->t_size = uval; |
678 | 685 | |
679 | 686 |
/* |
... | ... | |
760 | 767 |
tdp->t_type = ENUM; |
761 | 768 | |
762 | 769 |
(void) die_unsigned(dw, die, DW_AT_byte_size, &uval, DW_ATTR_REQ); |
770 |
/* Check for bogus gcc DW_AT_byte_size attribute */ |
|
771 |
if (uval == (unsigned)-1) { |
|
772 |
printf("dwarf.c:%s() working around bogus DW_AT_byte_size = 0xffffffff\n", |
|
773 |
__func__); |
|
774 |
uval = 0; |
|
775 |
} |
|
763 | 776 |
tdp->t_size = uval; |
764 | 777 | |
765 | 778 |
if ((mem = die_child(dw, die)) != NULL) { |
... | ... | |
873 | 886 |
die_sou_create(dwarf_t *dw, Dwarf_Die str, Dwarf_Off off, tdesc_t *tdp, |
874 | 887 |
int type, const char *typename) |
875 | 888 |
{ |
876 |
Dwarf_Unsigned sz, bitsz, bitoff; |
|
889 |
Dwarf_Unsigned sz, bitsz, bitoff, maxsz=0;
|
|
877 | 890 |
Dwarf_Die mem; |
878 | 891 |
mlist_t *ml, **mlastp; |
879 | 892 |
iidesc_t *ii; |
... | ... | |
929 | 942 |
ml->ml_name = NULL; |
930 | 943 | |
931 | 944 |
ml->ml_type = die_lookup_pass1(dw, mem, DW_AT_type); |
945 |
debug(3, "die_sou_create(): ml_type = %p t_id = %d\n", ml->ml_type, |
|
946 |
ml->ml_type->t_id); |
|
932 | 947 | |
933 | 948 |
if (die_mem_offset(dw, mem, DW_AT_data_member_location, |
934 | 949 |
&mloff, 0)) { |
... | ... | |
956 | 971 | |
957 | 972 |
*mlastp = ml; |
958 | 973 |
mlastp = &ml->ml_next; |
974 | ||
975 |
/* work out the size of the largest member to work around a gcc bug */ |
|
976 |
if (maxsz < ml->ml_size) { |
|
977 |
maxsz = ml->ml_size; |
|
978 |
} |
|
959 | 979 |
} while ((mem = die_sibling(dw, mem)) != NULL); |
960 | 980 | |
981 |
/* See if we got a bogus DW_AT_byte_size. GCC will sometimes |
|
982 |
* emit this. |
|
983 |
*/ |
|
984 |
if (sz == (unsigned)-1) { |
|
985 |
printf("dwarf.c:%s() working around bogus DW_AT_byte_size = 0xffffffff\n", |
|
986 |
__func__); |
|
987 |
tdp->t_size = maxsz / 8; /* maxsz is in bits, t_size is bytes */ |
|
988 |
} |
|
989 | ||
961 | 990 |
/* |
962 | 991 |
* GCC will attempt to eliminate unused types, thus decreasing the |
963 | 992 |
* size of the emitted dwarf. That is, if you declare a foo_t in your |
... | ... | |
1370 | 1399 |
*/ |
1371 | 1400 |
(void) die_unsigned(dw, base, DW_AT_byte_size, &sz, DW_ATTR_REQ); |
1372 | 1401 | |
1402 |
/* Check for bogus gcc DW_AT_byte_size attribute */ |
|
1403 |
if (sz == (unsigned)-1) { |
|
1404 |
printf("dwarf.c:%s() working around bogus DW_AT_byte_size = 0xffffffff\n", |
|
1405 |
__func__); |
|
1406 |
sz = 0; |
|
1407 |
} |
|
1408 | ||
1373 | 1409 |
if (tdp->t_name == NULL) |
1374 | 1410 |
terminate("die %llu: base type without name\n", off); |
1375 | 1411 |