Print this page
4474 DTrace Userland CTF Support
4475 DTrace userland Keyword
4476 DTrace tests should be better citizens
4479 pid provider types
4480 dof emulation missing checks
Reviewed by: Bryan Cantrill <bryan@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libdtrace/common/dt_module.c
          +++ new/usr/src/lib/libdtrace/common/dt_module.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   */
       25 +/*
       26 + * Copyright (c) 2013, Joyent, Inc.  All rights reserved.
       27 + */
  25   28  
  26   29  #include <sys/types.h>
  27   30  #include <sys/modctl.h>
  28   31  #include <sys/kobj.h>
  29   32  #include <sys/kobj_impl.h>
  30   33  #include <sys/sysmacros.h>
  31   34  #include <sys/elf.h>
  32   35  #include <sys/task.h>
  33   36  
  34   37  #include <unistd.h>
↓ open down ↓ 376 lines elided ↑ open up ↑
 411  414  static const dt_modops_t dt_modops_64 = {
 412  415          dt_module_syminit64,
 413  416          dt_module_symsort64,
 414  417          dt_module_symname64,
 415  418          dt_module_symaddr64
 416  419  };
 417  420  
 418  421  dt_module_t *
 419  422  dt_module_create(dtrace_hdl_t *dtp, const char *name)
 420  423  {
      424 +        long pid;
      425 +        char *eptr;
      426 +        dt_ident_t *idp;
 421  427          uint_t h = dt_strtab_hash(name, NULL) % dtp->dt_modbuckets;
 422  428          dt_module_t *dmp;
 423  429  
 424  430          for (dmp = dtp->dt_mods[h]; dmp != NULL; dmp = dmp->dm_next) {
 425  431                  if (strcmp(dmp->dm_name, name) == 0)
 426  432                          return (dmp);
 427  433          }
 428  434  
 429  435          if ((dmp = malloc(sizeof (dt_module_t))) == NULL)
 430  436                  return (NULL); /* caller must handle allocation failure */
↓ open down ↓ 3 lines elided ↑ open up ↑
 434  440          dt_list_append(&dtp->dt_modlist, dmp);
 435  441          dmp->dm_next = dtp->dt_mods[h];
 436  442          dtp->dt_mods[h] = dmp;
 437  443          dtp->dt_nmods++;
 438  444  
 439  445          if (dtp->dt_conf.dtc_ctfmodel == CTF_MODEL_LP64)
 440  446                  dmp->dm_ops = &dt_modops_64;
 441  447          else
 442  448                  dmp->dm_ops = &dt_modops_32;
 443  449  
      450 +        /*
      451 +         * Modules for userland processes are special. They always refer to a
      452 +         * specific process and have a copy of their CTF data from a specific
      453 +         * instant in time. Any dt_module_t that begins with 'pid' is a module
      454 +         * for a specific process, much like how any probe description that
      455 +         * begins with 'pid' is special. pid123 refers to process 123. A module
      456 +         * that is just 'pid' refers specifically to pid$target. This is
      457 +         * generally done as D does not currently allow for macros to be
      458 +         * evaluated when working with types.
      459 +         */
      460 +        if (strncmp(dmp->dm_name, "pid", 3) == 0) {
      461 +                errno = 0;
      462 +                if (dmp->dm_name[3] == '\0') {
      463 +                        idp = dt_idhash_lookup(dtp->dt_macros, "target");
      464 +                        if (idp != NULL && idp->di_id != 0)
      465 +                                dmp->dm_pid = idp->di_id;
      466 +                } else {
      467 +                        pid = strtol(dmp->dm_name + 3, &eptr, 10);
      468 +                        if (errno == 0 && *eptr == '\0')
      469 +                                dmp->dm_pid = (pid_t)pid;
      470 +                        else
      471 +                                dt_dprintf("encountered malformed pid "
      472 +                                    "module: %s\n", dmp->dm_name);
      473 +                }
      474 +        }
      475 +
 444  476          return (dmp);
 445  477  }
 446  478  
 447  479  dt_module_t *
 448  480  dt_module_lookup_by_name(dtrace_hdl_t *dtp, const char *name)
 449  481  {
 450  482          uint_t h = dt_strtab_hash(name, NULL) % dtp->dt_modbuckets;
 451  483          dt_module_t *dmp;
 452  484  
 453  485          for (dmp = dtp->dt_mods[h]; dmp != NULL; dmp = dmp->dm_next) {
↓ open down ↓ 43 lines elided ↑ open up ↑
 497  529  
 498  530          ctsp->cts_data = dp->d_buf;
 499  531          ctsp->cts_size = dp->d_size;
 500  532  
 501  533          dt_dprintf("loaded %s [%s] (%lu bytes)\n",
 502  534              dmp->dm_name, ctsp->cts_name, (ulong_t)ctsp->cts_size);
 503  535  
 504  536          return (0);
 505  537  }
 506  538  
      539 +typedef struct dt_module_cb_arg {
      540 +        struct ps_prochandle *dpa_proc;
      541 +        dtrace_hdl_t *dpa_dtp;
      542 +        dt_module_t *dpa_dmp;
      543 +        uint_t dpa_count;
      544 +} dt_module_cb_arg_t;
      545 +
      546 +/* ARGSUSED */
      547 +static int
      548 +dt_module_load_proc_count(void *arg, const prmap_t *prmap, const char *obj)
      549 +{
      550 +        ctf_file_t *fp;
      551 +        dt_module_cb_arg_t *dcp = arg;
      552 +
      553 +        /* Try to grab a ctf container if it exists */
      554 +        fp = Pname_to_ctf(dcp->dpa_proc, obj);
      555 +        if (fp != NULL)
      556 +                dcp->dpa_count++;
      557 +        return (0);
      558 +}
      559 +
      560 +/* ARGSUSED */
      561 +static int
      562 +dt_module_load_proc_build(void *arg, const prmap_t *prmap, const char *obj)
      563 +{
      564 +        ctf_file_t *fp;
      565 +        char buf[MAXPATHLEN], *p;
      566 +        dt_module_cb_arg_t *dcp = arg;
      567 +        int count = dcp->dpa_count;
      568 +        Lmid_t lmid;
      569 +
      570 +        fp = Pname_to_ctf(dcp->dpa_proc, obj);
      571 +        if (fp == NULL)
      572 +                return (0);
      573 +        fp = ctf_dup(fp);
      574 +        if (fp == NULL)
      575 +                return (0);
      576 +        dcp->dpa_dmp->dm_libctfp[count] = fp;
      577 +        /*
      578 +         * While it'd be nice to simply use objname here, because of our prior
      579 +         * actions we'll always get a resolved object name to its on disk file.
      580 +         * Like the pid provider, we need to tell a bit of a lie here. The type
      581 +         * that the user thinks of is in terms of the libraries they requested,
      582 +         * eg. libc.so.1, they don't care about the fact that it's
      583 +         * libc_hwcap.so.1.
      584 +         */
      585 +        (void) Pobjname(dcp->dpa_proc, prmap->pr_vaddr, buf, sizeof (buf));
      586 +        if ((p = strrchr(buf, '/')) == NULL)
      587 +                p = buf;
      588 +        else
      589 +                p++;
      590 +
      591 +        /*
      592 +         * If for some reason we can't find a link map id for this module, which
      593 +         * would be really quite weird. We instead just say the link map id is
      594 +         * zero.
      595 +         */
      596 +        if (Plmid(dcp->dpa_proc, prmap->pr_vaddr, &lmid) != 0)
      597 +                lmid = 0;
      598 +
      599 +        if (lmid == 0)
      600 +                dcp->dpa_dmp->dm_libctfn[count] = strdup(p);
      601 +        else
      602 +                (void) asprintf(&dcp->dpa_dmp->dm_libctfn[count],
      603 +                    "LM%lx`%s", lmid, p);
      604 +        if (dcp->dpa_dmp->dm_libctfn[count] == NULL)
      605 +                return (1);
      606 +        ctf_setspecific(fp, dcp->dpa_dmp);
      607 +        dcp->dpa_count++;
      608 +        return (0);
      609 +}
      610 +
      611 +/*
      612 + * We've been asked to load data that belongs to another process. As such we're
      613 + * going to pgrab it at this instant, load everything that we might ever care
      614 + * about, and then drive on. The reason for this is that the process that we're
      615 + * interested in might be changing. As long as we have grabbed it, then this
      616 + * can't be a problem for us.
      617 + *
      618 + * For now, we're actually going to punt on most things and just try to get CTF
      619 + * data, nothing else. Basically this is only useful as a source of type
      620 + * information, we can't go and do the stacktrace lookups, etc.
      621 + */
      622 +static int
      623 +dt_module_load_proc(dtrace_hdl_t *dtp, dt_module_t *dmp)
      624 +{
      625 +        struct ps_prochandle *p;
      626 +        dt_module_cb_arg_t arg;
      627 +
      628 +        /*
      629 +         * Note that on success we do not release this hold. We must hold this
      630 +         * for our life time.
      631 +         */
      632 +        p = dt_proc_grab(dtp, dmp->dm_pid, 0, PGRAB_RDONLY | PGRAB_FORCE);
      633 +        if (p == NULL) {
      634 +                dt_dprintf("failed to grab pid: %d\n", (int)dmp->dm_pid);
      635 +                return (dt_set_errno(dtp, EDT_CANTLOAD));
      636 +        }
      637 +        dt_proc_lock(dtp, p);
      638 +
      639 +        arg.dpa_proc = p;
      640 +        arg.dpa_dtp = dtp;
      641 +        arg.dpa_dmp = dmp;
      642 +        arg.dpa_count = 0;
      643 +        if (Pobject_iter_resolved(p, dt_module_load_proc_count, &arg) != 0) {
      644 +                dt_dprintf("failed to iterate objects\n");
      645 +                dt_proc_release(dtp, p);
      646 +                return (dt_set_errno(dtp, EDT_CANTLOAD));
      647 +        }
      648 +
      649 +        if (arg.dpa_count == 0) {
      650 +                dt_dprintf("no ctf data present\n");
      651 +                dt_proc_unlock(dtp, p);
      652 +                dt_proc_release(dtp, p);
      653 +                return (dt_set_errno(dtp, EDT_CANTLOAD));
      654 +        }
      655 +
      656 +        dmp->dm_libctfp = malloc(sizeof (ctf_file_t *) * arg.dpa_count);
      657 +        if (dmp->dm_libctfp == NULL) {
      658 +                dt_proc_unlock(dtp, p);
      659 +                dt_proc_release(dtp, p);
      660 +                return (dt_set_errno(dtp, EDT_NOMEM));
      661 +        }
      662 +        bzero(dmp->dm_libctfp, sizeof (ctf_file_t *) * arg.dpa_count);
      663 +
      664 +        dmp->dm_libctfn = malloc(sizeof (char *) * arg.dpa_count);
      665 +        if (dmp->dm_libctfn == NULL) {
      666 +                free(dmp->dm_libctfp);
      667 +                dt_proc_unlock(dtp, p);
      668 +                dt_proc_release(dtp, p);
      669 +                return (dt_set_errno(dtp, EDT_NOMEM));
      670 +        }
      671 +        bzero(dmp->dm_libctfn, sizeof (char *) * arg.dpa_count);
      672 +
      673 +        dmp->dm_nctflibs = arg.dpa_count;
      674 +
      675 +        arg.dpa_count = 0;
      676 +        if (Pobject_iter_resolved(p, dt_module_load_proc_build, &arg) != 0) {
      677 +                dt_proc_unlock(dtp, p);
      678 +                dt_module_unload(dtp, dmp);
      679 +                dt_proc_release(dtp, p);
      680 +                return (dt_set_errno(dtp, EDT_CANTLOAD));
      681 +        }
      682 +        assert(arg.dpa_count == dmp->dm_nctflibs);
      683 +        dt_dprintf("loaded %d ctf modules for pid %d\n", arg.dpa_count,
      684 +            (int)dmp->dm_pid);
      685 +
      686 +        dt_proc_unlock(dtp, p);
      687 +        dt_proc_release(dtp, p);
      688 +        dmp->dm_flags |= DT_DM_LOADED;
      689 +
      690 +        return (0);
      691 +}
      692 +
 507  693  int
 508  694  dt_module_load(dtrace_hdl_t *dtp, dt_module_t *dmp)
 509  695  {
 510  696          if (dmp->dm_flags & DT_DM_LOADED)
 511  697                  return (0); /* module is already loaded */
 512  698  
      699 +        if (dmp->dm_pid != 0)
      700 +                return (dt_module_load_proc(dtp, dmp));
      701 +
 513  702          dmp->dm_ctdata.cts_name = ".SUNW_ctf";
 514  703          dmp->dm_ctdata.cts_type = SHT_PROGBITS;
 515  704          dmp->dm_ctdata.cts_flags = 0;
 516  705          dmp->dm_ctdata.cts_data = NULL;
 517  706          dmp->dm_ctdata.cts_size = 0;
 518  707          dmp->dm_ctdata.cts_entsize = 0;
 519  708          dmp->dm_ctdata.cts_offset = 0;
 520  709  
 521  710          dmp->dm_symtab.cts_name = ".symtab";
 522  711          dmp->dm_symtab.cts_type = SHT_SYMTAB;
↓ open down ↓ 65 lines elided ↑ open up ↑
 588  777  
 589  778          dmp->dm_ops->do_symsort(dmp);
 590  779  
 591  780          dt_dprintf("sorted %s [%s] (%u symbols)\n",
 592  781              dmp->dm_name, dmp->dm_symtab.cts_name, dmp->dm_aslen);
 593  782  
 594  783          dmp->dm_flags |= DT_DM_LOADED;
 595  784          return (0);
 596  785  }
 597  786  
      787 +int
      788 +dt_module_hasctf(dtrace_hdl_t *dtp, dt_module_t *dmp)
      789 +{
      790 +        if (dmp->dm_pid != 0 && dmp->dm_nctflibs > 0)
      791 +                return (1);
      792 +        return (dt_module_getctf(dtp, dmp) != NULL);
      793 +}
      794 +
 598  795  ctf_file_t *
 599  796  dt_module_getctf(dtrace_hdl_t *dtp, dt_module_t *dmp)
 600  797  {
 601  798          const char *parent;
 602  799          dt_module_t *pmp;
 603  800          ctf_file_t *pfp;
 604  801          int model;
 605  802  
 606  803          if (dmp->dm_ctfp != NULL || dt_module_load(dtp, dmp) != 0)
 607  804                  return (dmp->dm_ctfp);
↓ open down ↓ 53 lines elided ↑ open up ↑
 661  858  err:
 662  859          ctf_close(dmp->dm_ctfp);
 663  860          dmp->dm_ctfp = NULL;
 664  861          return (NULL);
 665  862  }
 666  863  
 667  864  /*ARGSUSED*/
 668  865  void
 669  866  dt_module_unload(dtrace_hdl_t *dtp, dt_module_t *dmp)
 670  867  {
      868 +        int i;
      869 +
 671  870          ctf_close(dmp->dm_ctfp);
 672  871          dmp->dm_ctfp = NULL;
 673  872  
      873 +        if (dmp->dm_libctfp != NULL) {
      874 +                for (i = 0; i < dmp->dm_nctflibs; i++) {
      875 +                        ctf_close(dmp->dm_libctfp[i]);
      876 +                        free(dmp->dm_libctfn[i]);
      877 +                }
      878 +                free(dmp->dm_libctfp);
      879 +                free(dmp->dm_libctfn);
      880 +                dmp->dm_libctfp = NULL;
      881 +                dmp->dm_nctflibs = 0;
      882 +        }
      883 +
 674  884          bzero(&dmp->dm_ctdata, sizeof (ctf_sect_t));
 675  885          bzero(&dmp->dm_symtab, sizeof (ctf_sect_t));
 676  886          bzero(&dmp->dm_strtab, sizeof (ctf_sect_t));
 677  887  
 678  888          if (dmp->dm_symbuckets != NULL) {
 679  889                  free(dmp->dm_symbuckets);
 680  890                  dmp->dm_symbuckets = NULL;
 681  891          }
 682  892  
 683  893          if (dmp->dm_symchains != NULL) {
↓ open down ↓ 20 lines elided ↑ open up ↑
 704  914          dmp->dm_bss_size = 0;
 705  915  
 706  916          if (dmp->dm_extern != NULL) {
 707  917                  dt_idhash_destroy(dmp->dm_extern);
 708  918                  dmp->dm_extern = NULL;
 709  919          }
 710  920  
 711  921          (void) elf_end(dmp->dm_elf);
 712  922          dmp->dm_elf = NULL;
 713  923  
      924 +        dmp->dm_pid = 0;
      925 +
 714  926          dmp->dm_flags &= ~DT_DM_LOADED;
 715  927  }
 716  928  
 717  929  void
 718  930  dt_module_destroy(dtrace_hdl_t *dtp, dt_module_t *dmp)
 719  931  {
 720  932          uint_t h = dt_strtab_hash(dmp->dm_name, NULL) % dtp->dt_modbuckets;
 721  933          dt_module_t **dmpp = &dtp->dt_mods[h];
 722  934  
 723  935          dt_list_delete(&dtp->dt_modlist, dmp);
↓ open down ↓ 68 lines elided ↑ open up ↑
 792 1004  
 793 1005  const char *
 794 1006  dt_module_modelname(dt_module_t *dmp)
 795 1007  {
 796 1008          if (dmp->dm_ops == &dt_modops_64)
 797 1009                  return ("64-bit");
 798 1010          else
 799 1011                  return ("32-bit");
 800 1012  }
 801 1013  
     1014 +/* ARGSUSED */
     1015 +int
     1016 +dt_module_getlibid(dtrace_hdl_t *dtp, dt_module_t *dmp, const ctf_file_t *fp)
     1017 +{
     1018 +        int i;
     1019 +
     1020 +        for (i = 0; i < dmp->dm_nctflibs; i++) {
     1021 +                if (dmp->dm_libctfp[i] == fp)
     1022 +                        return (i);
     1023 +        }
     1024 +
     1025 +        return (-1);
     1026 +}
     1027 +
     1028 +/* ARGSUSED */
     1029 +ctf_file_t *
     1030 +dt_module_getctflib(dtrace_hdl_t *dtp, dt_module_t *dmp, const char *name)
     1031 +{
     1032 +        int i;
     1033 +
     1034 +        for (i = 0; i < dmp->dm_nctflibs; i++) {
     1035 +                if (strcmp(dmp->dm_libctfn[i], name) == 0)
     1036 +                        return (dmp->dm_libctfp[i]);
     1037 +        }
     1038 +
     1039 +        return (NULL);
     1040 +}
     1041 +
 802 1042  /*
 803 1043   * Update our module cache by adding an entry for the specified module 'name'.
 804 1044   * We create the dt_module_t and populate it using /system/object/<name>/.
 805 1045   */
 806 1046  static void
 807 1047  dt_module_update(dtrace_hdl_t *dtp, const char *name)
 808 1048  {
 809 1049          char fname[MAXPATHLEN];
 810 1050          struct stat64 st;
 811 1051          int fd, err, bits;
↓ open down ↓ 321 lines elided ↑ open up ↑
1133 1373  }
1134 1374  
1135 1375  int
1136 1376  dtrace_lookup_by_type(dtrace_hdl_t *dtp, const char *object, const char *name,
1137 1377      dtrace_typeinfo_t *tip)
1138 1378  {
1139 1379          dtrace_typeinfo_t ti;
1140 1380          dt_module_t *dmp;
1141 1381          int found = 0;
1142 1382          ctf_id_t id;
1143      -        uint_t n;
     1383 +        uint_t n, i;
1144 1384          int justone;
     1385 +        ctf_file_t *fp;
     1386 +        char *buf, *p, *q;
1145 1387  
1146 1388          uint_t mask = 0; /* mask of dt_module flags to match */
1147 1389          uint_t bits = 0; /* flag bits that must be present */
1148 1390  
1149 1391          if (object != DTRACE_OBJ_EVERY &&
1150 1392              object != DTRACE_OBJ_KMODS &&
1151 1393              object != DTRACE_OBJ_UMODS) {
1152 1394                  if ((dmp = dt_module_from_object(dtp, object)) == NULL)
1153 1395                          return (-1); /* dt_errno is set for us */
1154 1396  
1155 1397                  if (dt_module_load(dtp, dmp) == -1)
1156 1398                          return (-1); /* dt_errno is set for us */
1157 1399                  n = 1;
1158 1400                  justone = 1;
1159      -
1160 1401          } else {
1161 1402                  if (object == DTRACE_OBJ_KMODS)
1162 1403                          mask = bits = DT_DM_KERNEL;
1163 1404                  else if (object == DTRACE_OBJ_UMODS)
1164 1405                          mask = DT_DM_KERNEL;
1165 1406  
1166 1407                  dmp = dt_list_next(&dtp->dt_modlist);
1167 1408                  n = dtp->dt_nmods;
1168 1409                  justone = 0;
1169 1410          }
↓ open down ↓ 3 lines elided ↑ open up ↑
1173 1414  
1174 1415          for (; n > 0; n--, dmp = dt_list_next(dmp)) {
1175 1416                  if ((dmp->dm_flags & mask) != bits)
1176 1417                          continue; /* failed to match required attributes */
1177 1418  
1178 1419                  /*
1179 1420                   * If we can't load the CTF container, continue on to the next
1180 1421                   * module.  If our search was scoped to only one module then
1181 1422                   * return immediately leaving dt_errno unmodified.
1182 1423                   */
1183      -                if (dt_module_getctf(dtp, dmp) == NULL) {
     1424 +                if (dt_module_hasctf(dtp, dmp) == 0) {
1184 1425                          if (justone)
1185 1426                                  return (-1);
1186 1427                          continue;
1187 1428                  }
1188 1429  
1189 1430                  /*
1190 1431                   * Look up the type in the module's CTF container.  If our
1191 1432                   * match is a forward declaration tag, save this choice in
1192 1433                   * 'tip' and keep going in the hope that we will locate the
1193 1434                   * underlying structure definition.  Otherwise just return.
1194 1435                   */
1195      -                if ((id = ctf_lookup_by_name(dmp->dm_ctfp, name)) != CTF_ERR) {
     1436 +                if (dmp->dm_pid == 0) {
     1437 +                        id = ctf_lookup_by_name(dmp->dm_ctfp, name);
     1438 +                        fp = dmp->dm_ctfp;
     1439 +                } else {
     1440 +                        if ((p = strchr(name, '`')) != NULL) {
     1441 +                                buf = strdup(name);
     1442 +                                if (buf == NULL)
     1443 +                                        return (dt_set_errno(dtp, EDT_NOMEM));
     1444 +                                p = strchr(buf, '`');
     1445 +                                if ((q = strchr(p + 1, '`')) != NULL)
     1446 +                                        p = q;
     1447 +                                *p = '\0';
     1448 +                                fp = dt_module_getctflib(dtp, dmp, buf);
     1449 +                                if (fp == NULL || (id = ctf_lookup_by_name(fp,
     1450 +                                    p + 1)) == CTF_ERR)
     1451 +                                        id = CTF_ERR;
     1452 +                                free(buf);
     1453 +                        } else {
     1454 +                                for (i = 0; i < dmp->dm_nctflibs; i++) {
     1455 +                                        fp = dmp->dm_libctfp[i];
     1456 +                                        id = ctf_lookup_by_name(fp, name);
     1457 +                                        if (id != CTF_ERR)
     1458 +                                                break;
     1459 +                                }
     1460 +                        }
     1461 +                }
     1462 +                if (id != CTF_ERR) {
1196 1463                          tip->dtt_object = dmp->dm_name;
1197      -                        tip->dtt_ctfp = dmp->dm_ctfp;
     1464 +                        tip->dtt_ctfp = fp;
1198 1465                          tip->dtt_type = id;
1199      -
1200      -                        if (ctf_type_kind(dmp->dm_ctfp, ctf_type_resolve(
1201      -                            dmp->dm_ctfp, id)) != CTF_K_FORWARD)
     1466 +                        if (ctf_type_kind(fp, ctf_type_resolve(fp, id)) !=
     1467 +                            CTF_K_FORWARD)
1202 1468                                  return (0);
1203 1469  
1204 1470                          found++;
1205 1471                  }
1206 1472          }
1207 1473  
1208 1474          if (found == 0)
1209 1475                  return (dt_set_errno(dtp, EDT_NOTYPE));
1210 1476  
1211 1477          return (0);
↓ open down ↓ 1 lines elided ↑ open up ↑
1213 1479  
1214 1480  int
1215 1481  dtrace_symbol_type(dtrace_hdl_t *dtp, const GElf_Sym *symp,
1216 1482      const dtrace_syminfo_t *sip, dtrace_typeinfo_t *tip)
1217 1483  {
1218 1484          dt_module_t *dmp;
1219 1485  
1220 1486          tip->dtt_object = NULL;
1221 1487          tip->dtt_ctfp = NULL;
1222 1488          tip->dtt_type = CTF_ERR;
     1489 +        tip->dtt_flags = 0;
1223 1490  
1224 1491          if ((dmp = dt_module_lookup_by_name(dtp, sip->dts_object)) == NULL)
1225 1492                  return (dt_set_errno(dtp, EDT_NOMOD));
1226 1493  
1227 1494          if (symp->st_shndx == SHN_UNDEF && dmp->dm_extern != NULL) {
1228 1495                  dt_ident_t *idp =
1229 1496                      dt_idhash_lookup(dmp->dm_extern, sip->dts_name);
1230 1497  
1231 1498                  if (idp == NULL)
1232 1499                          return (dt_set_errno(dtp, EDT_NOSYM));
↓ open down ↓ 81 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX