On Thu, Jan 12, 2006 at 12:44:40AM -0800, tanu wrote: > Isn't this is a bug. Means a breakpoint is being set in data. I think > it should give an error instead of setting a breakpoint and then > panicking.
I suppose mdb could produce an error or a warning when you accidentally put a breakpoint in data rather than text (although in some cases it may not be easy to determine which is which), but there are other related problems which we could never catch: what would prevent you from placing a breakpoint on the data for a jump table which lives in the text segment or in the middle of a muli-byte instruction on x86/x64? > Moreover, shouldn't mdb should give an error when setting the > breakpoint without an address. When doing simple mdb, it givens an > error, then why doesn't mdb -K. mdb on a process does the same thing as kmdb: $ /usr/bin/mdb -p $$ Loading modules: [ ld.so.1 libc.so.1 ] > 5=K 5 > :b > ::events ID S TA HT LM Description Action ----- - -- -- -- ---------------------------------------- ----------------------[ 1 ] + T 0 0 stop on SIGINT - ... [ 12] + T 0 0 stop on SIGXFSZ - [ 13] - 0 0 stop at 5 - > Our concern is that the breakpoint is set, even though we did not > specify that address. The documentation does not say that the address > is optional. And if this is an expected behaviour then can you please > direct me to the proper documentation explaining that. >From the Solaris Modular Debugger Guide, Chapter 3 (dcmd Pipelines): MDB executes each dcmd in the pipeline in order from left to right. The left-most dcmd is executed using the current value of dot, or using the value specified by an explicit expression at the start of the command. When a | operator is encountered, MDB creates a pipe (a shared buffer) between the output of the dcmd to its left and the MDB parser, and an empty list of values. This behavior is for adb compatibility. You'll note that the behavior of ::bp differs from the legacy of :b in that the former requires an explicit address: $ /usr/bin/mdb -p $$ Loading modules: [ ld.so.1 libc.so.1 ] > 5=K 5 > ::bp Usage: [address]::bp [+/-dDestT] [-c cmd] [-n count] sym ... mdb: try '::help bp' for more information ::bp can be used both from mdb and kmdb. Adam -- Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl