7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /*
27 * Copyright 2012 Joyent, Inc. All rights reserved.
28 * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
29 */
30
31 #include "umem.h"
32
33 #include <sys/vmem_impl_user.h>
34 #include <umem_impl.h>
35
36 #include <alloca.h>
37 #include <limits.h>
38 #include <mdb/mdb_whatis.h>
39 #include <thr_uberdata.h>
40
41 #include "misc.h"
42 #include "leaky.h"
43 #include "dist.h"
44
45 #include "umem_pagesize.h"
46
47 #define UM_ALLOCATED 0x1
2099 if (vs->vs_type != VMEM_ALLOC && vs->vs_type != VMEM_FREE)
2100 return (WALK_NEXT);
2101
2102 while (mdb_whatis_match(w, vs->vs_start, size, &cur)) {
2103 mdb_whatis_report_object(w, cur, vs->vs_start, "");
2104
2105 /*
2106 * If we're not printing it seperately, provide the vmem_seg
2107 * pointer if it has a stack trace.
2108 */
2109 if ((mdb_whatis_flags(w) & WHATIS_QUIET) &&
2110 ((mdb_whatis_flags(w) & WHATIS_BUFCTL) != 0 ||
2111 (vs->vs_type == VMEM_ALLOC && vs->vs_depth != 0))) {
2112 mdb_printf("vmem_seg %p ", addr);
2113 }
2114
2115 mdb_printf("%s from %s vmem arena",
2116 (vs->vs_type == VMEM_ALLOC) ? "allocated" : "freed",
2117 wi->wi_vmem->vm_name);
2118
2119 if (!mdb_whatis_flags(w) & WHATIS_QUIET)
2120 whatis_call_printer(vmem_seg, addr);
2121 else
2122 mdb_printf("\n");
2123 }
2124
2125 return (WHATIS_WALKRET(w));
2126 }
2127
2128 static int
2129 whatis_walk_vmem(uintptr_t addr, const vmem_t *vmem, whatis_info_t *wi)
2130 {
2131 mdb_whatis_t *w = wi->wi_w;
2132 const char *nm = vmem->vm_name;
2133 wi->wi_vmem = vmem;
2134
2135 if (mdb_whatis_flags(w) & WHATIS_VERBOSE)
2136 mdb_printf("Searching vmem arena %s...\n", nm);
2137
2138 if (mdb_pwalk("vmem_seg",
2139 (mdb_walk_cb_t)whatis_walk_seg, wi, addr) == -1) {
|
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /*
27 * Copyright (c) 2018, Joyent, Inc.
28 * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
29 */
30
31 #include "umem.h"
32
33 #include <sys/vmem_impl_user.h>
34 #include <umem_impl.h>
35
36 #include <alloca.h>
37 #include <limits.h>
38 #include <mdb/mdb_whatis.h>
39 #include <thr_uberdata.h>
40
41 #include "misc.h"
42 #include "leaky.h"
43 #include "dist.h"
44
45 #include "umem_pagesize.h"
46
47 #define UM_ALLOCATED 0x1
2099 if (vs->vs_type != VMEM_ALLOC && vs->vs_type != VMEM_FREE)
2100 return (WALK_NEXT);
2101
2102 while (mdb_whatis_match(w, vs->vs_start, size, &cur)) {
2103 mdb_whatis_report_object(w, cur, vs->vs_start, "");
2104
2105 /*
2106 * If we're not printing it seperately, provide the vmem_seg
2107 * pointer if it has a stack trace.
2108 */
2109 if ((mdb_whatis_flags(w) & WHATIS_QUIET) &&
2110 ((mdb_whatis_flags(w) & WHATIS_BUFCTL) != 0 ||
2111 (vs->vs_type == VMEM_ALLOC && vs->vs_depth != 0))) {
2112 mdb_printf("vmem_seg %p ", addr);
2113 }
2114
2115 mdb_printf("%s from %s vmem arena",
2116 (vs->vs_type == VMEM_ALLOC) ? "allocated" : "freed",
2117 wi->wi_vmem->vm_name);
2118
2119 if (!(mdb_whatis_flags(w) & WHATIS_QUIET))
2120 whatis_call_printer(vmem_seg, addr);
2121 else
2122 mdb_printf("\n");
2123 }
2124
2125 return (WHATIS_WALKRET(w));
2126 }
2127
2128 static int
2129 whatis_walk_vmem(uintptr_t addr, const vmem_t *vmem, whatis_info_t *wi)
2130 {
2131 mdb_whatis_t *w = wi->wi_w;
2132 const char *nm = vmem->vm_name;
2133 wi->wi_vmem = vmem;
2134
2135 if (mdb_whatis_flags(w) & WHATIS_VERBOSE)
2136 mdb_printf("Searching vmem arena %s...\n", nm);
2137
2138 if (mdb_pwalk("vmem_seg",
2139 (mdb_walk_cb_t)whatis_walk_seg, wi, addr) == -1) {
|