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

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

35#include <stdlib.h>
36#include <stdio.h>
37#include <errno.h>
38#include <ctype.h>
39#if defined(sun)
40#include <alloca.h>
41#else
42#include <sys/sysctl.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

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

35#include <stdlib.h>
36#include <stdio.h>
37#include <errno.h>
38#include <ctype.h>
39#if defined(sun)
40#include <alloca.h>
41#else
42#include <sys/sysctl.h>
43#include <libproc_compat.h>
43#endif
44#include <assert.h>
45#include <libgen.h>
46#include <limits.h>
47
48#include <dt_impl.h>
49
50static const struct {

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

958
959 if (P == NULL) {
960 (void) snprintf(c, sizeof (c), "0x%llx", addr);
961 return (dt_string2str(c, str, nbytes));
962 }
963
964 dt_proc_lock(dtp, P);
965
44#endif
45#include <assert.h>
46#include <libgen.h>
47#include <limits.h>
48
49#include <dt_impl.h>
50
51static const struct {

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

959
960 if (P == NULL) {
961 (void) snprintf(c, sizeof (c), "0x%llx", addr);
962 return (dt_string2str(c, str, nbytes));
963 }
964
965 dt_proc_lock(dtp, P);
966
966#if defined(sun)
967 if (Plookup_by_addr(P, addr, name, sizeof (name), &sym) == 0) {
968 (void) Pobjname(P, addr, objname, sizeof (objname));
967 if (Plookup_by_addr(P, addr, name, sizeof (name), &sym) == 0) {
968 (void) Pobjname(P, addr, objname, sizeof (objname));
969#else
970 if (proc_addr2sym(P, addr, name, sizeof (name), &sym) == 0) {
971 (void) proc_objname(P, addr, objname, sizeof (objname));
972#endif
973
974 obj = dt_basename(objname);
975
976 if (addr > sym.st_value) {
977 (void) snprintf(c, sizeof (c), "%s`%s+0x%llx", obj,
978 name, (u_longlong_t)(addr - sym.st_value));
979 } else {
980 (void) snprintf(c, sizeof (c), "%s`%s", obj, name);
981 }
969
970 obj = dt_basename(objname);
971
972 if (addr > sym.st_value) {
973 (void) snprintf(c, sizeof (c), "%s`%s+0x%llx", obj,
974 name, (u_longlong_t)(addr - sym.st_value));
975 } else {
976 (void) snprintf(c, sizeof (c), "%s`%s", obj, name);
977 }
982#if defined(sun)
983 } else if (Pobjname(P, addr, objname, sizeof (objname)) != 0) {
978 } else if (Pobjname(P, addr, objname, sizeof (objname)) != 0) {
984#else
985 } else if (proc_objname(P, addr, objname, sizeof (objname)) != 0) {
986#endif
987 (void) snprintf(c, sizeof (c), "%s`0x%llx",
988 dt_basename(objname), addr);
989 } else {
990 (void) snprintf(c, sizeof (c), "0x%llx", addr);
991 }
992
993 dt_proc_unlock(dtp, P);
994 dt_proc_release(dtp, P);
995
996 return (dt_string2str(c, str, nbytes));
997}
979 (void) snprintf(c, sizeof (c), "%s`0x%llx",
980 dt_basename(objname), addr);
981 } else {
982 (void) snprintf(c, sizeof (c), "0x%llx", addr);
983 }
984
985 dt_proc_unlock(dtp, P);
986 dt_proc_release(dtp, P);
987
988 return (dt_string2str(c, str, nbytes));
989}