Bug 354857 - MemoryRenderingElements created by MemorySegmentLabelAdapter can have improper cell addresses
Summary: MemoryRenderingElements created by MemorySegmentLabelAdapter can have imprope...
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Platform-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2011-08-16 12:19 EDT by Carlos CLA
Modified: 2021-11-06 07:07 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos CLA 2011-08-16 12:19:42 EDT
Build Identifier: 20110218-0911

MemoryRenderingElements created by the MemorySegmentLabelAdapter class will somtimes be giving incorrect cell address values. The issue occurs when the addressable size of memory is greater than one byte, and when the table in a memory view contains more than one column. 

The exact problem can be traced to the following method:

	private MemoryRenderingElement getMemoryRenderingElement(MemorySegment line, BigInteger lineAddress, int offset, AbstractBaseTableRendering rendering) {
		BigInteger cellAddress = lineAddress.add(BigInteger.valueOf(offset));
		MemoryByte[] bytes = line.getBytes(offset, rendering.getBytesPerColumn());
		// make a copy to ensure that the memory bytes are not overwritten
		// by clients
		MemoryByte[] copy = new MemoryByte[bytes.length];
		System.arraycopy(bytes, 0, copy, 0, bytes.length);
		MemoryRenderingElement renderingElement = new MemoryRenderingElement(
				rendering, cellAddress, copy);
		return renderingElement;
	}

the problem actually occurs in the first line of the method:

BigInteger cellAddress = lineAddress.add(BigInteger.valueOf(offset));

To fix this issue, the offset needs to be divided by the addressable size:

BigInteger cellAddress = lineAddress.add(BigInteger.valueOf(offset/redering.getAddressableSize()));



Reproducible: Always

Steps to Reproduce:
1.Create a memory block that has an addressable size of greater than one byte

2.open a memory view and format the view to have multiple columns per row

3.add a color adaptor to the memory block and check the address values of MemoryRenderingElements that are passed to either getForeground() or getBackground().
Comment 1 Eclipse Genie CLA 2019-08-23 12:21:43 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 2 Sarika Sinha CLA 2019-08-25 23:30:54 EDT
Anyone interested in working on this?
Comment 3 Eclipse Genie CLA 2021-08-15 11:31:53 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 4 Andrey Loskutov CLA 2021-08-15 11:34:23 EDT

*** This bug has been marked as a duplicate of bug 575413 ***
Comment 5 John Dallaway CLA 2021-11-06 07:07:41 EDT
Reopening. This issue was not addressed by the fix for bug 575413.