Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 181600

Summary: Inside the Memory View: A Guide for Debug Providers
Product: Community Reporter: Samantha Chan <chanskw>
Component: ArticlesAssignee: Wayne Beaton <wayne.beaton>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: avdievkaren, community.articles-inbox, normankyee, rayfix, sumeet.jauhar
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Article none

Description Samantha Chan CLA 2007-04-09 10:41:35 EDT
This article describes the memory view framework from the Eclipse Debug Platform.
It also describes how debug providers can add memory monitoring support in their debuggers.
Comment 1 Samantha Chan CLA 2007-04-09 10:53:19 EDT
Created attachment 63262 [details]
Article
Comment 2 Wayne Beaton CLA 2007-05-01 16:54:52 EDT
Do you know anybody who can peer review the article's content?
Comment 3 Samantha Chan CLA 2007-05-01 17:04:13 EDT
Please ask Darin Wright from Debug to review this article.  
Comment 4 Samantha Chan CLA 2007-06-07 17:45:10 EDT
Hi,
Just wondering if there is anything I need to do to move this forward?  Thanks...
Samantha
Comment 5 Wayne Beaton CLA 2007-07-16 16:06:36 EDT
I've posted a draft on the server:

http://www.eclipse.org/articles/article.php?file=Article-MemoryView/index.html

I've done an initial pass and will do a more thorough one tomorrow.

In the meantime, you use the non-word "interfactions" about half-way through the text. What do you mean?
Comment 6 Samantha Chan CLA 2007-07-16 16:11:08 EDT
Hi... 

Thanks for reviewing.  "interfactions" is actually a typo.  It should have spelt "interactions".

Thanks...
Samantha
Comment 7 Wayne Beaton CLA 2007-07-16 16:23:07 EDT
That's what I thought, but I wanted to be sure.
Comment 8 Samantha Chan CLA 2007-08-14 10:48:23 EDT
Hi Wayne, 
Were you waiting for me to modify the article?
Just wondering if there is a target date when this could be published?
Thanks...
Samantha
Comment 9 Wayne Beaton CLA 2007-09-07 14:14:24 EDT
I've published the article:

http://www.eclipse.org/articles/article.php?file=Article-MemoryView/index.html

Samantha, can you send me your coordinates (mailing address, phone number) and shirt size so that I can send you some swag in appreciation for your efforts (and patience)? Send the info to wayne@eclipse.org.
Comment 10 Norman Yee CLA 2008-07-03 15:01:08 EDT
Hi, I tried running the sample debug engine with Eclipse 3.3 and Eclipse 3.4 and it doesn't work.  When I tried debugging the "Debug Nothing" launch configuration, nothing happened; I didn't see the Memory View open automatically as described in the article.  Are there any plans to update the sample plugin to make it work with Eclipse 3.4?
Comment 11 Samantha Chan CLA 2008-07-04 17:20:13 EDT
Can you please open a bug and describe the errors that you are receiving?
I have been running the same sample during my testing and haven't come across with any error.

If you switch to the Debug Perspective, and open the Debug View, do you see a debug session?  Selecting a stackframe should open the memory view.
Comment 12 Norman Yee CLA 2008-07-07 11:24:10 EDT
Sorry, my mistake.  I got it working now.

Comment 13 Ray Fix CLA 2009-11-10 19:06:36 EST
Excellent article.  I ran into some troubles because the Traditional renderer is  broken when addressableSize > 1.  (There are some bugs filed against it.)  With the random addresses that this sample produces it is not immediately apparent, but if you look close you can see the problem.

One of the problems for me is that there is a "Memory Browser" which is apparently a legacy viewer as well as "Traditional" renderer choice which doesn't have an id that lets get rid of it (that I could find).  The exercise has you get rid of some of the renders which worked fine.  But what I would really like to know is how to get rid of the traditional renderer since it is broken for my situation.
Comment 14 Samantha Chan CLA 2009-11-11 09:50:28 EST
(In reply to comment #13)
> Excellent article.  I ran into some troubles because the Traditional renderer
> is  broken when addressableSize > 1.  (There are some bugs filed against it.) 
> With the random addresses that this sample produces it is not immediately
> apparent, but if you look close you can see the problem.

Thanks a lot for the feedback!  :)

> 
> One of the problems for me is that there is a "Memory Browser" which is
> apparently a legacy viewer as well as "Traditional" renderer choice which
> doesn't have an id that lets get rid of it (that I could find).  The exercise
> has you get rid of some of the renders which worked fine.  But what I would
> really like to know is how to get rid of the traditional renderer since it is
> broken for my situation.


The memory browser and the traditional rendering is provided by CDT.  I am not aware of a way to get rid of it.  Can you please open a defect in CDT debug, and describe what your requirements are.  Please cc me on that defect since I do not watch CDT defects.  I will work with the CDT team to see if there is anything we can do to make it easier.
Comment 15 Ray Fix CLA 2009-11-11 22:13:00 EST
(In reply to comment #14)
 Can you please open a defect in CDT debug,
> and describe what your requirements are.  Please cc me on that defect since I
> do not watch CDT defects.  I will work with the CDT team to see if there is
> anything we can do to make it easier.

Thanks!  Filed here https://bugs.eclipse.org/bugs/show_bug.cgi?id=294931
Comment 16 Ray Fix CLA 2009-11-13 15:38:38 EST
Hi again!  Does anyone have any pointers on how to customize the expression window that pops up when you add a new monitor.  I am providing a memory viewer for a target that has multiple pages and I would like to be able to somehow communicate that to the user.

In this article, for example, there is a range of memory (0xAB123456 to 0xAB123556) that is read only and renders a special cool way.  Is there anyway of putting information into the expression dialog (it seems to have a pulldown selection) or overriding entirely with something else that would show, for example, a memory map of the system, etc?

Maybe this functionality doesn't exist but I thought I would put it out there just in case I am missing something easy.
Comment 17 Karen Avdiev CLA 2013-01-22 06:07:38 EST
hello, 

I've tried to implement simple viewer.

in my case, i have in a project Debugtarget, DebugElement and all implementation of debugger.. 

so  in my MyDebugTarget i have
----------------------------------------------------------------------------
	public IMemoryBlock getMemoryBlock(long startAddress, long length)
			throws DebugException {
		// TODO Auto-generated method stub
		return new MyMemoryBlock (startAddress, length);
	}
-----------------------------------------------------------------------------

and my MeMeryBlock =>
-----------------------------------------------------------------------------
public class MyMemoryBlock extends MyDebugElement implements IMemoryBlock {
		long address, size;
		IDebugTarget DebTarget;
		byte [] content;

		public MyMemoryBlock ( MyDebugTarget debTarget, long x, long y) {
			super(debTarget);
			address=x;
			size=y;
			DebTarget=debTarget;
			content = new  byte [(int)getLength()];
			
			for (int i=0; i<content.length; i++) {
				content [i]=(byte) i;
			}	
		}
----------------------------------------------------------------------------

so my getByte is
----------------------------------------------------------------------------
		public byte[] getBytes() throws DebugException {
			// TODO Auto-generated method stub
			return content;
		} 
----------------------------------------------------------------------------

when i lunch debugger ad my momory viewer  [+] => adress 10  size 10 

i have an empty viewer ... why ...???
Comment 18 Sumeet J CLA 2013-07-09 05:45:29 EDT
Thanks for this wonderful article . I am however stuck trying to run it correctly . As mentioned in the article i try to provide an expression of the form 

sampleVariable = 10 . 

However the memory view that comes up doesnt contain `10` at the address of the sampleVariable . I even tried strings of the form 

str="Hello"

Again it doesnt contain the string ``hello` at the address of the variable str . 


I hope that i am providing the input correctly ( ? ) . 

Also is the raw memory that i see system specific ? I mean i am running Eclipse 4.3 on a 64 bit Windows 7 . So can the way to see the raw memory differ across systems ? ( I am really not sure about this ) 

But the thing is that i see incorrect values in the addresses i give instead of seeing the values i provide to these variables .