summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McDonald <danmcd@joyent.com>2020-11-12 10:51:27 -0500
committerDan McDonald <danmcd@joyent.com>2020-11-12 10:51:27 -0500
commit45f7bf1d4508f8d85c7add1bdeb9f7ea099f0ab2 (patch)
tree237d6228a05e2c866918270566ee49b24b575034
parent5fe111b04547f0b81248667a622788edbb0836b0 (diff)
parent814f981e5647bb2970ff701c91b962eb330903dd (diff)
downloadillumos-joyent-45f7bf1d4508f8d85c7add1bdeb9f7ea099f0ab2.tar.gz
[illumos-gate merge]
commit 814f981e5647bb2970ff701c91b962eb330903dd 13283 mdb-bhyve should lookup against private symbols
-rw-r--r--usr/src/cmd/mdb/intel/mdb/mdb_bhyve.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/usr/src/cmd/mdb/intel/mdb/mdb_bhyve.c b/usr/src/cmd/mdb/intel/mdb/mdb_bhyve.c
index 9477bf5056..9f7a1feeba 100644
--- a/usr/src/cmd/mdb/intel/mdb/mdb_bhyve.c
+++ b/usr/src/cmd/mdb/intel/mdb/mdb_bhyve.c
@@ -11,6 +11,7 @@
/*
* Copyright 2019 Joyent, Inc.
+ * Copyright 2020 Oxide Computer Company
*/
/*
@@ -1210,6 +1211,43 @@ bhyve_vtop(mdb_tgt_t *tgt, mdb_tgt_as_t as, uintptr_t va, physaddr_t *pa)
}
/*
+ * t_lookup_by_addr: find symbol information for a given name
+ */
+static int
+bhyve_lookup_by_name(mdb_tgt_t *t, const char *object, const char *name,
+ GElf_Sym *symp, mdb_syminfo_t *sip)
+{
+ int err;
+
+ /*
+ * Search only the private symbols, as nothing else will be populated.
+ */
+ err = mdb_gelf_symtab_lookup_by_name(mdb.m_prsym, name, symp,
+ &sip->sym_id);
+ sip->sym_table = MDB_TGT_PRVSYM;
+ return (err);
+}
+
+/*
+ * t_lookup_by_addr: find symbol information for a given address
+ */
+static int
+bhyve_lookup_by_addr(mdb_tgt_t *tgt, uintptr_t addr, uint_t flags, char *buf,
+ size_t nbytes, GElf_Sym *symp, mdb_syminfo_t *sip)
+{
+ int err;
+
+ /*
+ * Only the private symbols (created with ::nmadd) will be populated, so
+ * search against those.
+ */
+ err = mdb_gelf_symtab_lookup_by_addr(mdb.m_prsym, addr, flags, buf,
+ nbytes, symp, &sip->sym_id);
+ sip->sym_table = MDB_TGT_PRVSYM;
+ return (err);
+}
+
+/*
* t_status: get target status
*/
static int
@@ -1391,8 +1429,8 @@ static const mdb_tgt_ops_t bhyve_ops = {
.t_ioread = bhyve_ioread,
.t_iowrite = bhyve_iowrite,
.t_vtop = bhyve_vtop,
- .t_lookup_by_name = (int (*)()) mdb_tgt_notsup,
- .t_lookup_by_addr = (int (*)()) mdb_tgt_notsup,
+ .t_lookup_by_name = bhyve_lookup_by_name,
+ .t_lookup_by_addr = bhyve_lookup_by_addr,
.t_symbol_iter = (int (*)()) mdb_tgt_notsup,
.t_mapping_iter = (int (*)()) mdb_tgt_notsup,
.t_object_iter = (int (*)()) mdb_tgt_notsup,