Hi,all, When I was doing an execise, I met a problem about mdb. In that case, I want to print the content of all mblks in a queue, but I haven't found an available mdb dcmd to do it. Instead, I wrote a simple dcmd to make it work.
The details is as below: > 00000300028acff0::walk file 30009449fa8 30009449fa8 30009449fa8 30008b47960 30009449fa8 > 30009449fa8::print file_t f_vnode|::print vnode_t v_stream|::stream +-----------------------+-----------------------+ | 0x3000a173ba0 | 0x3000a173aa8 | | strwhead | strrhead | | | | | cnt = 0t0 | cnt = 0t0 | | flg = 0x00004022 | flg = 0x00044030 | +-----------------------+-----------------------+ | ^ v | +-----------------------+-----------------------+ | 0x3000a173100 | 0x3000a173008 | | ttcompat | ttcompat | | | | | cnt = 0t0 | cnt = 0t0 | | flg = 0x00000822 | flg = 0x00000832 | +-----------------------+-----------------------+ | ^ v | +-----------------------+-----------------------+ | 0x3000a1738f8 | 0x3000a173800 | | ldterm | ldterm | | | | | cnt = 0t12 | cnt = 0t0 | | flg = 0x0000082c | flg = 0x00000832 | +-----------------------+-----------------------+ | ^ v | +-----------------------+-----------------------+ | 0x3000a1733a8 | 0x3000a1732b0 | | ptem | ptem | | | | | cnt = 0t512 | cnt = 0t0 | | flg = 0x0000082c | flg = 0x00000832 | +-----------------------+-----------------------+ | ^ v | +-----------------------+-----------------------+ | 0x300079e70f8 | 0x300079e7000 | pts/1:master: 3000a172ab8 | pts | pts | process: 2216(in.telnetd) | | | | cnt = 0t0 | cnt = 0t0 | | flg = 0x00244022 | flg = 0x00204032 | +-----------------------+-----------------------+ We can see write queue 0x3000a1733a8 has some data, then I want to print the contents: > 0x3000a1733a8::print queue_t q_first |::list mblk_t b_next 30005bafbc0 30005b9b500 30005717e60 30005722ae0 30034426fc0 30005712380 ...... > 0x3000a1733a8::print queue_t q_first |::list mblk_t b_next|::mblk ADDR FL TYPE LEN BLEN RPTR DBLK 0000030005bafbc0 0 data 13 80 0000030005bb0a70 0000030005bb0a00 0000030005b9b500 0 data 3 80 0000030005bad170 0000030005bad100 0000030005717e60 0 data 13 80 0000030034422e70 0000030034422e00 0000030005722ae0 0 data 3 80 0000030005bab570 0000030005bab500 0000030034426fc0 0 data 13 80 0000030007f45770 0000030007f45700 0000030005712380 0 data 3 80 0000030005bb0c70 0000030005bb0c00 ...... > 0x3000a1733a8::print queue_t q_first |::list mblk_t b_next|::print mblk_t b_rptr|::dump But ::dump will only give the data content of the first mblk,it cannot give the content of all mblks. I would prefer to use "<rptr>, <wptr-rptr>/C " to display the contents, but it doesn't suit either. Instead,I wrote a simple dcmd called mblk_dump, and it works: > ::load /tmp/test/mblk_dump.so > 0x3000a1733a8::print queue_t q_first |::list mblk_t b_next|::mblk_dump hello there . hello there . hello there . hello there . hello there . hello there . ...... Simple as it is, I am wondering why dump only work with the first element instead of accepting a list of addresses. It is tedious and error-prone to display the content of each mblk when there is hundreds of them, it is much desirable to print the content of all mblks (in a queue) with a single dcmd in this case. So isn't it better to have a dcmd that can accept a list of addresses and "dump" their contents? Is there any reason for ::dump 's current behaviour? Thanks, Zhijun