Page MenuHomeFreeBSD

Add macros to print dev tree / info
AbandonedPublic

Authored by imp on Oct 2 2020, 4:23 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 27 2023, 4:27 PM
Unknown Object (File)
Nov 25 2023, 7:56 AM
Unknown Object (File)
Oct 24 2023, 6:57 AM
Unknown Object (File)
Sep 23 2023, 10:13 PM
Unknown Object (File)
May 14 2023, 11:17 PM
Subscribers

Details

Reviewers
jhb
rrs
Summary

Add a number of macros to print device tree stuff.

devprint - print device name, state, softc and ivar
lsdev - List all devices in the system
finddev - Find a specific device by name
alldev - List all devices in a devclass
devinfo - produce a devinfo(1) like listing of the dev tree

These macros I think came from jhb's dot.gdbinit.kernel file, but
the only copies I can find don't have it. I reworked the macros a bit
to implement finddev and alldev and refactored devprint out of lsdev
for use in those two macros.

Sponsored by: Netflix

Test Plan

Added rrs@ since he committed this to Netflix's root/.gdbinit

There's likely others we can add...

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 33943
Build 31140: arc lint + arc unit

Event Timeline

imp requested review of this revision.Oct 2 2020, 4:23 AM
imp added reviewers: jhb, rrs.

FYI, the versions I have are at https://github.com/bsdjhb/kdbg/blob/master/gdb/gdb6#L1783 They include a generic 'devwalk' command that invokes a callback on each device_t in a depth-first traversal that I use for some other places besides devinfo.

In D26638#593511, @jhb wrote:

FYI, the versions I have are at https://github.com/bsdjhb/kdbg/blob/master/gdb/gdb6#L1783 They include a generic 'devwalk' command that invokes a callback on each device_t in a depth-first traversal that I use for some other places besides devinfo.

I'll update. There's quite a few other things there as well... Do you mind if I bring larger bits of them in?

It's fine to pull stuff in from my scripts. Even better would be to rewrite them in python and merge with @markj's scripts for vnet variables.

In D26638#594474, @jhb wrote:

It's fine to pull stuff in from my scripts. Even better would be to rewrite them in python and merge with @markj's scripts for vnet variables.

Yeah, I need to "productize" my python scripts. It's been on my todo list for a long time...

There are some example scripts here. I use the acttrace one pretty regularly: https://github.com/markjdb/scripts/tree/master/kgdb

Maybe a good way to start building a library is to convert the routines in gdbinit.kernel and the routines in your kgdb macros.