Hi, all Is there a way to drop into mdb( or kmdb), by a dtrace script, when some conditions are met? Perhaps it is useful to debug some issues that occurrs once in one thousand times. Any ideas? thanks, zhijun -------------- next part -------------- A non-text attachment was scrubbed... Name: Zhijun.Fu.vcf Type: text/x-vcard Size: 45 bytes Desc: not available URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20061023/58efaf41/attachment.vcf>
The breakpoint() action should drop you into kmdb which will impact the entire system, while the stop() action will stop a process, then you could attach mdb to it, etc. These are documented in the dtrace manuals (Solaris Dynamic Tracing Guide and DTrace User Guide) on docs.sun.com Cheers, Greg Robin Fu wrote:>Hi, all >Is there a way to drop into mdb( or kmdb), by a dtrace script, when some >conditions are met? Perhaps it is useful to debug some issues that >occurrs once in one thousand times. Any ideas? > >thanks, >zhijun > > > >_______________________________________________ >dtrace-discuss mailing list >dtrace-discuss at opensolaris.org >
Thanks, Greg. But when I tried the example in that book, I found it didn''t stop on the right instruction, instead it stopped within kmdb. Any reason for this? bash-3.00# mdb -K Welcome to kmdb Loaded modules: [ scsi_vhci crypto cpc uppc ptm ufs unix zfs krtld s1394 sppp uhci lofs genunix ip logindmux usba specfs pcplusmp md random sctp arp cpu.AuthenticAMD.15 ] [1]> :c bash-3.00# mdb -K kmdb: target stopped at: kmdbmod`kaif_enter+8: popfq [1]> :c bash-3.00# dtrace -w -n clock:entry''{breakpoint()}'' dtrace: description ''clock:entrydtr'' matched a1 probec e: breakpoint action at probe fbt:genunix:clock:entry (ecb ffffffff94345b48) kmdb: target stopped at: kmdbmod`kaif_enter+8: popfq [0]> $C [0]> :c ...... regards, zhijun Greg Price wrote:> The breakpoint() action should drop you into kmdb which will impact the > entire system, while the stop() action will stop a process, then you > could attach mdb to it, etc. > > These are documented in the dtrace manuals (Solaris Dynamic Tracing > Guide and DTrace User Guide) on docs.sun.com > > Cheers, > Greg > > > Robin Fu wrote: > > >> Hi, all >> Is there a way to drop into mdb( or kmdb), by a dtrace script, when some >> conditions are met? Perhaps it is useful to debug some issues that >> occurrs once in one thousand times. Any ideas? >> >> thanks, >> zhijun >> >> >> >> _______________________________________________ >> dtrace-discuss mailing list >> dtrace-discuss at opensolaris.org >> >>-------------- next part -------------- A non-text attachment was scrubbed... Name: Zhijun.Fu.vcf Type: text/x-vcard Size: 45 bytes Desc: not available URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20061023/1bec4a8b/attachment.vcf>
On Mon 23 Oct 2006 at 08:28AM, Robin Fu wrote:> Hi, all > Is there a way to drop into mdb( or kmdb), by a dtrace script, when some > conditions are met? Perhaps it is useful to debug some issues that > occurrs once in one thousand times. Any ideas?It sounds like you want to debug a process? Just use the stop() action. That will stop the process. Then you can attach mdb or gdb or dbx to the stopped process, usually with the -p option to the debugger. If you drop into kmdb, you''ll be debugging the kernel itself, not your process. Hope this helps, -dp -- Daniel Price - Solaris Kernel Engineering - dp at eng.sun.com - blogs.sun.com/dp
Robin Fu wrote:> Thanks, Greg. > But when I tried the example in that book, I found it didn''t stop on the > right instruction, > instead it stopped within kmdb. Any reason for this?That''s normal.> > bash-3.00# mdb -K > > Welcome to kmdb > Loaded modules: [ scsi_vhci crypto cpc uppc ptm ufs unix zfs krtld s1394 > sppp > uhci lofs genunix ip logindmux usba specfs pcplusmp md random sctp arp > cpu.AuthenticAMD.15 ] > [1]> :c > bash-3.00# mdb -K > kmdb: target stopped at: > kmdbmod`kaif_enter+8: popfq > [1]> :c > bash-3.00# dtrace -w -n clock:entry''{breakpoint()}'' > dtrace: description ''clock:entrydtr'' matched a1 probec > e: breakpoint action at probe fbt:genunix:clock:entry (ecb > ffffffff94345b48) > kmdb: target stopped at: > kmdbmod`kaif_enter+8: popfq > [0]> $CThis isn''t normal. Try singlestepping a few instructions; sometimes the stack backtrace code gets confused. but you''re definitely on the stack that contains your probe condition at this point.> [0]> :c