Print this page
12259 CTF shouldn't assume enum size

Split Close
Expand all
Collapse all
          --- old/usr/src/common/ctf/ctf_types.c
          +++ new/usr/src/common/ctf/ctf_types.c
↓ open down ↓ 17 lines elided ↑ open up ↑
  18   18   * information: Portions Copyright [yyyy] [name of copyright owner]
  19   19   *
  20   20   * CDDL HEADER END
  21   21   */
  22   22  
  23   23  /*
  24   24   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  25   25   * Use is subject to license terms.
  26   26   */
  27   27  /*
  28      - * Copyright 2018 Joyent, Inc.
       28 + * Copyright 2020 Joyent, Inc.
  29   29   */
  30   30  
  31   31  #include <ctf_impl.h>
  32   32  #include <sys/debug.h>
  33   33  
  34   34  ssize_t
  35   35  ctf_get_ctt_size(const ctf_file_t *fp, const ctf_type_t *tp, ssize_t *sizep,
  36   36      ssize_t *incrementp)
  37   37  {
  38   38          ssize_t size, increment;
↓ open down ↓ 435 lines elided ↑ open up ↑
 474  474          case CTF_K_POINTER:
 475  475                  return (fp->ctf_dmodel->ctd_pointer);
 476  476  
 477  477          case CTF_K_FUNCTION:
 478  478                  return (0); /* function size is only known by symtab */
 479  479  
 480  480          case CTF_K_FORWARD:
 481  481                  return (0);
 482  482  
 483  483          case CTF_K_ENUM:
 484      -                return (fp->ctf_dmodel->ctd_int);
      484 +                return (ctf_get_ctt_size(fp, tp, NULL, NULL));
 485  485  
 486  486          case CTF_K_ARRAY:
 487  487                  /*
 488  488                   * Array size is not directly returned by stabs data.  Instead,
 489  489                   * it defines the element type and requires the user to perform
 490  490                   * the multiplication.  If ctf_get_ctt_size() returns zero, the
 491  491                   * current version of ctfconvert does not compute member sizes
 492  492                   * and we compute the size here on its behalf.
 493  493                   */
 494  494                  if ((size = ctf_get_ctt_size(fp, tp, NULL, NULL)) > 0)
↓ open down ↓ 76 lines elided ↑ open up ↑
 571  571                          for (; n != 0; n--, lmp++) {
 572  572                                  ssize_t am = ctf_type_align(fp, lmp->ctlm_type);
 573  573                                  align = MAX(align, am);
 574  574                          }
 575  575                  }
 576  576  
 577  577                  return (align);
 578  578          }
 579  579  
 580  580          case CTF_K_ENUM:
 581      -                return (fp->ctf_dmodel->ctd_int);
 582      -
 583  581          default:
 584  582                  return (ctf_get_ctt_size(fp, tp, NULL, NULL));
 585  583          }
 586  584  }
 587  585  
 588  586  /*
 589  587   * Return the kind (CTF_K_* constant) for the specified type ID.
 590  588   */
 591  589  int
 592  590  ctf_type_kind(ctf_file_t *fp, ctf_id_t type)
↓ open down ↓ 718 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX