[BACK]Return to ctfdump.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ctfdump

Diff for /src/usr.bin/ctfdump/ctfdump.c between version 1.13 and 1.14

version 1.13, 2017/10/27 09:22:20 version 1.14, 2017/10/27 09:35:22
Line 52 
Line 52 
 __dead void      usage(void);  __dead void      usage(void);
   
 int              ctf_dump(const char *, size_t, uint8_t);  int              ctf_dump(const char *, size_t, uint8_t);
 uint32_t         ctf_dump_type(struct ctf_header *, const char *, off_t,  void             ctf_dump_type(struct ctf_header *, const char *, off_t,
                      uint32_t, uint32_t);                       uint32_t, uint32_t *, uint32_t);
 const char      *ctf_kind2name(uint16_t);  const char      *ctf_kind2name(uint16_t);
 const char      *ctf_enc2name(uint16_t);  const char      *ctf_enc2name(uint16_t);
 const char      *ctf_fpenc2name(uint16_t);  const char      *ctf_fpenc2name(uint16_t);
Line 381 
Line 381 
   
         if (flags & DUMP_TYPE) {          if (flags & DUMP_TYPE) {
                 uint32_t                 idx = 1, offset = cth->cth_typeoff;                  uint32_t                 idx = 1, offset = cth->cth_typeoff;
                   uint32_t                 stroff = cth->cth_stroff;
   
                 while (offset < cth->cth_stroff) {                  while (offset < stroff) {
                         offset += ctf_dump_type(cth, data, dlen, offset, idx++);                          ctf_dump_type(cth, data, dlen, stroff, &offset, idx++);
                 }                  }
                 printf("\n");                  printf("\n");
         }          }
Line 412 
Line 413 
         return 0;          return 0;
 }  }
   
 uint32_t  void
 ctf_dump_type(struct ctf_header *cth, const char *data, off_t dlen,  ctf_dump_type(struct ctf_header *cth, const char *data, off_t dlen,
     uint32_t offset, uint32_t idx)      uint32_t stroff, uint32_t *offset, uint32_t idx)
 {  {
         const char              *p = data + offset;          const char              *p = data + *offset;
         const struct ctf_type   *ctt = (struct ctf_type *)p;          const struct ctf_type   *ctt = (struct ctf_type *)p;
         const struct ctf_array  *cta;          const struct ctf_array  *cta;
         uint16_t                *argp, i, kind, vlen, root;          uint16_t                *argp, i, kind, vlen, root;
Line 487 
Line 488 
                         for (i = 0; i < vlen; i++) {                          for (i = 0; i < vlen; i++) {
                                 struct ctf_member       *ctm;                                  struct ctf_member       *ctm;
   
                                   if (toff > (stroff - sizeof(*ctm)))
                                           break;
   
                                 ctm = (struct ctf_member *)(p + toff);                                  ctm = (struct ctf_member *)(p + toff);
                                 toff += sizeof(struct ctf_member);                                  toff += sizeof(struct ctf_member);
   
Line 499 
Line 503 
                         for (i = 0; i < vlen; i++) {                          for (i = 0; i < vlen; i++) {
                                 struct ctf_lmember      *ctlm;                                  struct ctf_lmember      *ctlm;
   
                                   if (toff > (stroff - sizeof(*ctlm)))
                                           break;
   
                                 ctlm = (struct ctf_lmember *)(p + toff);                                  ctlm = (struct ctf_lmember *)(p + toff);
                                 toff += sizeof(struct ctf_lmember);                                  toff += sizeof(struct ctf_lmember);
   
Line 514 
Line 521 
                 for (i = 0; i < vlen; i++) {                  for (i = 0; i < vlen; i++) {
                         struct ctf_enum *cte;                          struct ctf_enum *cte;
   
                           if (toff > (stroff - sizeof(*cte)))
                                   break;
   
                         cte = (struct ctf_enum *)(p + toff);                          cte = (struct ctf_enum *)(p + toff);
                         toff += sizeof(struct ctf_enum);                          toff += sizeof(struct ctf_enum);
   
Line 530 
Line 540 
                 printf(" refers to %u", ctt->ctt_type);                  printf(" refers to %u", ctt->ctt_type);
                 break;                  break;
         default:          default:
                 errx(1, "incorrect type %u at offset %u", kind, offset);                  errx(1, "incorrect type %u at offset %u", kind, *offset);
         }          }
   
         printf("\n");          printf("\n");
   
         return toff;          *offset += toff;
 }  }
   
 const char *  const char *

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14