[prev in list] [next in list] [prev in thread] [next in thread] 

List:       opensolaris-mdb-discuss
Subject:    Re: [mdb-discuss] mdb module access to current instruction?
From:       Jonathan Adams <jonathan.adams () sun ! com>
Date:       2009-03-03 22:09:16
Message-ID: 20090303220916.GK130287 () eng ! sun ! com
[Download RAW message or body]

On Tue, Mar 03, 2009 at 12:29:46PM -0800, Andrew Paprocki wrote:
> Yeah, I'll just have to live with the stderr output for now. I think
> the approach of mdb_eval()/mdb_get_dot() might be pretty slow compared
> with being able to mdb_readvar() directly. 
Yeah, but compared to stopping and starting the application, I doubt it's
noticeable.

> It doesn't seem like
> mdb_readvar(&pc, "pc") works, though. Is the eval/get_dot the only
> way?

mdb_readvar is reading a value from the address space; it's an entirely
different place than the variables which hold the registers.

The only way you can directly access the variables would be by copying the
header files from usr/src/cmd/mdb/common/mdb, including "mdb.h" and "mdb_nv.h",
then do:

	mdb_var_t *var = mdb_nv_lookup(&mdb.m_nv, "pc");
	uintmax_t val = mdb_nv_get_value(var);

Note that by doing this, you're violating the module API, tying yourself to a
particular version of the debugger binary, etc.  If it breaks, you get to keep
both pieces. =]

Cheers,
- jonathan


> 
> I just want to try to minimize the amount of instructions being executed for each \
>                 instruction in the app. This tracing slows it down quite heavily.
> -- 
> This message posted from opensolaris.org
> _______________________________________________
> mdb-discuss mailing list
> mdb-discuss@opensolaris.org
_______________________________________________
mdb-discuss mailing list
mdb-discuss@opensolaris.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic