Hi, I''m a newbie to dtrace I met such an problem that one byte in a memry block is changed by unknown operation. My question is can I monitor the memory access operation and determin which function do that? My source code like this: The memory block is member struct of a class - class A { public: struct MEM_BLOCK { int a; int b; char c; }; MEM_BLOCK memBLK; void func(int p) { b = p; } }; In my application, struct member "int b" should be accessed by "func" only. But I found it always changed by unknown operation without invoke "func" or direct member parameter visit. Coz the total amount of the application is too big to me for detail code review. I wanna to get help from DTRACE. Could u tell me whether DTARCE can monitor such kind of memory access and report which one access it? Thanx This message posted from opensolaris.org
Sounds like a much better job for mdb''s "write breakpoint" command. On x86 (you don''t say it is, but if so) mdb uses the builtin hardware debug registers of the x86 chip. f7a7 wrote:> Hi, I''m a newbie to dtrace > > I met such an problem that one byte in a memry block is changed by unknown operation. My question is can I monitor the memory access operation and determin which function do that? > > My source code like this: > The memory block is member struct of a class - > class A > { > public: > struct MEM_BLOCK > { > int a; > int b; > char c; > }; > MEM_BLOCK memBLK; > > void func(int p) > { > b = p; > } > }; > > In my application, struct member "int b" should be accessed by "func" only. But I found it always changed by unknown operation without invoke "func" or direct member parameter visit. > Coz the total amount of the application is too big to me for detail code review. > I wanna to get help from DTRACE. > > Could u tell me whether DTARCE can monitor such kind of memory access and report which one access it? > > Thanx > > > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org
Adam Leventhal
2007-Jan-25 05:23 UTC
[dtrace-discuss] How to monitor memory access with DTRACE?
As Dan mentioned, you might be able to solve the problem with a conventional debugger (mdb or dbx) that supports watchpoints. We''ve discussed implementing a watchpoint provider for DTrace, but haven''t seen enough justification -- if we get enough requests though... Adam On Wed, Jan 24, 2007 at 05:28:55AM -0800, f7a7 wrote:> Hi, I''m a newbie to dtrace > > I met such an problem that one byte in a memry block is changed by unknown operation. My question is can I monitor the memory access operation and determin which function do that? > > My source code like this: > The memory block is member struct of a class - > class A > { > public: > struct MEM_BLOCK > { > int a; > int b; > char c; > }; > MEM_BLOCK memBLK; > > void func(int p) > { > b = p; > } > }; > > In my application, struct member "int b" should be accessed by "func" only. But I found it always changed by unknown operation without invoke "func" or direct member parameter visit. > Coz the total amount of the application is too big to me for detail code review. > I wanna to get help from DTRACE. > > Could u tell me whether DTARCE can monitor such kind of memory access and report which one access it? > > Thanx > > > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org-- Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl
Dan Mick wrote:> Sounds like a much better job for mdb''s "write breakpoint" command. On > x86 (you don''t say it is, but if so) mdb uses the builtin hardware debug > registers of the x86 chip.Adam Leventhal points out privately that I''m thinking of kmdb (for kernel debugging). With processes, mdb watchpoints are implemented through libproc (and page protections). I guess you can tell where I spend most of my mdb time. :) Thanks for the clarification, Adam.
Thanx a lot for you kindly reply But I am also a new bie to mdb/kmdb Could u tell me how to set watchpoint to monitor memory access? Thanx! This message posted from opensolaris.org
Michael Shapiro
2007-Jan-26 06:20 UTC
[dtrace-discuss] Re: How to monitor memory access with DTRACE?
> Thanx a lot for you kindly reply > But I am also a new bie to mdb/kmdb > Could u tell me how to set watchpoint to monitor memory access?>From mdb or kmdb, use the ::wp command. The mdb(1) man pagehas a complete description of its syntax. If you need more help, email mdb-discuss at opensolaris.org -Mike -- Mike Shapiro, Solaris Kernel Development. blogs.sun.com/mws/