mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
[219009] TraditionalRendering.getSelectedBytes() ignores selection
This commit is contained in:
parent
5d2e5b52e0
commit
8f63cc5bbf
3 changed files with 37 additions and 5 deletions
|
@ -12,6 +12,8 @@ public interface IMemorySelection
|
||||||
|
|
||||||
public BigInteger getEnd();
|
public BigInteger getEnd();
|
||||||
|
|
||||||
|
public BigInteger getStartLow();
|
||||||
|
|
||||||
public void setStart(BigInteger high, BigInteger low);
|
public void setStart(BigInteger high, BigInteger low);
|
||||||
|
|
||||||
public void setEnd(BigInteger high, BigInteger low);
|
public void setEnd(BigInteger high, BigInteger low);
|
||||||
|
|
|
@ -1237,6 +1237,10 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
return fStartLow;
|
return fStartLow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BigInteger getStartLow() {
|
||||||
|
return fStartLow;
|
||||||
|
}
|
||||||
|
|
||||||
public BigInteger getEnd()
|
public BigInteger getEnd()
|
||||||
{
|
{
|
||||||
// if there is no end, return null
|
// if there is no end, return null
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.core.commands.ExecutionException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.dd.debug.memory.renderings.traditional.Rendering.Selection;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
|
@ -982,20 +983,45 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
|
||||||
|
|
||||||
// selection is terminology for caret position
|
// selection is terminology for caret position
|
||||||
public BigInteger getSelectedAddress() {
|
public BigInteger getSelectedAddress() {
|
||||||
return fRendering.getCaretAddress();
|
IMemorySelection selection = fRendering.getSelection();
|
||||||
|
if (selection == null || selection.getStart() == null)
|
||||||
|
return fRendering.getCaretAddress();
|
||||||
|
|
||||||
|
return selection.getStartLow();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MemoryByte[] getSelectedAsBytes() {
|
public MemoryByte[] getSelectedAsBytes() {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return fRendering.getViewportCache().getBytes(
|
// default to the caret address and the cell count size
|
||||||
fRendering.getCaretAddress(), fRendering.getBytesPerColumn());
|
BigInteger startAddr = fRendering.getCaretAddress();
|
||||||
|
int byteCount = fRendering.getBytesPerColumn();
|
||||||
|
|
||||||
|
// Now see if there's a selection
|
||||||
|
IMemorySelection selection = fRendering.getSelection();
|
||||||
|
if (selection != null && selection.getStart() != null)
|
||||||
|
{
|
||||||
|
// The implementation is such that just having a caret somewhere
|
||||||
|
// (without multiple cells being selected) constitutes a selection,
|
||||||
|
// except for when the rendering is in its initial state. I.e.,
|
||||||
|
// just because we get here doesn't mean the user has selected more
|
||||||
|
// than one cell.
|
||||||
|
|
||||||
|
startAddr = getSelectedAddress();
|
||||||
|
|
||||||
|
if (selection.getHigh() != null)
|
||||||
|
{
|
||||||
|
byteCount = selection.getHigh().subtract(selection.getLow()).intValue() * fRendering.getAddressableSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fRendering.getViewportCache().getBytes(startAddr, byteCount);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(DebugException de)
|
catch(DebugException de)
|
||||||
{
|
{
|
||||||
// FIXME log?
|
// FIXME log?
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void goToAddress(final BigInteger address) throws DebugException {
|
public void goToAddress(final BigInteger address) throws DebugException {
|
||||||
|
|
Loading…
Add table
Reference in a new issue