Feature #13576
closedAdd mdb ::linkerset command
100%
Description
With the addition of linker sets in #10851 (and their use in bhyve and likely other parts of the system), it would be useful to have an MDB dcmd to make examining them more ergonomic.
Currently, iterating the items in a linker set requires something similar to (from Joshua M. Clulow):
> __start_set_sysinit_set::array "struct sysinit" 0t19 | ::eval "*.::print struct sysinit" { func = vmm_stat_register data = VCPU_TOTAL_RUNTIME } { func = vmm_stat_register data = VCPU_NMI_COUNT } ...
It would be far nicer for a dcmd that worked along the lines of:
> ::linkerset NAME ITEMSIZE ITEMCOUNT sysinit_set 0x10 20 > ::linkerset sysinit_set 0xffffffffc018d0c0 0xffffffffc018d140 0xffffffffc018d1c0 0xffffffffc018fcc0 0xffffffffc018fd40 ... > ::linkerset sysinit_set | ::print struct sysinit { func = vmm_stat_register data = VCPU_TOTAL_RUNTIME } { func = vmm_stat_register data = VCPU_NMI_COUNT } ...
Files
Related issues
Updated by Jason King about 1 year ago
- Related to Bug #13615: mdb has issues resolving some symbols in shared libraries added
Updated by Jason King about 1 year ago
To test this, built a BE that included this change as well as the changes under review for #13615 as that has a linker set in the kernel that will be present in a VM. Booted the VM with kmdb, continued it, the broke into kmdb and verified that ::linkerset
saw the tsc_calibration_set
. I also used ::linkerset tsc_calibration_set | ::print tsc_calibrate_t
to verify the results looked sane.
I repeated the test with 'mdb -k' and repeated the same.
Then used the small test program with mdb to make sure it could resolve linker sets in user land objects. While it succeed for the linkerset in the main object (::linkerset
saw the set, and iterating with ::linkerset bar
succeeded), it failed to identify the linkerset in the shared object. Further debugging suggests it's an existing problem with either mdb or libproc. #13615 was filed for this issue.
I also ran mdb again the bhyve binary and again ran the ::linkerset dcmd as well as look at various linker sets piping the result to @::print <type> based on the specific linkerset. All of the resulting values looked as expected.
Updated by Electric Monk about 1 year ago
- Status changed from New to Closed
- % Done changed from 0 to 100
git commit 089ef9c1879ed031043f7bb75bd1f472558dcbbf
commit 089ef9c1879ed031043f7bb75bd1f472558dcbbf Author: Jason King <jason.king@joyent.com> Date: 2021-03-10T07:27:46.000Z 13576 Add mdb ::linkerset command Reviewed by: Richard Lowe <richlowe@richlowe.net> Reviewed by: Toomas Soome <tsoome@me.com> Approved by: Dan McDonald <danmcd@joyent.com>