diff options
author | Patrick Mooney <pmooney@pfmooney.com> | 2020-11-06 05:06:28 +0000 |
---|---|---|
committer | Patrick Mooney <pmooney@oxide.computer> | 2020-11-11 21:11:32 +0000 |
commit | 814f981e5647bb2970ff701c91b962eb330903dd (patch) | |
tree | ae5c72dd30fafdcde2ad0b85ecdfb30eadd49b32 /usr/src | |
parent | 3d18edb258701d7742038769889039e5f6147839 (diff) | |
download | illumos-joyent-814f981e5647bb2970ff701c91b962eb330903dd.tar.gz |
13283 mdb-bhyve should lookup against private symbols
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/mdb/intel/mdb/mdb_bhyve.c | 42 |
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, |