Actions
Bug #3473
closedmdb_get_module() returns wrong module
Start date:
2013-01-15
Due date:
% Done:
100%
Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:
External Bug:
Description
From Matt Ahrens's bug report at Delphix:
mdb_module() returns the wrong module when called from the callback of mdb_pwalk() -- it returns the module that the walker is in, rather than the module the callback is in. This causes mdb_ctf_vread() to fail because it looks up the wrong module's CTF info. Steps to reproduce: add these lines to a module (e.g. zfs.c): struct modtest { int i; }; /* ARGSUSED */ static int modtest_cb(uintptr_t addr, const void *ignored, void *arg) { mdb_ctf_id_t id; mdb_printf("from callback: %d\\n", mdb_ctf_module_lookup("struct modtest", &id)); return (WALK_DONE); } /* ARGSUSED */ static int modtest(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) { mdb_ctf_id_t id; mdb_printf("from dcmd: %d\\n", mdb_ctf_module_lookup("struct modtest", &id)); mdb_pwalk("list", modtest_cb, NULL, addr); return (DCMD_OK); } register the dcmd: { "modtest", ":", "test mdb_module()", modtest}, add this line to mapfile-extern: mdb_ctf_module_lookup { FLAGS = EXTERN }; Run by providing a list_t*, like so: > ARC_mru::modtest from dcmd: 0 from callback: -1 Results should be 0 from both dcmd and callback.
Related issues
Updated by Christopher Siden about 10 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
commit 28e4da2 Author: Matthew Ahrens <mahrens@delphix.com> Date: Wed Jan 30 15:02:58 2013 3465 ::walk ... | ::<dcmd> misinterprets input as symbol names 3466 ::tsd should handle missing/NULL values better 3467 mdb_ctf_vread() could be more useful 3468 mdb enhancements for zfs development 3470 ::whatis does not print callers from KMF_LITE 3473 mdb_get_module() returns wrong module Reviewed by: Adam Leventhal <ahl@delphix.com> Reviewed by: Eric Schrock <eric.schrock@delphix.com> Reviewed by: Dan Kimmel <dan.kimmel@delphix.com> Reviewed by: Robert Mustacchi <rm@joyent.com> Approved by: Dan McDonald <danmcd@nexenta.com>
Updated by Gordon Ross over 7 years ago
- Related to Bug #5998: mdb_ctf_vread fails in dcmds run via mdb_pwalk_dcmd added
Actions