Deleted Added
full compact
dt_module.c (284085) dt_module.c (296816)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 10 unchanged lines hidden (view full) ---

19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25/*
26 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 10 unchanged lines hidden (view full) ---

19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25/*
26 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
27 * Copyright (c) 2016, Pedro Giffuni. All rights reserved.
27 */
28
29#include <sys/types.h>
30#ifdef illumos
31#include <sys/modctl.h>
32#include <sys/kobj.h>
33#include <sys/kobj_impl.h>
34#include <sys/sysmacros.h>

--- 681 unchanged lines hidden (view full) ---

716
717 if (arg.dpa_count == 0) {
718 dt_dprintf("no ctf data present\n");
719 dt_proc_unlock(dtp, p);
720 dt_proc_release(dtp, p);
721 return (dt_set_errno(dtp, EDT_CANTLOAD));
722 }
723
28 */
29
30#include <sys/types.h>
31#ifdef illumos
32#include <sys/modctl.h>
33#include <sys/kobj.h>
34#include <sys/kobj_impl.h>
35#include <sys/sysmacros.h>

--- 681 unchanged lines hidden (view full) ---

717
718 if (arg.dpa_count == 0) {
719 dt_dprintf("no ctf data present\n");
720 dt_proc_unlock(dtp, p);
721 dt_proc_release(dtp, p);
722 return (dt_set_errno(dtp, EDT_CANTLOAD));
723 }
724
724 dmp->dm_libctfp = malloc(sizeof (ctf_file_t *) * arg.dpa_count);
725 dmp->dm_libctfp = calloc(arg.dpa_count, sizeof (ctf_file_t *));
725 if (dmp->dm_libctfp == NULL) {
726 dt_proc_unlock(dtp, p);
727 dt_proc_release(dtp, p);
728 return (dt_set_errno(dtp, EDT_NOMEM));
729 }
726 if (dmp->dm_libctfp == NULL) {
727 dt_proc_unlock(dtp, p);
728 dt_proc_release(dtp, p);
729 return (dt_set_errno(dtp, EDT_NOMEM));
730 }
730 bzero(dmp->dm_libctfp, sizeof (ctf_file_t *) * arg.dpa_count);
731
731
732 dmp->dm_libctfn = malloc(sizeof (char *) * arg.dpa_count);
732 dmp->dm_libctfn = calloc(arg.dpa_count, sizeof (char *));
733 if (dmp->dm_libctfn == NULL) {
734 free(dmp->dm_libctfp);
735 dt_proc_unlock(dtp, p);
736 dt_proc_release(dtp, p);
737 return (dt_set_errno(dtp, EDT_NOMEM));
738 }
733 if (dmp->dm_libctfn == NULL) {
734 free(dmp->dm_libctfp);
735 dt_proc_unlock(dtp, p);
736 dt_proc_release(dtp, p);
737 return (dt_set_errno(dtp, EDT_NOMEM));
738 }
739 bzero(dmp->dm_libctfn, sizeof (char *) * arg.dpa_count);
740
741 dmp->dm_nctflibs = arg.dpa_count;
742
743 arg.dpa_count = 0;
744 if (Pobject_iter_resolved(p, dt_module_load_proc_build, &arg) != 0) {
745 dt_proc_unlock(dtp, p);
746 dt_module_unload(dtp, dmp);
747 dt_proc_release(dtp, p);

--- 64 unchanged lines hidden (view full) ---

812 * use element indices instead of pointers and zero is our sentinel.
813 */
814 dmp->dm_nsymelems =
815 dmp->dm_symtab.cts_size / dmp->dm_symtab.cts_entsize;
816
817 dmp->dm_nsymbuckets = _dtrace_strbuckets;
818 dmp->dm_symfree = 1; /* first free element is index 1 */
819
739
740 dmp->dm_nctflibs = arg.dpa_count;
741
742 arg.dpa_count = 0;
743 if (Pobject_iter_resolved(p, dt_module_load_proc_build, &arg) != 0) {
744 dt_proc_unlock(dtp, p);
745 dt_module_unload(dtp, dmp);
746 dt_proc_release(dtp, p);

--- 64 unchanged lines hidden (view full) ---

811 * use element indices instead of pointers and zero is our sentinel.
812 */
813 dmp->dm_nsymelems =
814 dmp->dm_symtab.cts_size / dmp->dm_symtab.cts_entsize;
815
816 dmp->dm_nsymbuckets = _dtrace_strbuckets;
817 dmp->dm_symfree = 1; /* first free element is index 1 */
818
820 dmp->dm_symbuckets = malloc(sizeof (uint_t) * dmp->dm_nsymbuckets);
821 dmp->dm_symchains = malloc(sizeof (dt_sym_t) * dmp->dm_nsymelems + 1);
819 dmp->dm_symbuckets = calloc(dmp->dm_nsymbuckets, sizeof (uint_t));
820 dmp->dm_symchains = calloc(dmp->dm_nsymelems + 1, sizeof (dt_sym_t));
822
823 if (dmp->dm_symbuckets == NULL || dmp->dm_symchains == NULL) {
824 dt_module_unload(dtp, dmp);
825 return (dt_set_errno(dtp, EDT_NOMEM));
826 }
827
821
822 if (dmp->dm_symbuckets == NULL || dmp->dm_symchains == NULL) {
823 dt_module_unload(dtp, dmp);
824 return (dt_set_errno(dtp, EDT_NOMEM));
825 }
826
828 bzero(dmp->dm_symbuckets, sizeof (uint_t) * dmp->dm_nsymbuckets);
829 bzero(dmp->dm_symchains, sizeof (dt_sym_t) * dmp->dm_nsymelems + 1);
830
831 /*
832 * Iterate over the symbol table data buffer and insert each symbol
833 * name into the name hash if the name and type are valid. Then
834 * allocate the address map, fill it in, and sort it.
835 */
836 dmp->dm_asrsv = dmp->dm_ops->do_syminit(dmp);
837
838 dt_dprintf("hashed %s [%s] (%u symbols)\n",

--- 947 unchanged lines hidden ---
827 /*
828 * Iterate over the symbol table data buffer and insert each symbol
829 * name into the name hash if the name and type are valid. Then
830 * allocate the address map, fill it in, and sort it.
831 */
832 dmp->dm_asrsv = dmp->dm_ops->do_syminit(dmp);
833
834 dt_dprintf("hashed %s [%s] (%u symbols)\n",

--- 947 unchanged lines hidden ---