Deleted Added
sdiff udiff text old ( 210767 ) new ( 211554 )
full compact
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
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
958 if (P != NULL && Plookup_by_addr(P, pc[i],
959 name, sizeof (name), &sym) == 0) {
960 (void) Pobjname(P, pc[i], objname, sizeof (objname));
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] != '@' &&
971 (P != NULL && ((map = Paddr_to_map(P, pc[i])) == NULL ||
972 (map->pr_mflags & MA_WRITE)))) {
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 {
988 if (P != NULL && Pobjname(P, pc[i], objname,
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
1058 if (Plookup_by_addr(P, pc, NULL, 0, &sym) == 0)
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
1101 if (P != NULL && Pobjname(P, pc, objname, sizeof (objname)) != 0) {
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 ---