On Tue, Mar 03, 2009 at 08:52:51AM +0100, max at bruningsystems.com wrote: > Hi Andrew, > > Andrew Paprocki wrote: > >>Why not use watchpoints (::wp)? > >>max > >> > > > >Watchpoints assume you know the address you want to watch. I want to > >dynamically print out any 'common' variable that any of the executing code > >reads/writes. This requires looking at the current instruction, decoding > >any memory address it is reading/writing, and looking up the symbol at > >that address to determine if it is a 'common' linkage symbol. > > > >I guess I'm wondering if mdb_readsym() or mdb_readvar() can be used to > >read registers, or if mdb is lacking this functionality and needs a > >mdb_readreg() function added to its API to programmatically get the ::regs > >values. > > > I see. You want to trace data (analogous to the way dtrace can trace > code), with mdb? > The registers exist as variables in mdb. You could use: > > mdb_snprintf(buffer, sizeof(buffer), "<%s=K", register_name); > mdb_eval(buffer);
No; you don't want =K, since that will print it to standard output. Just do "<%s", then mdb_eval(), then mdb_get_dot() Cheers, - jonathan