Lines Matching refs:dmp
54 dt_module_symhash_insert(dt_module_t *dmp, const char *name, uint_t id) in dt_module_symhash_insert() argument
56 dt_sym_t *dsp = &dmp->dm_symchains[dmp->dm_symfree]; in dt_module_symhash_insert()
59 assert(dmp->dm_symfree < dmp->dm_nsymelems + 1); in dt_module_symhash_insert()
62 h = dt_strtab_hash(name, NULL) % dmp->dm_nsymbuckets; in dt_module_symhash_insert()
63 dsp->ds_next = dmp->dm_symbuckets[h]; in dt_module_symhash_insert()
64 dmp->dm_symbuckets[h] = dmp->dm_symfree++; in dt_module_symhash_insert()
68 dt_module_syminit32(dt_module_t *dmp) in dt_module_syminit32() argument
74 const Elf32_Sym *sym = dmp->dm_symtab.cts_data; in dt_module_syminit32()
75 const char *base = dmp->dm_strtab.cts_data; in dt_module_syminit32()
76 size_t ss_size = dmp->dm_strtab.cts_size; in dt_module_syminit32()
77 uint_t i, n = dmp->dm_nsymelems; in dt_module_syminit32()
94 dt_module_symhash_insert(dmp, name, i); in dt_module_syminit32()
101 dt_module_syminit64(dt_module_t *dmp) in dt_module_syminit64() argument
107 const Elf64_Sym *sym = dmp->dm_symtab.cts_data; in dt_module_syminit64()
108 const char *base = dmp->dm_strtab.cts_data; in dt_module_syminit64()
109 size_t ss_size = dmp->dm_strtab.cts_size; in dt_module_syminit64()
110 uint_t i, n = dmp->dm_nsymelems; in dt_module_syminit64()
127 dt_module_symhash_insert(dmp, name, i); in dt_module_syminit64()
192 dt_module_symsort32(dt_module_t *dmp) in dt_module_symsort32() argument
194 Elf32_Sym *symtab = (Elf32_Sym *)dmp->dm_symtab.cts_data; in dt_module_symsort32()
195 Elf32_Sym **sympp = (Elf32_Sym **)dmp->dm_asmap; in dt_module_symsort32()
196 const dt_sym_t *dsp = dmp->dm_symchains + 1; in dt_module_symsort32()
197 uint_t i, n = dmp->dm_symfree; in dt_module_symsort32()
206 dmp->dm_aslen = (uint_t)(sympp - (Elf32_Sym **)dmp->dm_asmap); in dt_module_symsort32()
207 assert(dmp->dm_aslen <= dmp->dm_asrsv); in dt_module_symsort32()
209 dt_module_strtab = dmp->dm_strtab.cts_data; in dt_module_symsort32()
210 qsort(dmp->dm_asmap, dmp->dm_aslen, in dt_module_symsort32()
216 dt_module_symsort64(dt_module_t *dmp) in dt_module_symsort64() argument
218 Elf64_Sym *symtab = (Elf64_Sym *)dmp->dm_symtab.cts_data; in dt_module_symsort64()
219 Elf64_Sym **sympp = (Elf64_Sym **)dmp->dm_asmap; in dt_module_symsort64()
220 const dt_sym_t *dsp = dmp->dm_symchains + 1; in dt_module_symsort64()
221 uint_t i, n = dmp->dm_symfree; in dt_module_symsort64()
230 dmp->dm_aslen = (uint_t)(sympp - (Elf64_Sym **)dmp->dm_asmap); in dt_module_symsort64()
231 assert(dmp->dm_aslen <= dmp->dm_asrsv); in dt_module_symsort64()
233 dt_module_strtab = dmp->dm_strtab.cts_data; in dt_module_symsort64()
234 qsort(dmp->dm_asmap, dmp->dm_aslen, in dt_module_symsort64()
264 dt_module_symname32(dt_module_t *dmp, const char *name, in dt_module_symname32() argument
267 const Elf32_Sym *symtab = dmp->dm_symtab.cts_data; in dt_module_symname32()
268 const char *strtab = dmp->dm_strtab.cts_data; in dt_module_symname32()
274 if (dmp->dm_nsymelems == 0) in dt_module_symname32()
277 h = dt_strtab_hash(name, NULL) % dmp->dm_nsymbuckets; in dt_module_symname32()
279 for (i = dmp->dm_symbuckets[h]; i != 0; i = dsp->ds_next) { in dt_module_symname32()
280 dsp = &dmp->dm_symchains[i]; in dt_module_symname32()
294 dt_module_symname64(dt_module_t *dmp, const char *name, in dt_module_symname64() argument
297 const Elf64_Sym *symtab = dmp->dm_symtab.cts_data; in dt_module_symname64()
298 const char *strtab = dmp->dm_strtab.cts_data; in dt_module_symname64()
304 if (dmp->dm_nsymelems == 0) in dt_module_symname64()
307 h = dt_strtab_hash(name, NULL) % dmp->dm_nsymbuckets; in dt_module_symname64()
309 for (i = dmp->dm_symbuckets[h]; i != 0; i = dsp->ds_next) { in dt_module_symname64()
310 dsp = &dmp->dm_symchains[i]; in dt_module_symname64()
324 dt_module_symaddr32(dt_module_t *dmp, GElf_Addr addr, in dt_module_symaddr32() argument
327 const Elf32_Sym **asmap = (const Elf32_Sym **)dmp->dm_asmap; in dt_module_symaddr32()
328 const Elf32_Sym *symtab = dmp->dm_symtab.cts_data; in dt_module_symaddr32()
331 uint_t i, mid, lo = 0, hi = dmp->dm_aslen - 1; in dt_module_symaddr32()
334 if (dmp->dm_aslen == 0) in dt_module_symaddr32()
366 dt_module_symaddr64(dt_module_t *dmp, GElf_Addr addr, in dt_module_symaddr64() argument
369 const Elf64_Sym **asmap = (const Elf64_Sym **)dmp->dm_asmap; in dt_module_symaddr64()
370 const Elf64_Sym *symtab = dmp->dm_symtab.cts_data; in dt_module_symaddr64()
373 uint_t i, mid, lo = 0, hi = dmp->dm_aslen - 1; in dt_module_symaddr64()
376 if (dmp->dm_aslen == 0) in dt_module_symaddr64()
428 dt_module_t *dmp; in dt_module_create() local
430 for (dmp = dtp->dt_mods[h]; dmp != NULL; dmp = dmp->dm_next) { in dt_module_create()
431 if (strcmp(dmp->dm_name, name) == 0) in dt_module_create()
432 return (dmp); in dt_module_create()
435 if ((dmp = malloc(sizeof (dt_module_t))) == NULL) in dt_module_create()
438 bzero(dmp, sizeof (dt_module_t)); in dt_module_create()
439 (void) strlcpy(dmp->dm_name, name, sizeof (dmp->dm_name)); in dt_module_create()
440 dt_list_append(&dtp->dt_modlist, dmp); in dt_module_create()
441 dmp->dm_next = dtp->dt_mods[h]; in dt_module_create()
442 dtp->dt_mods[h] = dmp; in dt_module_create()
446 dmp->dm_ops = &dt_modops_64; in dt_module_create()
448 dmp->dm_ops = &dt_modops_32; in dt_module_create()
460 if (strncmp(dmp->dm_name, "pid", 3) == 0) { in dt_module_create()
462 if (dmp->dm_name[3] == '\0') { in dt_module_create()
465 dmp->dm_pid = idp->di_id; in dt_module_create()
467 pid = strtol(dmp->dm_name + 3, &eptr, 10); in dt_module_create()
469 dmp->dm_pid = (pid_t)pid; in dt_module_create()
472 "module: %s\n", dmp->dm_name); in dt_module_create()
476 return (dmp); in dt_module_create()
483 dt_module_t *dmp; in dt_module_lookup_by_name() local
485 for (dmp = dtp->dt_mods[h]; dmp != NULL; dmp = dmp->dm_next) { in dt_module_lookup_by_name()
486 if (strcmp(dmp->dm_name, name) == 0) in dt_module_lookup_by_name()
487 return (dmp); in dt_module_lookup_by_name()
501 dt_module_load_sect(dtrace_hdl_t *dtp, dt_module_t *dmp, ctf_sect_t *ctsp) in dt_module_load_sect() argument
509 if (elf_getshdrstrndx(dmp->dm_elf, &shstrs) == -1) in dt_module_load_sect()
512 for (sp = NULL; (sp = elf_nextscn(dmp->dm_elf, sp)) != NULL; ) { in dt_module_load_sect()
514 (s = elf_strptr(dmp->dm_elf, shstrs, sh.sh_name)) == NULL) in dt_module_load_sect()
534 dmp->dm_name, ctsp->cts_name, (ulong_t)ctsp->cts_size); in dt_module_load_sect()
623 dt_module_load_proc(dtrace_hdl_t *dtp, dt_module_t *dmp) in dt_module_load_proc() argument
632 p = dt_proc_grab(dtp, dmp->dm_pid, 0, PGRAB_RDONLY | PGRAB_FORCE); in dt_module_load_proc()
634 dt_dprintf("failed to grab pid: %d\n", (int)dmp->dm_pid); in dt_module_load_proc()
641 arg.dpa_dmp = dmp; in dt_module_load_proc()
656 dmp->dm_libctfp = malloc(sizeof (ctf_file_t *) * arg.dpa_count); in dt_module_load_proc()
657 if (dmp->dm_libctfp == NULL) { in dt_module_load_proc()
662 bzero(dmp->dm_libctfp, sizeof (ctf_file_t *) * arg.dpa_count); in dt_module_load_proc()
664 dmp->dm_libctfn = malloc(sizeof (char *) * arg.dpa_count); in dt_module_load_proc()
665 if (dmp->dm_libctfn == NULL) { in dt_module_load_proc()
666 free(dmp->dm_libctfp); in dt_module_load_proc()
671 bzero(dmp->dm_libctfn, sizeof (char *) * arg.dpa_count); in dt_module_load_proc()
673 dmp->dm_nctflibs = arg.dpa_count; in dt_module_load_proc()
678 dt_module_unload(dtp, dmp); in dt_module_load_proc()
682 assert(arg.dpa_count == dmp->dm_nctflibs); in dt_module_load_proc()
684 (int)dmp->dm_pid); in dt_module_load_proc()
688 dmp->dm_flags |= DT_DM_LOADED; in dt_module_load_proc()
694 dt_module_load(dtrace_hdl_t *dtp, dt_module_t *dmp) in dt_module_load() argument
696 if (dmp->dm_flags & DT_DM_LOADED) in dt_module_load()
699 if (dmp->dm_pid != 0) in dt_module_load()
700 return (dt_module_load_proc(dtp, dmp)); in dt_module_load()
702 dmp->dm_ctdata.cts_name = ".SUNW_ctf"; in dt_module_load()
703 dmp->dm_ctdata.cts_type = SHT_PROGBITS; in dt_module_load()
704 dmp->dm_ctdata.cts_flags = 0; in dt_module_load()
705 dmp->dm_ctdata.cts_data = NULL; in dt_module_load()
706 dmp->dm_ctdata.cts_size = 0; in dt_module_load()
707 dmp->dm_ctdata.cts_entsize = 0; in dt_module_load()
708 dmp->dm_ctdata.cts_offset = 0; in dt_module_load()
710 dmp->dm_symtab.cts_name = ".symtab"; in dt_module_load()
711 dmp->dm_symtab.cts_type = SHT_SYMTAB; in dt_module_load()
712 dmp->dm_symtab.cts_flags = 0; in dt_module_load()
713 dmp->dm_symtab.cts_data = NULL; in dt_module_load()
714 dmp->dm_symtab.cts_size = 0; in dt_module_load()
715 dmp->dm_symtab.cts_entsize = dmp->dm_ops == &dt_modops_64 ? in dt_module_load()
717 dmp->dm_symtab.cts_offset = 0; in dt_module_load()
719 dmp->dm_strtab.cts_name = ".strtab"; in dt_module_load()
720 dmp->dm_strtab.cts_type = SHT_STRTAB; in dt_module_load()
721 dmp->dm_strtab.cts_flags = 0; in dt_module_load()
722 dmp->dm_strtab.cts_data = NULL; in dt_module_load()
723 dmp->dm_strtab.cts_size = 0; in dt_module_load()
724 dmp->dm_strtab.cts_entsize = 0; in dt_module_load()
725 dmp->dm_strtab.cts_offset = 0; in dt_module_load()
733 if (dt_module_load_sect(dtp, dmp, &dmp->dm_ctdata) == -1 || in dt_module_load()
734 dt_module_load_sect(dtp, dmp, &dmp->dm_symtab) == -1 || in dt_module_load()
735 dt_module_load_sect(dtp, dmp, &dmp->dm_strtab) == -1) { in dt_module_load()
736 dt_module_unload(dtp, dmp); in dt_module_load()
746 dmp->dm_nsymelems = in dt_module_load()
747 dmp->dm_symtab.cts_size / dmp->dm_symtab.cts_entsize; in dt_module_load()
749 dmp->dm_nsymbuckets = _dtrace_strbuckets; in dt_module_load()
750 dmp->dm_symfree = 1; /* first free element is index 1 */ in dt_module_load()
752 dmp->dm_symbuckets = malloc(sizeof (uint_t) * dmp->dm_nsymbuckets); in dt_module_load()
753 dmp->dm_symchains = malloc(sizeof (dt_sym_t) * dmp->dm_nsymelems + 1); in dt_module_load()
755 if (dmp->dm_symbuckets == NULL || dmp->dm_symchains == NULL) { in dt_module_load()
756 dt_module_unload(dtp, dmp); in dt_module_load()
760 bzero(dmp->dm_symbuckets, sizeof (uint_t) * dmp->dm_nsymbuckets); in dt_module_load()
761 bzero(dmp->dm_symchains, sizeof (dt_sym_t) * dmp->dm_nsymelems + 1); in dt_module_load()
768 dmp->dm_asrsv = dmp->dm_ops->do_syminit(dmp); in dt_module_load()
771 dmp->dm_name, dmp->dm_symtab.cts_name, dmp->dm_symfree - 1); in dt_module_load()
773 if ((dmp->dm_asmap = malloc(sizeof (void *) * dmp->dm_asrsv)) == NULL) { in dt_module_load()
774 dt_module_unload(dtp, dmp); in dt_module_load()
778 dmp->dm_ops->do_symsort(dmp); in dt_module_load()
781 dmp->dm_name, dmp->dm_symtab.cts_name, dmp->dm_aslen); in dt_module_load()
783 dmp->dm_flags |= DT_DM_LOADED; in dt_module_load()
788 dt_module_hasctf(dtrace_hdl_t *dtp, dt_module_t *dmp) in dt_module_hasctf() argument
790 if (dmp->dm_pid != 0 && dmp->dm_nctflibs > 0) in dt_module_hasctf()
792 return (dt_module_getctf(dtp, dmp) != NULL); in dt_module_hasctf()
796 dt_module_getctf(dtrace_hdl_t *dtp, dt_module_t *dmp) in dt_module_getctf() argument
803 if (dmp->dm_ctfp != NULL || dt_module_load(dtp, dmp) != 0) in dt_module_getctf()
804 return (dmp->dm_ctfp); in dt_module_getctf()
806 if (dmp->dm_ops == &dt_modops_64) in dt_module_getctf()
822 if (dmp->dm_ctdata.cts_size == 0) { in dt_module_getctf()
827 dmp->dm_ctfp = ctf_bufopen(&dmp->dm_ctdata, in dt_module_getctf()
828 &dmp->dm_symtab, &dmp->dm_strtab, &dtp->dt_ctferr); in dt_module_getctf()
830 if (dmp->dm_ctfp == NULL) { in dt_module_getctf()
835 (void) ctf_setmodel(dmp->dm_ctfp, model); in dt_module_getctf()
836 ctf_setspecific(dmp->dm_ctfp, dmp); in dt_module_getctf()
838 if ((parent = ctf_parent_name(dmp->dm_ctfp)) != NULL) { in dt_module_getctf()
846 if (ctf_import(dmp->dm_ctfp, pfp) == CTF_ERR) { in dt_module_getctf()
847 dtp->dt_ctferr = ctf_errno(dmp->dm_ctfp); in dt_module_getctf()
854 dmp->dm_name, (void *)dmp->dm_ctfp); in dt_module_getctf()
856 return (dmp->dm_ctfp); in dt_module_getctf()
859 ctf_close(dmp->dm_ctfp); in dt_module_getctf()
860 dmp->dm_ctfp = NULL; in dt_module_getctf()
866 dt_module_unload(dtrace_hdl_t *dtp, dt_module_t *dmp) in dt_module_unload() argument
870 ctf_close(dmp->dm_ctfp); in dt_module_unload()
871 dmp->dm_ctfp = NULL; in dt_module_unload()
873 if (dmp->dm_libctfp != NULL) { in dt_module_unload()
874 for (i = 0; i < dmp->dm_nctflibs; i++) { in dt_module_unload()
875 ctf_close(dmp->dm_libctfp[i]); in dt_module_unload()
876 free(dmp->dm_libctfn[i]); in dt_module_unload()
878 free(dmp->dm_libctfp); in dt_module_unload()
879 free(dmp->dm_libctfn); in dt_module_unload()
880 dmp->dm_libctfp = NULL; in dt_module_unload()
881 dmp->dm_nctflibs = 0; in dt_module_unload()
884 bzero(&dmp->dm_ctdata, sizeof (ctf_sect_t)); in dt_module_unload()
885 bzero(&dmp->dm_symtab, sizeof (ctf_sect_t)); in dt_module_unload()
886 bzero(&dmp->dm_strtab, sizeof (ctf_sect_t)); in dt_module_unload()
888 if (dmp->dm_symbuckets != NULL) { in dt_module_unload()
889 free(dmp->dm_symbuckets); in dt_module_unload()
890 dmp->dm_symbuckets = NULL; in dt_module_unload()
893 if (dmp->dm_symchains != NULL) { in dt_module_unload()
894 free(dmp->dm_symchains); in dt_module_unload()
895 dmp->dm_symchains = NULL; in dt_module_unload()
898 if (dmp->dm_asmap != NULL) { in dt_module_unload()
899 free(dmp->dm_asmap); in dt_module_unload()
900 dmp->dm_asmap = NULL; in dt_module_unload()
903 dmp->dm_symfree = 0; in dt_module_unload()
904 dmp->dm_nsymbuckets = 0; in dt_module_unload()
905 dmp->dm_nsymelems = 0; in dt_module_unload()
906 dmp->dm_asrsv = 0; in dt_module_unload()
907 dmp->dm_aslen = 0; in dt_module_unload()
909 dmp->dm_text_va = NULL; in dt_module_unload()
910 dmp->dm_text_size = 0; in dt_module_unload()
911 dmp->dm_data_va = NULL; in dt_module_unload()
912 dmp->dm_data_size = 0; in dt_module_unload()
913 dmp->dm_bss_va = NULL; in dt_module_unload()
914 dmp->dm_bss_size = 0; in dt_module_unload()
916 if (dmp->dm_extern != NULL) { in dt_module_unload()
917 dt_idhash_destroy(dmp->dm_extern); in dt_module_unload()
918 dmp->dm_extern = NULL; in dt_module_unload()
921 (void) elf_end(dmp->dm_elf); in dt_module_unload()
922 dmp->dm_elf = NULL; in dt_module_unload()
924 dmp->dm_pid = 0; in dt_module_unload()
926 dmp->dm_flags &= ~DT_DM_LOADED; in dt_module_unload()
930 dt_module_destroy(dtrace_hdl_t *dtp, dt_module_t *dmp) in dt_module_destroy() argument
932 uint_t h = dt_strtab_hash(dmp->dm_name, NULL) % dtp->dt_modbuckets; in dt_module_destroy()
935 dt_list_delete(&dtp->dt_modlist, dmp); in dt_module_destroy()
944 while (*dmpp != dmp) { in dt_module_destroy()
949 *dmpp = dmp->dm_next; in dt_module_destroy()
951 dt_module_unload(dtp, dmp); in dt_module_destroy()
952 free(dmp); in dt_module_destroy()
962 dt_module_extern(dtrace_hdl_t *dtp, dt_module_t *dmp, in dt_module_extern() argument
969 if (dmp->dm_extern == NULL && (dmp->dm_extern = dt_idhash_create( in dt_module_extern()
970 "extern", NULL, dmp->dm_nsymelems, UINT_MAX)) == NULL) { in dt_module_extern()
975 if (dt_idhash_nextid(dmp->dm_extern, &id) == -1) { in dt_module_extern()
985 idp = dt_idhash_insert(dmp->dm_extern, name, DT_IDENT_SYMBOL, 0, id, in dt_module_extern()
994 sip->dts_object = dmp->dm_name; in dt_module_extern()
1006 dt_module_modelname(dt_module_t *dmp) in dt_module_modelname() argument
1008 if (dmp->dm_ops == &dt_modops_64) in dt_module_modelname()
1016 dt_module_getlibid(dtrace_hdl_t *dtp, dt_module_t *dmp, const ctf_file_t *fp) in dt_module_getlibid() argument
1020 for (i = 0; i < dmp->dm_nctflibs; i++) { in dt_module_getlibid()
1021 if (dmp->dm_libctfp[i] == fp) in dt_module_getlibid()
1030 dt_module_getctflib(dtrace_hdl_t *dtp, dt_module_t *dmp, const char *name) in dt_module_getctflib() argument
1034 for (i = 0; i < dmp->dm_nctflibs; i++) { in dt_module_getctflib()
1035 if (strcmp(dmp->dm_libctfn[i], name) == 0) in dt_module_getctflib()
1036 return (dmp->dm_libctfp[i]); in dt_module_getctflib()
1053 dt_module_t *dmp; in dt_module_update() local
1064 (dmp = dt_module_create(dtp, name)) == NULL) { in dt_module_update()
1076 dmp->dm_elf = elf_begin(fd, ELF_C_READ, NULL); in dt_module_update()
1077 err = elf_cntl(dmp->dm_elf, ELF_C_FDREAD); in dt_module_update()
1080 if (dmp->dm_elf == NULL || err == -1 || in dt_module_update()
1081 elf_getshdrstrndx(dmp->dm_elf, &shstrs) == -1) { in dt_module_update()
1084 dt_module_destroy(dtp, dmp); in dt_module_update()
1088 switch (gelf_getclass(dmp->dm_elf)) { in dt_module_update()
1090 dmp->dm_ops = &dt_modops_32; in dt_module_update()
1094 dmp->dm_ops = &dt_modops_64; in dt_module_update()
1099 dt_module_destroy(dtp, dmp); in dt_module_update()
1107 for (sp = NULL; (sp = elf_nextscn(dmp->dm_elf, sp)) != NULL; ) { in dt_module_update()
1109 (s = elf_strptr(dmp->dm_elf, shstrs, sh.sh_name)) == NULL) in dt_module_update()
1113 dmp->dm_text_size = sh.sh_size; in dt_module_update()
1114 dmp->dm_text_va = sh.sh_addr; in dt_module_update()
1116 dmp->dm_data_size = sh.sh_size; in dt_module_update()
1117 dmp->dm_data_va = sh.sh_addr; in dt_module_update()
1119 dmp->dm_bss_size = sh.sh_size; in dt_module_update()
1120 dmp->dm_bss_va = sh.sh_addr; in dt_module_update()
1123 bcopy(dp->d_buf, &dmp->dm_info, in dt_module_update()
1124 MIN(sh.sh_size, sizeof (dmp->dm_info))); in dt_module_update()
1127 (void) strlcpy(dmp->dm_file, in dt_module_update()
1128 dp->d_buf, sizeof (dmp->dm_file)); in dt_module_update()
1132 dmp->dm_flags |= DT_DM_KERNEL; in dt_module_update()
1133 dmp->dm_modid = (int)OBJFS_MODID(st.st_ino); in dt_module_update()
1135 if (dmp->dm_info.objfs_info_primary) in dt_module_update()
1136 dmp->dm_flags |= DT_DM_PRIMARY; in dt_module_update()
1139 bits, dmp->dm_name, dmp->dm_file, dmp->dm_modid); in dt_module_update()
1149 dt_module_t *dmp; in dtrace_update() local
1152 for (dmp = dt_list_next(&dtp->dt_modlist); in dtrace_update()
1153 dmp != NULL; dmp = dt_list_next(dmp)) in dtrace_update()
1154 dt_module_unload(dtp, dmp); in dtrace_update()
1217 dt_module_t *dmp; in dt_module_from_object() local
1221 dmp = dtp->dt_exec; in dt_module_from_object()
1224 dmp = dtp->dt_rtld; in dt_module_from_object()
1227 dmp = dtp->dt_cdefs; in dt_module_from_object()
1230 dmp = dtp->dt_ddefs; in dt_module_from_object()
1233 dmp = dt_module_create(dtp, object); in dt_module_from_object()
1237 if (dmp == NULL) in dt_module_from_object()
1240 return (dmp); in dt_module_from_object()
1251 dt_module_t *dmp; in dtrace_lookup_by_name() local
1262 if ((dmp = dt_module_from_object(dtp, object)) == NULL) in dtrace_lookup_by_name()
1265 if (dt_module_load(dtp, dmp) == -1) in dtrace_lookup_by_name()
1275 dmp = dt_list_next(&dtp->dt_modlist); in dtrace_lookup_by_name()
1282 for (; n > 0; n--, dmp = dt_list_next(dmp)) { in dtrace_lookup_by_name()
1283 if ((dmp->dm_flags & mask) != bits) in dtrace_lookup_by_name()
1286 if (dt_module_load(dtp, dmp) == -1) in dtrace_lookup_by_name()
1289 if (dmp->dm_ops->do_symname(dmp, name, symp, &id) != NULL) { in dtrace_lookup_by_name()
1291 sip->dts_object = dmp->dm_name; in dtrace_lookup_by_name()
1293 dmp->dm_strtab.cts_data + symp->st_name; in dtrace_lookup_by_name()
1299 if (dmp->dm_extern != NULL && in dtrace_lookup_by_name()
1300 (idp = dt_idhash_lookup(dmp->dm_extern, name)) != NULL) { in dtrace_lookup_by_name()
1313 sip->dts_object = dmp->dm_name; in dtrace_lookup_by_name()
1333 dt_module_t *dmp; in dtrace_lookup_by_addr() local
1340 for (dmp = dt_list_next(&dtp->dt_modlist); dmp != NULL; in dtrace_lookup_by_addr()
1341 dmp = dt_list_next(dmp)) { in dtrace_lookup_by_addr()
1342 if (addr - dmp->dm_text_va < dmp->dm_text_size || in dtrace_lookup_by_addr()
1343 addr - dmp->dm_data_va < dmp->dm_data_size || in dtrace_lookup_by_addr()
1344 addr - dmp->dm_bss_va < dmp->dm_bss_size) in dtrace_lookup_by_addr()
1348 if (dmp == NULL) in dtrace_lookup_by_addr()
1351 if (dt_module_load(dtp, dmp) == -1) in dtrace_lookup_by_addr()
1355 if (dmp->dm_ops->do_symaddr(dmp, addr, symp, &id) == NULL) in dtrace_lookup_by_addr()
1360 sip->dts_object = dmp->dm_name; in dtrace_lookup_by_addr()
1364 dmp->dm_strtab.cts_data + symp->st_name; in dtrace_lookup_by_addr()
1380 dt_module_t *dmp; in dtrace_lookup_by_type() local
1394 if ((dmp = dt_module_from_object(dtp, object)) == NULL) in dtrace_lookup_by_type()
1397 if (dt_module_load(dtp, dmp) == -1) in dtrace_lookup_by_type()
1407 dmp = dt_list_next(&dtp->dt_modlist); in dtrace_lookup_by_type()
1415 for (; n > 0; n--, dmp = dt_list_next(dmp)) { in dtrace_lookup_by_type()
1416 if ((dmp->dm_flags & mask) != bits) in dtrace_lookup_by_type()
1424 if (dt_module_hasctf(dtp, dmp) == 0) { in dtrace_lookup_by_type()
1436 if (dmp->dm_pid == 0) { in dtrace_lookup_by_type()
1437 id = ctf_lookup_by_name(dmp->dm_ctfp, name); in dtrace_lookup_by_type()
1438 fp = dmp->dm_ctfp; in dtrace_lookup_by_type()
1448 fp = dt_module_getctflib(dtp, dmp, buf); in dtrace_lookup_by_type()
1454 for (i = 0; i < dmp->dm_nctflibs; i++) { in dtrace_lookup_by_type()
1455 fp = dmp->dm_libctfp[i]; in dtrace_lookup_by_type()
1463 tip->dtt_object = dmp->dm_name; in dtrace_lookup_by_type()
1484 dt_module_t *dmp; in dtrace_symbol_type() local
1491 if ((dmp = dt_module_lookup_by_name(dtp, sip->dts_object)) == NULL) in dtrace_symbol_type()
1494 if (symp->st_shndx == SHN_UNDEF && dmp->dm_extern != NULL) { in dtrace_symbol_type()
1496 dt_idhash_lookup(dmp->dm_extern, sip->dts_name); in dtrace_symbol_type()
1505 if (dt_module_getctf(dtp, dmp) == NULL) in dtrace_symbol_type()
1508 tip->dtt_ctfp = dmp->dm_ctfp; in dtrace_symbol_type()
1509 tip->dtt_type = ctf_lookup_by_symbol(dmp->dm_ctfp, sip->dts_id); in dtrace_symbol_type()
1521 tip->dtt_object = dmp->dm_name; in dtrace_symbol_type()
1526 dt_module_info(const dt_module_t *dmp, dtrace_objinfo_t *dto) in dt_module_info() argument
1528 dto->dto_name = dmp->dm_name; in dt_module_info()
1529 dto->dto_file = dmp->dm_file; in dt_module_info()
1530 dto->dto_id = dmp->dm_modid; in dt_module_info()
1533 if (dmp->dm_flags & DT_DM_KERNEL) in dt_module_info()
1535 if (dmp->dm_flags & DT_DM_PRIMARY) in dt_module_info()
1538 dto->dto_text_va = dmp->dm_text_va; in dt_module_info()
1539 dto->dto_text_size = dmp->dm_text_size; in dt_module_info()
1540 dto->dto_data_va = dmp->dm_data_va; in dt_module_info()
1541 dto->dto_data_size = dmp->dm_data_size; in dt_module_info()
1542 dto->dto_bss_va = dmp->dm_bss_va; in dt_module_info()
1543 dto->dto_bss_size = dmp->dm_bss_size; in dt_module_info()
1551 const dt_module_t *dmp = dt_list_next(&dtp->dt_modlist); in dtrace_object_iter() local
1555 for (; dmp != NULL; dmp = dt_list_next(dmp)) { in dtrace_object_iter()
1556 if ((rv = (*func)(dtp, dt_module_info(dmp, &dto), data)) != 0) in dtrace_object_iter()
1566 dt_module_t *dmp; in dtrace_object_info() local
1572 if ((dmp = dt_module_from_object(dtp, object)) == NULL) in dtrace_object_info()
1575 if (dt_module_load(dtp, dmp) == -1) in dtrace_object_info()
1578 (void) dt_module_info(dmp, dto); in dtrace_object_info()