Project

General

Profile

Actions

Feature #13576

closed

Add mdb ::linkerset command

Added by Jason King 8 months ago. Updated 8 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
mdb - modular debugger
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

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

test.tar (4.5 KB) test.tar Jason King, 2021-03-10 03:16 AM

Related issues

Related to illumos gate - Bug #13615: mdb has issues resolving some symbols in shared librariesNew

Actions
Actions #1

Updated by Electric Monk 8 months ago

  • Gerrit CR set to 1283
Actions #2

Updated by Jason King 8 months ago

  • Related to Bug #13615: mdb has issues resolving some symbols in shared libraries added
Actions #3

Updated by Jason King 8 months 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.

Actions #4

Updated by Electric Monk 8 months 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>

Actions

Also available in: Atom PDF