summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorBryan Cantrill <bryan@joyent.com>2013-03-25 16:08:28 +0000
committerBryan Cantrill <bryan@joyent.com>2013-03-25 17:08:16 +0000
commit5ead6e8b9ba1f811e31c504ffde831c27acf7d8c (patch)
treef59f133d7218c518c33b16e3f2532c92db53437b /usr/src
parentd08958852b74577c6c21fa6bf2fb5dbc92b5e2a7 (diff)
downloadillumos-joyent-5ead6e8b9ba1f811e31c504ffde831c27acf7d8c.tar.gz
OS-2062 mdb/pmap should show unresolved map names on core dumps
Reviewed by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_proc.c21
-rw-r--r--usr/src/cmd/ptools/pmap/pmap_common.c5
2 files changed, 18 insertions, 8 deletions
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_proc.c b/usr/src/cmd/mdb/common/mdb/mdb_proc.c
index 37282f8906..667bfe8c47 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_proc.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_proc.c
@@ -24,7 +24,7 @@
* Use is subject to license terms.
*/
/*
- * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
/*
@@ -125,6 +125,13 @@ static int tlsbase(mdb_tgt_t *, mdb_tgt_tid_t, Lmid_t, const char *,
psaddr_t *);
/*
+ * When debugging postmortem, we don't resolve names as we may very well not
+ * be on a system on which those names resolve.
+ */
+#define PT_LIBPROC_RESOLVE(P) \
+ (!(mdb.m_flags & MDB_FL_LMRAW) && Pstate(P) != PS_DEAD)
+
+/*
* The Perror_printf() function interposes on the default, empty libproc
* definition. It will be called to report additional information on complex
* errors, such as a corrupt core file. We just pass the args to vwarn.
@@ -2808,7 +2815,7 @@ pt_lookup_by_addr(mdb_tgt_t *t, uintptr_t addr, uint_t flags,
* Once we get the closest symbol, we perform the EXACT match or
* smart-mode or absolute distance check ourself:
*/
- if ((mdb.m_flags & MDB_FL_LMRAW) == 0) {
+ if (PT_LIBPROC_RESOLVE(P)) {
rv = Pxlookup_by_addr_resolved(P, addr, buf, nbytes,
symp, &si);
} else {
@@ -2853,7 +2860,7 @@ found:
const char *prefix = pmp->pr_mapname;
Lmid_t lmid;
- if ((mdb.m_flags & MDB_FL_LMRAW) == 0) {
+ if (PT_LIBPROC_RESOLVE(P)) {
if (Pobjname_resolved(P, addr, pt->p_objname,
MDB_TGT_MAPSZ))
prefix = pt->p_objname;
@@ -2955,7 +2962,7 @@ pt_symbol_iter(mdb_tgt_t *t, const char *object, uint_t which,
which, type, pt_symbol_iter_cb, &ps);
return (0);
} else if (Prd_agent(t->t_pshandle) != NULL) {
- if ((mdb.m_flags & MDB_FL_LMRAW) == 0) {
+ if (PT_LIBPROC_RESOLVE(t->t_pshandle)) {
(void) Pobject_iter_resolved(t->t_pshandle,
pt_objsym_iter, &ps);
} else {
@@ -2994,7 +3001,7 @@ pt_prmap_to_mdbmap(mdb_tgt_t *t, const prmap_t *prp, mdb_map_t *mp)
char *rv, name[MAXPATHLEN];
Lmid_t lmid;
- if ((mdb.m_flags & MDB_FL_LMRAW) == 0) {
+ if (PT_LIBPROC_RESOLVE(P)) {
rv = Pobjname_resolved(P, prp->pr_vaddr, name, sizeof (name));
} else {
rv = Pobjname(P, prp->pr_vaddr, name, sizeof (name));
@@ -3060,7 +3067,7 @@ pt_mapping_iter(mdb_tgt_t *t, mdb_tgt_map_f *func, void *private)
pm.pmap_func = func;
pm.pmap_private = private;
- if ((mdb.m_flags & MDB_FL_LMRAW) == 0) {
+ if (PT_LIBPROC_RESOLVE(t->t_pshandle)) {
(void) Pmapping_iter_resolved(t->t_pshandle,
pt_map_apply, &pm);
} else {
@@ -3089,7 +3096,7 @@ pt_object_iter(mdb_tgt_t *t, mdb_tgt_map_f *func, void *private)
pm.pmap_func = func;
pm.pmap_private = private;
- if ((mdb.m_flags & MDB_FL_LMRAW) == 0) {
+ if (PT_LIBPROC_RESOLVE(t->t_pshandle)) {
(void) Pobject_iter_resolved(t->t_pshandle,
pt_map_apply, &pm);
} else {
diff --git a/usr/src/cmd/ptools/pmap/pmap_common.c b/usr/src/cmd/ptools/pmap/pmap_common.c
index 7594fd30e3..fff55ffdbc 100644
--- a/usr/src/cmd/ptools/pmap/pmap_common.c
+++ b/usr/src/cmd/ptools/pmap/pmap_common.c
@@ -23,6 +23,9 @@
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
#include <fcntl.h>
#include <libproc.h>
@@ -68,7 +71,7 @@ make_name(struct ps_prochandle *Pr, int lflag, uintptr_t addr,
char path[PATH_MAX];
int len;
- if (lflag) {
+ if (lflag || Pstate(Pr) == PS_DEAD) {
if (Pobjname(Pr, addr, buf, bufsz) != NULL)
return (buf);
} else {