mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
196392 - calls to MemoryBlock on the UI dispatch thread
This commit is contained in:
parent
876cf49ed7
commit
f5439d09a4
5 changed files with 147 additions and 112 deletions
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: Traditional Memory Rendering
|
Bundle-Name: Traditional Memory Rendering
|
||||||
Bundle-SymbolicName: org.eclipse.dd.debug.memory.renderings.traditional;singleton:=true
|
Bundle-SymbolicName: org.eclipse.dd.debug.memory.renderings.traditional;singleton:=true
|
||||||
Bundle-Version: 0.9.0.qualifier
|
Bundle-Version: 1.0.0.qualifier
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Require-Bundle: org.eclipse.debug.core,
|
Require-Bundle: org.eclipse.debug.core,
|
||||||
org.eclipse.debug.ui,
|
org.eclipse.debug.ui,
|
||||||
|
|
|
@ -68,7 +68,7 @@ public abstract class AbstractPane extends Canvas
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
fCaretAddress = rendering.getMemoryBlock().getBigBaseAddress();
|
fCaretAddress = rendering.getBigBaseAddress();
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -183,28 +183,16 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
this.fAddressBarControl.setVisible(false);
|
this.fAddressBarControl.setVisible(false);
|
||||||
|
|
||||||
// initialize the viewport start
|
// initialize the viewport start
|
||||||
IMemoryBlockExtension memoryBlock = getMemoryBlock();
|
if(fParent.getMemoryBlock() != null)
|
||||||
if(memoryBlock != null)
|
|
||||||
{
|
{
|
||||||
try
|
fViewportAddress = fParent.getMemoryBlockStartAddress();
|
||||||
{
|
|
||||||
fViewportAddress = memoryBlock.getMemoryBlockStartAddress();
|
|
||||||
// this will be null if memory may be retrieved at any address less than
|
// this will be null if memory may be retrieved at any address less than
|
||||||
// this memory block's base. if so use the base address.
|
// this memory block's base. if so use the base address.
|
||||||
if (fViewportAddress == null)
|
if (fViewportAddress == null)
|
||||||
fViewportAddress = memoryBlock.getBigBaseAddress();
|
fViewportAddress = fParent.getBigBaseAddress();
|
||||||
fBaseAddress = fViewportAddress;
|
fBaseAddress = fViewportAddress;
|
||||||
}
|
}
|
||||||
catch(DebugException e)
|
|
||||||
{
|
|
||||||
fViewportAddress = null;
|
|
||||||
if(isDebug())
|
|
||||||
Rendering.this
|
|
||||||
.logError(
|
|
||||||
TraditionalRenderingMessages
|
|
||||||
.getString("TraditionalRendering.FAILURE_RETRIEVE_START_ADDRESS"), e); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getHorizontalBar().addSelectionListener(new SelectionListener()
|
getHorizontalBar().addSelectionListener(new SelectionListener()
|
||||||
{
|
{
|
||||||
|
@ -520,7 +508,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IMemoryBlockExtension getMemoryBlock()
|
private IMemoryBlockExtension getMemoryBlock()
|
||||||
{
|
{
|
||||||
IMemoryBlock block = fParent.getMemoryBlock();
|
IMemoryBlock block = fParent.getMemoryBlock();
|
||||||
if(block != null)
|
if(block != null)
|
||||||
|
@ -530,16 +518,14 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected BigInteger getBigBaseAddress()
|
||||||
|
{
|
||||||
|
return fParent.getBigBaseAddress();
|
||||||
|
}
|
||||||
|
|
||||||
protected int getAddressableSize()
|
protected int getAddressableSize()
|
||||||
{
|
{
|
||||||
try
|
return fParent.getAddressableSize();
|
||||||
{
|
|
||||||
return getMemoryBlock().getAddressableSize();
|
|
||||||
}
|
|
||||||
catch(DebugException e)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ViewportCache getViewportCache()
|
protected ViewportCache getViewportCache()
|
||||||
|
@ -925,7 +911,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getMemoryBlock().setValue(address.subtract(getMemoryBlock().getBigBaseAddress()), byteValue);
|
getMemoryBlock().setValue(address.subtract(fParent.getBigBaseAddress()), byteValue);
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
@ -1334,27 +1320,9 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
return addressString.toString();
|
return addressString.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int fAddressBytes = -1; // called often, cache
|
|
||||||
|
|
||||||
protected int getAddressBytes()
|
protected int getAddressBytes()
|
||||||
{
|
{
|
||||||
if(fAddressBytes == -1)
|
return fParent.getAddressSize();
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
IMemoryBlockExtension block = getMemoryBlock();
|
|
||||||
fAddressBytes = block.getAddressSize();
|
|
||||||
}
|
|
||||||
catch(DebugException e)
|
|
||||||
{
|
|
||||||
fAddressBytes = 0;
|
|
||||||
logError(
|
|
||||||
TraditionalRenderingMessages
|
|
||||||
.getString("TraditionalRendering.FAILURE_DETERMINE_ADDRESS_SIZE"), e); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return fAddressBytes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getColumnCount()
|
protected int getColumnCount()
|
||||||
|
@ -1439,24 +1407,11 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
*/
|
*/
|
||||||
protected BigInteger getMemoryBlockStartAddress()
|
protected BigInteger getMemoryBlockStartAddress()
|
||||||
{
|
{
|
||||||
if (fMemoryBlockStartAddress == null)
|
if(fMemoryBlockStartAddress == null)
|
||||||
{
|
fMemoryBlockStartAddress = fParent.getMemoryBlockStartAddress();
|
||||||
try {
|
if(fMemoryBlockStartAddress == null)
|
||||||
IMemoryBlock memoryBlock = this.getMemoryBlock();
|
fMemoryBlockStartAddress = BigInteger.ZERO;
|
||||||
if(memoryBlock instanceof IMemoryBlockExtension)
|
|
||||||
{
|
|
||||||
BigInteger startAddress = ((IMemoryBlockExtension)memoryBlock).getMemoryBlockStartAddress();
|
|
||||||
if (startAddress != null)
|
|
||||||
fMemoryBlockStartAddress = startAddress;
|
|
||||||
}
|
|
||||||
} catch (DebugException e) {
|
|
||||||
fMemoryBlockStartAddress = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// default to 0 if we have trouble getting the start address
|
|
||||||
if (fMemoryBlockStartAddress == null)
|
|
||||||
fMemoryBlockStartAddress = BigInteger.valueOf(0);
|
|
||||||
}
|
|
||||||
return fMemoryBlockStartAddress;
|
return fMemoryBlockStartAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1465,40 +1420,9 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
*/
|
*/
|
||||||
protected BigInteger getMemoryBlockEndAddress()
|
protected BigInteger getMemoryBlockEndAddress()
|
||||||
{
|
{
|
||||||
if (fMemoryBlockEndAddress == null)
|
if(fMemoryBlockEndAddress == null)
|
||||||
{
|
fMemoryBlockEndAddress = fParent.getMemoryBlockEndAddress();
|
||||||
IMemoryBlock memoryBlock = this.getMemoryBlock();
|
|
||||||
if(memoryBlock instanceof IMemoryBlockExtension)
|
|
||||||
{
|
|
||||||
BigInteger endAddress;
|
|
||||||
try {
|
|
||||||
endAddress = ((IMemoryBlockExtension)memoryBlock).getMemoryBlockEndAddress();
|
|
||||||
if (endAddress != null)
|
|
||||||
fMemoryBlockEndAddress = endAddress;
|
|
||||||
} catch (DebugException e) {
|
|
||||||
fMemoryBlockEndAddress = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fMemoryBlockEndAddress == null)
|
|
||||||
{
|
|
||||||
int addressSize;
|
|
||||||
try {
|
|
||||||
addressSize = ((IMemoryBlockExtension)memoryBlock).getAddressSize();
|
|
||||||
} catch (DebugException e) {
|
|
||||||
addressSize = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
endAddress = BigInteger.valueOf(2);
|
|
||||||
endAddress = endAddress.pow(addressSize*8);
|
|
||||||
endAddress = endAddress.subtract(BigInteger.valueOf(1));
|
|
||||||
fMemoryBlockEndAddress = endAddress;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// default to MAX_VALUE if we have trouble getting the end address
|
|
||||||
if (fMemoryBlockEndAddress == null)
|
|
||||||
fMemoryBlockEndAddress = BigInteger.valueOf(Integer.MAX_VALUE);
|
|
||||||
}
|
|
||||||
return fMemoryBlockEndAddress;
|
return fMemoryBlockEndAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,14 +21,18 @@ 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.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
import org.eclipse.debug.core.model.MemoryByte;
|
import org.eclipse.debug.core.model.MemoryByte;
|
||||||
import org.eclipse.debug.internal.ui.DebugPluginImages;
|
import org.eclipse.debug.internal.ui.DebugPluginImages;
|
||||||
import org.eclipse.debug.internal.ui.DebugUIMessages;
|
import org.eclipse.debug.internal.ui.DebugUIMessages;
|
||||||
|
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
||||||
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
|
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
|
||||||
import org.eclipse.debug.internal.ui.views.memory.renderings.GoToAddressAction;
|
import org.eclipse.debug.internal.ui.views.memory.renderings.GoToAddressAction;
|
||||||
import org.eclipse.debug.ui.memory.AbstractMemoryRendering;
|
import org.eclipse.debug.ui.memory.AbstractMemoryRendering;
|
||||||
import org.eclipse.debug.ui.memory.AbstractTableRendering;
|
import org.eclipse.debug.ui.memory.AbstractTableRendering;
|
||||||
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
||||||
|
import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
|
||||||
import org.eclipse.debug.ui.memory.IRepositionableMemoryRendering;
|
import org.eclipse.debug.ui.memory.IRepositionableMemoryRendering;
|
||||||
import org.eclipse.jface.action.Action;
|
import org.eclipse.jface.action.Action;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
|
@ -50,22 +54,15 @@ import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.dnd.Clipboard;
|
import org.eclipse.swt.dnd.Clipboard;
|
||||||
import org.eclipse.swt.dnd.TextTransfer;
|
import org.eclipse.swt.dnd.TextTransfer;
|
||||||
import org.eclipse.swt.dnd.Transfer;
|
import org.eclipse.swt.dnd.Transfer;
|
||||||
import org.eclipse.swt.events.FocusEvent;
|
|
||||||
import org.eclipse.swt.events.FocusListener;
|
|
||||||
import org.eclipse.swt.events.KeyListener;
|
|
||||||
import org.eclipse.swt.graphics.Color;
|
import org.eclipse.swt.graphics.Color;
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
import org.eclipse.swt.layout.GridData;
|
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.Label;
|
|
||||||
import org.eclipse.ui.IWorkbench;
|
import org.eclipse.ui.IWorkbench;
|
||||||
import org.eclipse.ui.IWorkbenchActionConstants;
|
import org.eclipse.ui.IWorkbenchActionConstants;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
import org.eclipse.ui.commands.ICommandService;
|
import org.eclipse.ui.commands.ICommandService;
|
||||||
import org.eclipse.ui.contexts.IContextService;
|
|
||||||
import org.eclipse.ui.model.IWorkbenchAdapter;
|
import org.eclipse.ui.model.IWorkbenchAdapter;
|
||||||
import org.eclipse.ui.progress.UIJob;
|
import org.eclipse.ui.progress.UIJob;
|
||||||
|
|
||||||
|
@ -156,6 +153,120 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void logError(String message, Exception e)
|
||||||
|
{
|
||||||
|
Status status = new Status(IStatus.ERROR, getRenderingId(),
|
||||||
|
DebugException.INTERNAL_ERROR, message, e);
|
||||||
|
|
||||||
|
DebugUIPlugin.getDefault().getLog().log(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
private BigInteger fBigBaseAddress;
|
||||||
|
private BigInteger fStartAddress;
|
||||||
|
private BigInteger fEndAddress;
|
||||||
|
private int fAddressableSize;
|
||||||
|
private int fAddressSize;
|
||||||
|
|
||||||
|
public void init(IMemoryRenderingContainer container, IMemoryBlock block)
|
||||||
|
{
|
||||||
|
super.init(container, block);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
fBigBaseAddress = ((IMemoryBlockExtension) block).getBigBaseAddress();
|
||||||
|
}
|
||||||
|
catch(DebugException de)
|
||||||
|
{
|
||||||
|
logError(TraditionalRenderingMessages
|
||||||
|
.getString("TraditionalRendering.FAILURE_RETRIEVE_BASE_ADDRESS"), de); //$NON-NLS-1$ // FIXME
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
fAddressableSize = ((IMemoryBlockExtension) block).getAddressableSize();
|
||||||
|
}
|
||||||
|
catch(DebugException de)
|
||||||
|
{
|
||||||
|
fAddressableSize = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
fStartAddress = ((IMemoryBlockExtension)block).getMemoryBlockStartAddress();
|
||||||
|
}
|
||||||
|
catch (DebugException de) {
|
||||||
|
fStartAddress = null;
|
||||||
|
logError(TraditionalRenderingMessages
|
||||||
|
.getString("TraditionalRendering.FAILURE_RETRIEVE_START_ADDRESS"), de); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
fAddressSize = ((IMemoryBlockExtension) block).getAddressSize();
|
||||||
|
}
|
||||||
|
catch(DebugException e)
|
||||||
|
{
|
||||||
|
fAddressSize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigInteger endAddress;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
endAddress = ((IMemoryBlockExtension) block).getMemoryBlockEndAddress();
|
||||||
|
if (endAddress != null)
|
||||||
|
fEndAddress = endAddress;
|
||||||
|
}
|
||||||
|
catch (DebugException e)
|
||||||
|
{
|
||||||
|
fEndAddress = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fEndAddress == null)
|
||||||
|
{
|
||||||
|
int addressSize;
|
||||||
|
try {
|
||||||
|
addressSize = ((IMemoryBlockExtension) block).getAddressSize();
|
||||||
|
} catch (DebugException e) {
|
||||||
|
addressSize = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
endAddress = BigInteger.valueOf(2);
|
||||||
|
endAddress = endAddress.pow(addressSize*8);
|
||||||
|
endAddress = endAddress.subtract(BigInteger.valueOf(1));
|
||||||
|
fEndAddress = endAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
// default to MAX_VALUE if we have trouble getting the end address
|
||||||
|
if (fEndAddress == null)
|
||||||
|
fEndAddress = BigInteger.valueOf(Integer.MAX_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigInteger getBigBaseAddress()
|
||||||
|
{
|
||||||
|
return fBigBaseAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigInteger getMemoryBlockStartAddress()
|
||||||
|
{
|
||||||
|
return fStartAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigInteger getMemoryBlockEndAddress()
|
||||||
|
{
|
||||||
|
return fEndAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAddressableSize()
|
||||||
|
{
|
||||||
|
return fAddressableSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAddressSize()
|
||||||
|
{
|
||||||
|
return fAddressSize;
|
||||||
|
}
|
||||||
|
|
||||||
public Control createControl(Composite parent)
|
public Control createControl(Composite parent)
|
||||||
{
|
{
|
||||||
allocateColors();
|
allocateColors();
|
||||||
|
@ -901,7 +1012,6 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
|
||||||
|
|
||||||
return super.getAdapter(adapter);
|
return super.getAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TraditionalMemoryByte extends MemoryByte
|
class TraditionalMemoryByte extends MemoryByte
|
||||||
|
|
|
@ -24,6 +24,7 @@ TraditionalRendering.CELL_SIZE=Cell Size
|
||||||
TraditionalRendering.RADIX=Radix
|
TraditionalRendering.RADIX=Radix
|
||||||
TraditionalRendering.RENDERING_NAME=Traditional
|
TraditionalRendering.RENDERING_NAME=Traditional
|
||||||
TraditionalRendering.FAILURE_RETRIEVE_START_ADDRESS=Failure in retrieving start address.
|
TraditionalRendering.FAILURE_RETRIEVE_START_ADDRESS=Failure in retrieving start address.
|
||||||
|
TraditionalRendering.FAILURE_RETRIEVE_BASE_ADDRESS=Failure in retrieving base address.
|
||||||
TraditionalRendering.CALLED_ON_NON_DISPATCH_THREAD=Called on non-dispatch thread
|
TraditionalRendering.CALLED_ON_NON_DISPATCH_THREAD=Called on non-dispatch thread
|
||||||
TraditionalRendering.FAILURE_READ_MEMORY=Failed reading memory.
|
TraditionalRendering.FAILURE_READ_MEMORY=Failed reading memory.
|
||||||
TraditionalRendering.FAILURE_WRITE_MEMORY=Error writing memory.
|
TraditionalRendering.FAILURE_WRITE_MEMORY=Error writing memory.
|
||||||
|
|
Loading…
Add table
Reference in a new issue