Lines Matching refs:dmp

53 dt_module_symhash_insert(dt_module_t *dmp, const char *name, uint_t id)  in dt_module_symhash_insert()  argument
55 dt_sym_t *dsp = &dmp->dm_symchains[dmp->dm_symfree]; in dt_module_symhash_insert()
58 assert(dmp->dm_symfree < dmp->dm_nsymelems + 1); in dt_module_symhash_insert()
61 h = dt_strtab_hash(name, NULL) % dmp->dm_nsymbuckets; in dt_module_symhash_insert()
62 dsp->ds_next = dmp->dm_symbuckets[h]; in dt_module_symhash_insert()
63 dmp->dm_symbuckets[h] = dmp->dm_symfree++; in dt_module_symhash_insert()
67 dt_module_syminit32(dt_module_t *dmp) in dt_module_syminit32() argument
73 const Elf32_Sym *sym = dmp->dm_symtab.cts_data; in dt_module_syminit32()
74 const char *base = dmp->dm_strtab.cts_data; in dt_module_syminit32()
75 size_t ss_size = dmp->dm_strtab.cts_size; in dt_module_syminit32()
76 uint_t i, n = dmp->dm_nsymelems; in dt_module_syminit32()
93 dt_module_symhash_insert(dmp, name, i); in dt_module_syminit32()
100 dt_module_syminit64(dt_module_t *dmp) in dt_module_syminit64() argument
106 const Elf64_Sym *sym = dmp->dm_symtab.cts_data; in dt_module_syminit64()
107 const char *base = dmp->dm_strtab.cts_data; in dt_module_syminit64()
108 size_t ss_size = dmp->dm_strtab.cts_size; in dt_module_syminit64()
109 uint_t i, n = dmp->dm_nsymelems; in dt_module_syminit64()
126 dt_module_symhash_insert(dmp, name, i); in dt_module_syminit64()
191 dt_module_symsort32(dt_module_t *dmp) in dt_module_symsort32() argument
193 Elf32_Sym *symtab = (Elf32_Sym *)dmp->dm_symtab.cts_data; in dt_module_symsort32()
194 Elf32_Sym **sympp = (Elf32_Sym **)dmp->dm_asmap; in dt_module_symsort32()
195 const dt_sym_t *dsp = dmp->dm_symchains + 1; in dt_module_symsort32()
196 uint_t i, n = dmp->dm_symfree; in dt_module_symsort32()
205 dmp->dm_aslen = (uint_t)(sympp - (Elf32_Sym **)dmp->dm_asmap); in dt_module_symsort32()
206 assert(dmp->dm_aslen <= dmp->dm_asrsv); in dt_module_symsort32()
208 dt_module_strtab = dmp->dm_strtab.cts_data; in dt_module_symsort32()
209 qsort(dmp->dm_asmap, dmp->dm_aslen, in dt_module_symsort32()
215 dt_module_symsort64(dt_module_t *dmp) in dt_module_symsort64() argument
217 Elf64_Sym *symtab = (Elf64_Sym *)dmp->dm_symtab.cts_data; in dt_module_symsort64()
218 Elf64_Sym **sympp = (Elf64_Sym **)dmp->dm_asmap; in dt_module_symsort64()
219 const dt_sym_t *dsp = dmp->dm_symchains + 1; in dt_module_symsort64()
220 uint_t i, n = dmp->dm_symfree; in dt_module_symsort64()
229 dmp->dm_aslen = (uint_t)(sympp - (Elf64_Sym **)dmp->dm_asmap); in dt_module_symsort64()
230 assert(dmp->dm_aslen <= dmp->dm_asrsv); in dt_module_symsort64()
232 dt_module_strtab = dmp->dm_strtab.cts_data; in dt_module_symsort64()
233 qsort(dmp->dm_asmap, dmp->dm_aslen, in dt_module_symsort64()
263 dt_module_symname32(dt_module_t *dmp, const char *name, in dt_module_symname32() argument
266 const Elf32_Sym *symtab = dmp->dm_symtab.cts_data; in dt_module_symname32()
267 const char *strtab = dmp->dm_strtab.cts_data; in dt_module_symname32()
273 if (dmp->dm_nsymelems == 0) in dt_module_symname32()
276 h = dt_strtab_hash(name, NULL) % dmp->dm_nsymbuckets; in dt_module_symname32()
278 for (i = dmp->dm_symbuckets[h]; i != 0; i = dsp->ds_next) { in dt_module_symname32()
279 dsp = &dmp->dm_symchains[i]; in dt_module_symname32()
293 dt_module_symname64(dt_module_t *dmp, const char *name, in dt_module_symname64() argument
296 const Elf64_Sym *symtab = dmp->dm_symtab.cts_data; in dt_module_symname64()
297 const char *strtab = dmp->dm_strtab.cts_data; in dt_module_symname64()
303 if (dmp->dm_nsymelems == 0) in dt_module_symname64()
306 h = dt_strtab_hash(name, NULL) % dmp->dm_nsymbuckets; in dt_module_symname64()
308 for (i = dmp->dm_symbuckets[h]; i != 0; i = dsp->ds_next) { in dt_module_symname64()
309 dsp = &dmp->dm_symchains[i]; in dt_module_symname64()
323 dt_module_symaddr32(dt_module_t *dmp, GElf_Addr addr, in dt_module_symaddr32() argument
326 const Elf32_Sym **asmap = (const Elf32_Sym **)dmp->dm_asmap; in dt_module_symaddr32()
327 const Elf32_Sym *symtab = dmp->dm_symtab.cts_data; in dt_module_symaddr32()
330 uint_t i, mid, lo = 0, hi = dmp->dm_aslen - 1; in dt_module_symaddr32()
333 if (dmp->dm_aslen == 0) in dt_module_symaddr32()
365 dt_module_symaddr64(dt_module_t *dmp, GElf_Addr addr, in dt_module_symaddr64() argument
368 const Elf64_Sym **asmap = (const Elf64_Sym **)dmp->dm_asmap; in dt_module_symaddr64()
369 const Elf64_Sym *symtab = dmp->dm_symtab.cts_data; in dt_module_symaddr64()
372 uint_t i, mid, lo = 0, hi = dmp->dm_aslen - 1; in dt_module_symaddr64()
375 if (dmp->dm_aslen == 0) in dt_module_symaddr64()
427 dt_module_t *dmp; in dt_module_create() local
429 for (dmp = dtp->dt_mods[h]; dmp != NULL; dmp = dmp->dm_next) { in dt_module_create()
430 if (strcmp(dmp->dm_name, name) == 0) in dt_module_create()
431 return (dmp); in dt_module_create()
434 if ((dmp = malloc(sizeof (dt_module_t))) == NULL) in dt_module_create()
437 bzero(dmp, sizeof (dt_module_t)); in dt_module_create()
438 (void) strlcpy(dmp->dm_name, name, sizeof (dmp->dm_name)); in dt_module_create()
439 dt_list_append(&dtp->dt_modlist, dmp); in dt_module_create()
440 dmp->dm_next = dtp->dt_mods[h]; in dt_module_create()
441 dtp->dt_mods[h] = dmp; in dt_module_create()
445 dmp->dm_ops = &dt_modops_64; in dt_module_create()
447 dmp->dm_ops = &dt_modops_32; in dt_module_create()
459 if (strncmp(dmp->dm_name, "pid", 3) == 0) { in dt_module_create()
461 if (dmp->dm_name[3] == '\0') { in dt_module_create()
464 dmp->dm_pid = idp->di_id; in dt_module_create()
466 pid = strtol(dmp->dm_name + 3, &eptr, 10); in dt_module_create()
468 dmp->dm_pid = (pid_t)pid; in dt_module_create()
471 "module: %s\n", dmp->dm_name); in dt_module_create()
475 return (dmp); in dt_module_create()
482 dt_module_t *dmp; in dt_module_lookup_by_name() local
484 for (dmp = dtp->dt_mods[h]; dmp != NULL; dmp = dmp->dm_next) { in dt_module_lookup_by_name()
485 if (strcmp(dmp->dm_name, name) == 0) in dt_module_lookup_by_name()
486 return (dmp); in dt_module_lookup_by_name()
500 dt_module_load_sect(dtrace_hdl_t *dtp, dt_module_t *dmp, ctf_sect_t *ctsp) in dt_module_load_sect() argument
508 if (elf_getshdrstrndx(dmp->dm_elf, &shstrs) == -1) in dt_module_load_sect()
511 for (sp = NULL; (sp = elf_nextscn(dmp->dm_elf, sp)) != NULL; ) { in dt_module_load_sect()
513 (s = elf_strptr(dmp->dm_elf, shstrs, sh.sh_name)) == NULL) in dt_module_load_sect()
533 dmp->dm_name, ctsp->cts_name, (ulong_t)ctsp->cts_size); in dt_module_load_sect()
622 dt_module_load_proc(dtrace_hdl_t *dtp, dt_module_t *dmp) in dt_module_load_proc() argument
631 p = dt_proc_grab(dtp, dmp->dm_pid, 0, PGRAB_RDONLY | PGRAB_FORCE); in dt_module_load_proc()
633 dt_dprintf("failed to grab pid: %d\n", (int)dmp->dm_pid); in dt_module_load_proc()
640 arg.dpa_dmp = dmp; in dt_module_load_proc()
655 dmp->dm_libctfp = malloc(sizeof (ctf_file_t *) * arg.dpa_count); in dt_module_load_proc()
656 if (dmp->dm_libctfp == NULL) { in dt_module_load_proc()
661 bzero(dmp->dm_libctfp, sizeof (ctf_file_t *) * arg.dpa_count); in dt_module_load_proc()
663 dmp->dm_libctfn = malloc(sizeof (char *) * arg.dpa_count); in dt_module_load_proc()
664 if (dmp->dm_libctfn == NULL) { in dt_module_load_proc()
665 free(dmp->dm_libctfp); in dt_module_load_proc()
670 bzero(dmp->dm_libctfn, sizeof (char *) * arg.dpa_count); in dt_module_load_proc()
672 dmp->dm_nctflibs = arg.dpa_count; in dt_module_load_proc()
677 dt_module_unload(dtp, dmp); in dt_module_load_proc()
681 assert(arg.dpa_count == dmp->dm_nctflibs); in dt_module_load_proc()
683 (int)dmp->dm_pid); in dt_module_load_proc()
687 dmp->dm_flags |= DT_DM_LOADED; in dt_module_load_proc()
693 dt_module_load(dtrace_hdl_t *dtp, dt_module_t *dmp) in dt_module_load() argument
695 if (dmp->dm_flags & DT_DM_LOADED) in dt_module_load()
698 if (dmp->dm_pid != 0) in dt_module_load()
699 return (dt_module_load_proc(dtp, dmp)); in dt_module_load()
701 dmp->dm_ctdata.cts_name = ".SUNW_ctf"; in dt_module_load()
702 dmp->dm_ctdata.cts_type = SHT_PROGBITS; in dt_module_load()
703 dmp->dm_ctdata.cts_flags = 0; in dt_module_load()
704 dmp->dm_ctdata.cts_data = NULL; in dt_module_load()
705 dmp->dm_ctdata.cts_size = 0; in dt_module_load()
706 dmp->dm_ctdata.cts_entsize = 0; in dt_module_load()
707 dmp->dm_ctdata.cts_offset = 0; in dt_module_load()
709 dmp->dm_symtab.cts_name = ".symtab"; in dt_module_load()
710 dmp->dm_symtab.cts_type = SHT_SYMTAB; in dt_module_load()
711 dmp->dm_symtab.cts_flags = 0; in dt_module_load()
712 dmp->dm_symtab.cts_data = NULL; in dt_module_load()
713 dmp->dm_symtab.cts_size = 0; in dt_module_load()
714 dmp->dm_symtab.cts_entsize = dmp->dm_ops == &dt_modops_64 ? in dt_module_load()
716 dmp->dm_symtab.cts_offset = 0; in dt_module_load()
718 dmp->dm_strtab.cts_name = ".strtab"; in dt_module_load()
719 dmp->dm_strtab.cts_type = SHT_STRTAB; in dt_module_load()
720 dmp->dm_strtab.cts_flags = 0; in dt_module_load()
721 dmp->dm_strtab.cts_data = NULL; in dt_module_load()
722 dmp->dm_strtab.cts_size = 0; in dt_module_load()
723 dmp->dm_strtab.cts_entsize = 0; in dt_module_load()
724 dmp->dm_strtab.cts_offset = 0; in dt_module_load()
732 if (dt_module_load_sect(dtp, dmp, &dmp->dm_ctdata) == -1 || in dt_module_load()
733 dt_module_load_sect(dtp, dmp, &dmp->dm_symtab) == -1 || in dt_module_load()
734 dt_module_load_sect(dtp, dmp, &dmp->dm_strtab) == -1) { in dt_module_load()
735 dt_module_unload(dtp, dmp); in dt_module_load()
745 dmp->dm_nsymelems = in dt_module_load()
746 dmp->dm_symtab.cts_size / dmp->dm_symtab.cts_entsize; in dt_module_load()
748 dmp->dm_nsymbuckets = _dtrace_strbuckets; in dt_module_load()
749 dmp->dm_symfree = 1; /* first free element is index 1 */ in dt_module_load()
751 dmp->dm_symbuckets = malloc(sizeof (uint_t) * dmp->dm_nsymbuckets); in dt_module_load()
752 dmp->dm_symchains = malloc(sizeof (dt_sym_t) * dmp->dm_nsymelems + 1); in dt_module_load()
754 if (dmp->dm_symbuckets == NULL || dmp->dm_symchains == NULL) { in dt_module_load()
755 dt_module_unload(dtp, dmp); in dt_module_load()
759 bzero(dmp->dm_symbuckets, sizeof (uint_t) * dmp->dm_nsymbuckets); in dt_module_load()
760 bzero(dmp->dm_symchains, sizeof (dt_sym_t) * dmp->dm_nsymelems + 1); in dt_module_load()
767 dmp->dm_asrsv = dmp->dm_ops->do_syminit(dmp); in dt_module_load()
770 dmp->dm_name, dmp->dm_symtab.cts_name, dmp->dm_symfree - 1); in dt_module_load()
772 if ((dmp->dm_asmap = malloc(sizeof (void *) * dmp->dm_asrsv)) == NULL) { in dt_module_load()
773 dt_module_unload(dtp, dmp); in dt_module_load()
777 dmp->dm_ops->do_symsort(dmp); in dt_module_load()
780 dmp->dm_name, dmp->dm_symtab.cts_name, dmp->dm_aslen); in dt_module_load()
782 dmp->dm_flags |= DT_DM_LOADED; in dt_module_load()
787 dt_module_hasctf(dtrace_hdl_t *dtp, dt_module_t *dmp) in dt_module_hasctf() argument
789 if (dmp->dm_pid != 0 && dmp->dm_nctflibs > 0) in dt_module_hasctf()
791 return (dt_module_getctf(dtp, dmp) != NULL); in dt_module_hasctf()
795 dt_module_getctf(dtrace_hdl_t *dtp, dt_module_t *dmp) in dt_module_getctf() argument
802 if (dmp->dm_ctfp != NULL || dt_module_load(dtp, dmp) != 0) in dt_module_getctf()
803 return (dmp->dm_ctfp); in dt_module_getctf()
805 if (dmp->dm_ops == &dt_modops_64) in dt_module_getctf()
821 if (dmp->dm_ctdata.cts_size == 0) { in dt_module_getctf()
826 dmp->dm_ctfp = ctf_bufopen(&dmp->dm_ctdata, in dt_module_getctf()
827 &dmp->dm_symtab, &dmp->dm_strtab, &dtp->dt_ctferr); in dt_module_getctf()
829 if (dmp->dm_ctfp == NULL) { in dt_module_getctf()
834 (void) ctf_setmodel(dmp->dm_ctfp, model); in dt_module_getctf()
835 ctf_setspecific(dmp->dm_ctfp, dmp); in dt_module_getctf()
837 if ((parent = ctf_parent_name(dmp->dm_ctfp)) != NULL) { in dt_module_getctf()
845 if (ctf_import(dmp->dm_ctfp, pfp) == CTF_ERR) { in dt_module_getctf()
846 dtp->dt_ctferr = ctf_errno(dmp->dm_ctfp); in dt_module_getctf()
853 dmp->dm_name, (void *)dmp->dm_ctfp); in dt_module_getctf()
855 return (dmp->dm_ctfp); in dt_module_getctf()
858 ctf_close(dmp->dm_ctfp); in dt_module_getctf()
859 dmp->dm_ctfp = NULL; in dt_module_getctf()
865 dt_module_unload(dtrace_hdl_t *dtp, dt_module_t *dmp) in dt_module_unload() argument
869 ctf_close(dmp->dm_ctfp); in dt_module_unload()
870 dmp->dm_ctfp = NULL; in dt_module_unload()
872 if (dmp->dm_libctfp != NULL) { in dt_module_unload()
873 for (i = 0; i < dmp->dm_nctflibs; i++) { in dt_module_unload()
874 ctf_close(dmp->dm_libctfp[i]); in dt_module_unload()
875 free(dmp->dm_libctfn[i]); in dt_module_unload()
877 free(dmp->dm_libctfp); in dt_module_unload()
878 free(dmp->dm_libctfn); in dt_module_unload()
879 dmp->dm_libctfp = NULL; in dt_module_unload()
880 dmp->dm_nctflibs = 0; in dt_module_unload()
883 bzero(&dmp->dm_ctdata, sizeof (ctf_sect_t)); in dt_module_unload()
884 bzero(&dmp->dm_symtab, sizeof (ctf_sect_t)); in dt_module_unload()
885 bzero(&dmp->dm_strtab, sizeof (ctf_sect_t)); in dt_module_unload()
887 if (dmp->dm_symbuckets != NULL) { in dt_module_unload()
888 free(dmp->dm_symbuckets); in dt_module_unload()
889 dmp->dm_symbuckets = NULL; in dt_module_unload()
892 if (dmp->dm_symchains != NULL) { in dt_module_unload()
893 free(dmp->dm_symchains); in dt_module_unload()
894 dmp->dm_symchains = NULL; in dt_module_unload()
897 if (dmp->dm_asmap != NULL) { in dt_module_unload()
898 free(dmp->dm_asmap); in dt_module_unload()
899 dmp->dm_asmap = NULL; in dt_module_unload()
902 dmp->dm_symfree = 0; in dt_module_unload()
903 dmp->dm_nsymbuckets = 0; in dt_module_unload()
904 dmp->dm_nsymelems = 0; in dt_module_unload()
905 dmp->dm_asrsv = 0; in dt_module_unload()
906 dmp->dm_aslen = 0; in dt_module_unload()
908 dmp->dm_text_va = 0; in dt_module_unload()
909 dmp->dm_text_size = 0; in dt_module_unload()
910 dmp->dm_data_va = 0; in dt_module_unload()
911 dmp->dm_data_size = 0; in dt_module_unload()
912 dmp->dm_bss_va = 0; in dt_module_unload()
913 dmp->dm_bss_size = 0; in dt_module_unload()
915 if (dmp->dm_extern != NULL) { in dt_module_unload()
916 dt_idhash_destroy(dmp->dm_extern); in dt_module_unload()
917 dmp->dm_extern = NULL; in dt_module_unload()
920 (void) elf_end(dmp->dm_elf); in dt_module_unload()
921 dmp->dm_elf = NULL; in dt_module_unload()
923 dmp->dm_pid = 0; in dt_module_unload()
925 dmp->dm_flags &= ~DT_DM_LOADED; in dt_module_unload()
929 dt_module_destroy(dtrace_hdl_t *dtp, dt_module_t *dmp) in dt_module_destroy() argument
931 uint_t h = dt_strtab_hash(dmp->dm_name, NULL) % dtp->dt_modbuckets; in dt_module_destroy()
934 dt_list_delete(&dtp->dt_modlist, dmp); in dt_module_destroy()
943 while (*dmpp != dmp) { in dt_module_destroy()
948 *dmpp = dmp->dm_next; in dt_module_destroy()
950 dt_module_unload(dtp, dmp); in dt_module_destroy()
951 free(dmp); in dt_module_destroy()
961 dt_module_extern(dtrace_hdl_t *dtp, dt_module_t *dmp, in dt_module_extern() argument
968 if (dmp->dm_extern == NULL && (dmp->dm_extern = dt_idhash_create( in dt_module_extern()
969 "extern", NULL, dmp->dm_nsymelems, UINT_MAX)) == NULL) { in dt_module_extern()
974 if (dt_idhash_nextid(dmp->dm_extern, &id) == -1) { in dt_module_extern()
984 idp = dt_idhash_insert(dmp->dm_extern, name, DT_IDENT_SYMBOL, 0, id, in dt_module_extern()
993 sip->dts_object = dmp->dm_name; in dt_module_extern()
1005 dt_module_modelname(dt_module_t *dmp) in dt_module_modelname() argument
1007 if (dmp->dm_ops == &dt_modops_64) in dt_module_modelname()
1015 dt_module_getlibid(dtrace_hdl_t *dtp, dt_module_t *dmp, const ctf_file_t *fp) in dt_module_getlibid() argument
1019 for (i = 0; i < dmp->dm_nctflibs; i++) { in dt_module_getlibid()
1020 if (dmp->dm_libctfp[i] == fp) in dt_module_getlibid()
1029 dt_module_getctflib(dtrace_hdl_t *dtp, dt_module_t *dmp, const char *name) in dt_module_getctflib() argument
1033 for (i = 0; i < dmp->dm_nctflibs; i++) { in dt_module_getctflib()
1034 if (strcmp(dmp->dm_libctfn[i], name) == 0) in dt_module_getctflib()
1035 return (dmp->dm_libctfp[i]); in dt_module_getctflib()
1052 dt_module_t *dmp; in dt_module_update() local
1063 (dmp = dt_module_create(dtp, name)) == NULL) { in dt_module_update()
1075 dmp->dm_elf = elf_begin(fd, ELF_C_READ, NULL); in dt_module_update()
1076 err = elf_cntl(dmp->dm_elf, ELF_C_FDREAD); in dt_module_update()
1079 if (dmp->dm_elf == NULL || err == -1 || in dt_module_update()
1080 elf_getshdrstrndx(dmp->dm_elf, &shstrs) == -1) { in dt_module_update()
1083 dt_module_destroy(dtp, dmp); in dt_module_update()
1087 switch (gelf_getclass(dmp->dm_elf)) { in dt_module_update()
1089 dmp->dm_ops = &dt_modops_32; in dt_module_update()
1093 dmp->dm_ops = &dt_modops_64; in dt_module_update()
1098 dt_module_destroy(dtp, dmp); in dt_module_update()
1106 for (sp = NULL; (sp = elf_nextscn(dmp->dm_elf, sp)) != NULL; ) { in dt_module_update()
1108 (s = elf_strptr(dmp->dm_elf, shstrs, sh.sh_name)) == NULL) in dt_module_update()
1112 dmp->dm_text_size = sh.sh_size; in dt_module_update()
1113 dmp->dm_text_va = sh.sh_addr; in dt_module_update()
1115 dmp->dm_data_size = sh.sh_size; in dt_module_update()
1116 dmp->dm_data_va = sh.sh_addr; in dt_module_update()
1118 dmp->dm_bss_size = sh.sh_size; in dt_module_update()
1119 dmp->dm_bss_va = sh.sh_addr; in dt_module_update()
1122 bcopy(dp->d_buf, &dmp->dm_info, in dt_module_update()
1123 MIN(sh.sh_size, sizeof (dmp->dm_info))); in dt_module_update()
1126 (void) strlcpy(dmp->dm_file, in dt_module_update()
1127 dp->d_buf, sizeof (dmp->dm_file)); in dt_module_update()
1131 dmp->dm_flags |= DT_DM_KERNEL; in dt_module_update()
1132 dmp->dm_modid = (int)OBJFS_MODID(st.st_ino); in dt_module_update()
1134 if (dmp->dm_info.objfs_info_primary) in dt_module_update()
1135 dmp->dm_flags |= DT_DM_PRIMARY; in dt_module_update()
1138 bits, dmp->dm_name, dmp->dm_file, dmp->dm_modid); in dt_module_update()
1148 dt_module_t *dmp; in dtrace_update() local
1151 for (dmp = dt_list_next(&dtp->dt_modlist); in dtrace_update()
1152 dmp != NULL; dmp = dt_list_next(dmp)) in dtrace_update()
1153 dt_module_unload(dtp, dmp); in dtrace_update()
1216 dt_module_t *dmp; in dt_module_from_object() local
1220 dmp = dtp->dt_exec; in dt_module_from_object()
1223 dmp = dtp->dt_rtld; in dt_module_from_object()
1226 dmp = dtp->dt_cdefs; in dt_module_from_object()
1229 dmp = dtp->dt_ddefs; in dt_module_from_object()
1232 dmp = dt_module_create(dtp, object); in dt_module_from_object()
1236 if (dmp == NULL) in dt_module_from_object()
1239 return (dmp); in dt_module_from_object()
1250 dt_module_t *dmp; in dtrace_lookup_by_name() local
1261 if ((dmp = dt_module_from_object(dtp, object)) == NULL) in dtrace_lookup_by_name()
1264 if (dt_module_load(dtp, dmp) == -1) in dtrace_lookup_by_name()
1274 dmp = dt_list_next(&dtp->dt_modlist); in dtrace_lookup_by_name()
1281 for (; n > 0; n--, dmp = dt_list_next(dmp)) { in dtrace_lookup_by_name()
1282 if ((dmp->dm_flags & mask) != bits) in dtrace_lookup_by_name()
1285 if (dt_module_load(dtp, dmp) == -1) in dtrace_lookup_by_name()
1288 if (dmp->dm_ops->do_symname(dmp, name, symp, &id) != NULL) { in dtrace_lookup_by_name()
1290 sip->dts_object = dmp->dm_name; in dtrace_lookup_by_name()
1292 dmp->dm_strtab.cts_data + symp->st_name; in dtrace_lookup_by_name()
1298 if (dmp->dm_extern != NULL && in dtrace_lookup_by_name()
1299 (idp = dt_idhash_lookup(dmp->dm_extern, name)) != NULL) { in dtrace_lookup_by_name()
1312 sip->dts_object = dmp->dm_name; in dtrace_lookup_by_name()
1332 dt_module_t *dmp; in dtrace_lookup_by_addr() local
1339 for (dmp = dt_list_next(&dtp->dt_modlist); dmp != NULL; in dtrace_lookup_by_addr()
1340 dmp = dt_list_next(dmp)) { in dtrace_lookup_by_addr()
1341 if (addr - dmp->dm_text_va < dmp->dm_text_size || in dtrace_lookup_by_addr()
1342 addr - dmp->dm_data_va < dmp->dm_data_size || in dtrace_lookup_by_addr()
1343 addr - dmp->dm_bss_va < dmp->dm_bss_size) in dtrace_lookup_by_addr()
1347 if (dmp == NULL) in dtrace_lookup_by_addr()
1350 if (dt_module_load(dtp, dmp) == -1) in dtrace_lookup_by_addr()
1354 if (dmp->dm_ops->do_symaddr(dmp, addr, symp, &id) == NULL) in dtrace_lookup_by_addr()
1359 sip->dts_object = dmp->dm_name; in dtrace_lookup_by_addr()
1363 dmp->dm_strtab.cts_data + symp->st_name; in dtrace_lookup_by_addr()
1393 dtrace_lookup_by_type_user(dtrace_hdl_t *dtp, dt_module_t *dmp, in dtrace_lookup_by_type_user() argument
1402 if (dmp->dm_nctflibs == 0) { in dtrace_lookup_by_type_user()
1418 for (i = 0; i < dmp->dm_nctflibs; i++) { in dtrace_lookup_by_type_user()
1419 id = ctf_lookup_by_name(dmp->dm_libctfp[i], name); in dtrace_lookup_by_type_user()
1421 *fpp = dmp->dm_libctfp[i]; in dtrace_lookup_by_type_user()
1468 fp = dt_module_getctflib(dtp, dmp, obj); in dtrace_lookup_by_type_user()
1487 dt_module_t *dmp; in dtrace_lookup_by_type() local
1501 if ((dmp = dt_module_from_object(dtp, object)) == NULL) in dtrace_lookup_by_type()
1504 if (dt_module_load(dtp, dmp) == -1) in dtrace_lookup_by_type()
1514 dmp = dt_list_next(&dtp->dt_modlist); in dtrace_lookup_by_type()
1522 for (; n > 0; n--, dmp = dt_list_next(dmp)) { in dtrace_lookup_by_type()
1523 if ((dmp->dm_flags & mask) != bits) in dtrace_lookup_by_type()
1531 if (dt_module_hasctf(dtp, dmp) == 0) { in dtrace_lookup_by_type()
1543 if (dmp->dm_pid == 0) { in dtrace_lookup_by_type()
1544 id = ctf_lookup_by_name(dmp->dm_ctfp, name); in dtrace_lookup_by_type()
1545 fp = dmp->dm_ctfp; in dtrace_lookup_by_type()
1547 if (dtrace_lookup_by_type_user(dtp, dmp, name, in dtrace_lookup_by_type()
1553 tip->dtt_object = dmp->dm_name; in dtrace_lookup_by_type()
1574 dt_module_t *dmp; in dtrace_symbol_type() local
1581 if ((dmp = dt_module_lookup_by_name(dtp, sip->dts_object)) == NULL) in dtrace_symbol_type()
1584 if (symp->st_shndx == SHN_UNDEF && dmp->dm_extern != NULL) { in dtrace_symbol_type()
1586 dt_idhash_lookup(dmp->dm_extern, sip->dts_name); in dtrace_symbol_type()
1595 if (dt_module_getctf(dtp, dmp) == NULL) in dtrace_symbol_type()
1598 tip->dtt_ctfp = dmp->dm_ctfp; in dtrace_symbol_type()
1599 tip->dtt_type = ctf_lookup_by_symbol(dmp->dm_ctfp, sip->dts_id); in dtrace_symbol_type()
1611 tip->dtt_object = dmp->dm_name; in dtrace_symbol_type()
1616 dt_module_info(const dt_module_t *dmp, dtrace_objinfo_t *dto) in dt_module_info() argument
1618 dto->dto_name = dmp->dm_name; in dt_module_info()
1619 dto->dto_file = dmp->dm_file; in dt_module_info()
1620 dto->dto_id = dmp->dm_modid; in dt_module_info()
1623 if (dmp->dm_flags & DT_DM_KERNEL) in dt_module_info()
1625 if (dmp->dm_flags & DT_DM_PRIMARY) in dt_module_info()
1628 dto->dto_text_va = dmp->dm_text_va; in dt_module_info()
1629 dto->dto_text_size = dmp->dm_text_size; in dt_module_info()
1630 dto->dto_data_va = dmp->dm_data_va; in dt_module_info()
1631 dto->dto_data_size = dmp->dm_data_size; in dt_module_info()
1632 dto->dto_bss_va = dmp->dm_bss_va; in dt_module_info()
1633 dto->dto_bss_size = dmp->dm_bss_size; in dt_module_info()
1641 const dt_module_t *dmp = dt_list_next(&dtp->dt_modlist); in dtrace_object_iter() local
1645 for (; dmp != NULL; dmp = dt_list_next(dmp)) { in dtrace_object_iter()
1646 if ((rv = (*func)(dtp, dt_module_info(dmp, &dto), data)) != 0) in dtrace_object_iter()
1656 dt_module_t *dmp; in dtrace_object_info() local
1662 if ((dmp = dt_module_from_object(dtp, object)) == NULL) in dtrace_object_info()
1665 if (dt_module_load(dtp, dmp) == -1) in dtrace_object_info()
1668 (void) dt_module_info(dmp, dto); in dtrace_object_info()