Deleted Added
full compact
dt_consume.c (210767) dt_consume.c (211554)
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

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

29#include <unistd.h>
30#include <limits.h>
31#include <assert.h>
32#include <ctype.h>
33#if defined(sun)
34#include <alloca.h>
35#endif
36#include <dt_impl.h>
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

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

29#include <unistd.h>
30#include <limits.h>
31#include <assert.h>
32#include <ctype.h>
33#if defined(sun)
34#include <alloca.h>
35#endif
36#include <dt_impl.h>
37#if !defined(sun)
38#include <libproc_compat.h>
39#endif
37
38#define DT_MASK_LO 0x00000000FFFFFFFFULL
39
40/*
41 * We declare this here because (1) we need it and (2) we want to avoid a
42 * dependency on libm in libdtrace.
43 */
44static long double

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

947 dt_proc_lock(dtp, P); /* lock handle while we perform lookups */
948
949 for (i = 0; i < depth && pc[i] != 0; i++) {
950 const prmap_t *map;
951
952 if ((err = dt_printf(dtp, fp, "%*s", indent, "")) < 0)
953 break;
954
40
41#define DT_MASK_LO 0x00000000FFFFFFFFULL
42
43/*
44 * We declare this here because (1) we need it and (2) we want to avoid a
45 * dependency on libm in libdtrace.
46 */
47static long double

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

950 dt_proc_lock(dtp, P); /* lock handle while we perform lookups */
951
952 for (i = 0; i < depth && pc[i] != 0; i++) {
953 const prmap_t *map;
954
955 if ((err = dt_printf(dtp, fp, "%*s", indent, "")) < 0)
956 break;
957
955#if defined(sun)
956 if (P != NULL && Plookup_by_addr(P, pc[i],
958 if (P != NULL && Plookup_by_addr(P, pc[i],
957#else
958 if (P != NULL && proc_addr2sym(P, pc[i],
959#endif
960 name, sizeof (name), &sym) == 0) {
959 name, sizeof (name), &sym) == 0) {
961#if defined(sun)
962 (void) Pobjname(P, pc[i], objname, sizeof (objname));
960 (void) Pobjname(P, pc[i], objname, sizeof (objname));
963#else
964 (void) proc_objname(P, pc[i], objname, sizeof (objname));
965#endif
966
967 if (pc[i] > sym.st_value) {
968 (void) snprintf(c, sizeof (c),
969 "%s`%s+0x%llx", dt_basename(objname), name,
970 (u_longlong_t)(pc[i] - sym.st_value));
971 } else {
972 (void) snprintf(c, sizeof (c),
973 "%s`%s", dt_basename(objname), name);
974 }
975 } else if (str != NULL && str[0] != '\0' && str[0] != '@' &&
961
962 if (pc[i] > sym.st_value) {
963 (void) snprintf(c, sizeof (c),
964 "%s`%s+0x%llx", dt_basename(objname), name,
965 (u_longlong_t)(pc[i] - sym.st_value));
966 } else {
967 (void) snprintf(c, sizeof (c),
968 "%s`%s", dt_basename(objname), name);
969 }
970 } else if (str != NULL && str[0] != '\0' && str[0] != '@' &&
976#if defined(sun)
977 (P != NULL && ((map = Paddr_to_map(P, pc[i])) == NULL ||
978 (map->pr_mflags & MA_WRITE)))) {
971 (P != NULL && ((map = Paddr_to_map(P, pc[i])) == NULL ||
972 (map->pr_mflags & MA_WRITE)))) {
979#else
980 (P != NULL && ((map = proc_addr2map(P, pc[i])) == NULL))) {
981#endif
982 /*
983 * If the current string pointer in the string table
984 * does not point to an empty string _and_ the program
985 * counter falls in a writable region, we'll use the
986 * string from the string table instead of the raw
987 * address. This last condition is necessary because
988 * some (broken) ustack helpers will return a string
989 * even for a program counter that they can't
990 * identify. If we have a string for a program
991 * counter that falls in a segment that isn't
992 * writable, we assume that we have fallen into this
993 * case and we refuse to use the string.
994 */
995 (void) snprintf(c, sizeof (c), "%s", str);
996 } else {
973 /*
974 * If the current string pointer in the string table
975 * does not point to an empty string _and_ the program
976 * counter falls in a writable region, we'll use the
977 * string from the string table instead of the raw
978 * address. This last condition is necessary because
979 * some (broken) ustack helpers will return a string
980 * even for a program counter that they can't
981 * identify. If we have a string for a program
982 * counter that falls in a segment that isn't
983 * writable, we assume that we have fallen into this
984 * case and we refuse to use the string.
985 */
986 (void) snprintf(c, sizeof (c), "%s", str);
987 } else {
997#if defined(sun)
998 if (P != NULL && Pobjname(P, pc[i], objname,
988 if (P != NULL && Pobjname(P, pc[i], objname,
999#else
1000 if (P != NULL && proc_objname(P, pc[i], objname,
1001#endif
1002 sizeof (objname)) != 0) {
1003 (void) snprintf(c, sizeof (c), "%s`0x%llx",
1004 dt_basename(objname), (u_longlong_t)pc[i]);
1005 } else {
1006 (void) snprintf(c, sizeof (c), "0x%llx",
1007 (u_longlong_t)pc[i]);
1008 }
1009 }

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

1063 struct ps_prochandle *P;
1064
1065 if ((P = dt_proc_grab(dtp, pid,
1066 PGRAB_RDONLY | PGRAB_FORCE, 0)) != NULL) {
1067 GElf_Sym sym;
1068
1069 dt_proc_lock(dtp, P);
1070
989 sizeof (objname)) != 0) {
990 (void) snprintf(c, sizeof (c), "%s`0x%llx",
991 dt_basename(objname), (u_longlong_t)pc[i]);
992 } else {
993 (void) snprintf(c, sizeof (c), "0x%llx",
994 (u_longlong_t)pc[i]);
995 }
996 }

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

1050 struct ps_prochandle *P;
1051
1052 if ((P = dt_proc_grab(dtp, pid,
1053 PGRAB_RDONLY | PGRAB_FORCE, 0)) != NULL) {
1054 GElf_Sym sym;
1055
1056 dt_proc_lock(dtp, P);
1057
1071#if defined(sun)
1072 if (Plookup_by_addr(P, pc, NULL, 0, &sym) == 0)
1058 if (Plookup_by_addr(P, pc, NULL, 0, &sym) == 0)
1073#else
1074 if (proc_addr2sym(P, pc, NULL, 0, &sym) == 0)
1075#endif
1076 pc = sym.st_value;
1077
1078 dt_proc_unlock(dtp, P);
1079 dt_proc_release(dtp, P);
1080 }
1081 }
1082
1083 do {

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

1110 if (dtp->dt_vector == NULL)
1111 P = dt_proc_grab(dtp, pid, PGRAB_RDONLY | PGRAB_FORCE, 0);
1112 else
1113 P = NULL;
1114
1115 if (P != NULL)
1116 dt_proc_lock(dtp, P); /* lock handle while we perform lookups */
1117
1059 pc = sym.st_value;
1060
1061 dt_proc_unlock(dtp, P);
1062 dt_proc_release(dtp, P);
1063 }
1064 }
1065
1066 do {

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

1093 if (dtp->dt_vector == NULL)
1094 P = dt_proc_grab(dtp, pid, PGRAB_RDONLY | PGRAB_FORCE, 0);
1095 else
1096 P = NULL;
1097
1098 if (P != NULL)
1099 dt_proc_lock(dtp, P); /* lock handle while we perform lookups */
1100
1118#if defined(sun)
1119 if (P != NULL && Pobjname(P, pc, objname, sizeof (objname)) != 0) {
1101 if (P != NULL && Pobjname(P, pc, objname, sizeof (objname)) != 0) {
1120#else
1121 if (P != NULL && proc_objname(P, pc, objname, sizeof (objname)) != 0) {
1122#endif
1123 (void) snprintf(c, sizeof (c), "%s", dt_basename(objname));
1124 } else {
1125 (void) snprintf(c, sizeof (c), "0x%llx", (u_longlong_t)pc);
1126 }
1127
1128 err = dt_printf(dtp, fp, format, c);
1129
1130 if (P != NULL) {

--- 1514 unchanged lines hidden ---
1102 (void) snprintf(c, sizeof (c), "%s", dt_basename(objname));
1103 } else {
1104 (void) snprintf(c, sizeof (c), "0x%llx", (u_longlong_t)pc);
1105 }
1106
1107 err = dt_printf(dtp, fp, format, c);
1108
1109 if (P != NULL) {

--- 1514 unchanged lines hidden ---