mdb buffers pipelines too much
In "mdb -k", I had a pointer to a list of 48M taskq entries. When I do this:
> PTR::list taskq_ent_t tqent_next
even though the list is extremely long, mdb starts printing them out immediately. With the built-in pager, you get a prompt allowing you to abort the listing early, which you'd typically do, since it would take so long to list the whole thing. This is good.
However, if I pipe that to another dcmd, like this:
PTR::list taskq_ent_t tqent_next | ::print taskq_ent_t tqent_func
Now I get no output for many minutes, and mdb can't even be stopped with CTRL-C. Profiling mdb, it's spending most of its time here:
libc.so.1`strcmp+0x1a mdb`mdb_gelf_symtab_lookup_by_name+0x3f mdb`kt_lookup_by_name+0xb2 mdb`mdb_tgt_lookup_by_name+0x112 mdb`yylex+0x756 mdb`yyparse+0x3ad mdb`mdb_run+0x2cd mdb`runsvc+0x11 mdb`context_init+0x1e libc.so.1`resumecontext mdb`0x42c3a2 mdb`pio_write+0x12a mdb`iob_write+0x63 mdb`mdb_iob_flush+0x57 mdb`mdb_iob_nl+0x37 mdb`mdb_iob_nputs+0x4c mdb`iob_doprnt+0xace mdb`mdb_iob_vprintf+0x43 mdb`mdb_printf+0xae mdb`cmd_list+0x13e 155
Stopping it with another instance of mdb, we found that the symbol being looked up was a pointer address -- that's "::print" parsing the output of "::list". In about 10 seconds, mdb_tgt_lookup_by_name() was invoked 424,317 times.
It would be nice if in this mode, mdb did what it does without the pipeline, which is to start outputting right away and give you the opportunity to abort the pipeline.
No data to display