1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-30 20:35:38 +02:00

Implementing the memory view support.

This commit is contained in:
Mikhail Khodjaiants 2002-10-15 21:42:17 +00:00
parent 6c770feac4
commit ef35f69c64
7 changed files with 467 additions and 17 deletions

View file

@ -1,3 +1,11 @@
2002-10-15 Mikhail Khodjaiants
* CDebugModel.java: Implementing the memory view support.
* ICMemoryManager: Implementing the memory view support.
* IFormattedMemoryBlock.java: Implementing the memory view support.
* CDebugTarget.java: Implementing the memory view support.
* CFormattedMemoryBlock.java: Implementing the memory view support.
* CMemoryManager.java: Implementing the memory view support.
2002-10-15 Mikhail Khodjaiants
* ICDebugConstants.java: New interface that contains the constant definitions for C/C++ debug plug-in.
* CSourceManager.java: Implementation of the 'Automatically switch to disassembly mode' preference.

View file

@ -15,6 +15,7 @@ import org.eclipse.cdt.debug.core.cdi.ICDILocation;
import org.eclipse.cdt.debug.core.cdi.ICDISessionObject;
import org.eclipse.cdt.debug.core.cdi.event.ICDISuspendedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.internal.core.CDebugUtils;
@ -23,6 +24,7 @@ import org.eclipse.cdt.debug.internal.core.breakpoints.CLineBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CWatchpoint;
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
import org.eclipse.cdt.debug.internal.core.model.CExpression;
import org.eclipse.cdt.debug.internal.core.model.CFormattedMemoryBlock;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@ -355,7 +357,75 @@ public class CDebugModel
}
return null;
}
public static IFormattedMemoryBlock createFormattedMemoryBlock( IDebugTarget target,
long startAddress,
int format,
int wordSize,
int numberOfRows,
int numberOfColumns,
char paddingChar ) throws DebugException
{
if ( target != null && target instanceof CDebugTarget )
{
try
{
ICDIMemoryBlock cdiMemoryBlock = ((CDebugTarget)target).getCDISession()
.getMemoryManager()
.createMemoryBlock( startAddress, wordSize * numberOfRows * numberOfColumns );
return new CFormattedMemoryBlock( (CDebugTarget)target,
cdiMemoryBlock,
format,
wordSize,
numberOfRows,
numberOfColumns,
paddingChar );
}
catch( CDIException e )
{
throw new DebugException( new Status( IStatus.ERROR,
getPluginIdentifier(),
DebugException.TARGET_REQUEST_FAILED,
e.getMessage(),
null ) );
}
}
return null;
}
public static IFormattedMemoryBlock createFormattedMemoryBlock( IDebugTarget target,
long startAddress,
int format,
int wordSize,
int numberOfRows,
int numberOfColumns ) throws DebugException
{
if ( target != null && target instanceof CDebugTarget )
{
try
{
ICDIMemoryBlock cdiMemoryBlock = ((CDebugTarget)target).getCDISession()
.getMemoryManager()
.createMemoryBlock( startAddress, wordSize * numberOfRows * numberOfColumns );
return new CFormattedMemoryBlock( (CDebugTarget)target,
cdiMemoryBlock,
format,
wordSize,
numberOfRows,
numberOfColumns );
}
catch( CDIException e )
{
throw new DebugException( new Status( IStatus.ERROR,
getPluginIdentifier(),
DebugException.TARGET_REQUEST_FAILED,
e.getMessage(),
null ) );
}
}
return null;
}
private static void stopInMain( CDebugTarget target ) throws DebugException
{
ICDILocation location = target.getCDISession().getBreakpointManager().createLocation( "", "main", 0 );

View file

@ -0,0 +1,28 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.core;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IMemoryBlock;
/**
* Enter type comment.
*
* @since: Oct 15, 2002
*/
public interface ICMemoryManager extends IAdaptable
{
void addBlock( IMemoryBlock memoryBlock ) throws DebugException;
void removeBlock( IMemoryBlock memoryBlock ) throws DebugException;
void removeAllBlocks() throws DebugException;
IMemoryBlock getBlock( int index );
IMemoryBlock[] getBlocks();
}

View file

@ -6,7 +6,7 @@
package org.eclipse.cdt.debug.core;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IMemoryBlock;
/**
*
@ -15,15 +15,8 @@ import org.eclipse.debug.core.model.IDebugElement;
*
* @since Jul 31, 2002
*/
public interface IFormattedMemoryBlock extends IDebugElement
public interface IFormattedMemoryBlock extends IMemoryBlock
{
/**
* Returns the start address of this memory block.
*
* @return the start address of this memory block
*/
long getStartAddress();
/**
* Returns the format of the memory words of this block.
*
@ -66,6 +59,8 @@ public interface IFormattedMemoryBlock extends IDebugElement
*/
IFormattedMemoryBlockRow[] getRows();
char getPaddingCharacter();
long nextRowAddress();
long previousRowAddress();
@ -74,14 +69,12 @@ public interface IFormattedMemoryBlock extends IDebugElement
long previousPageAddress();
void reformat( long startAddress,
int format,
void reformat( int format,
int wordSize,
int numberOfRows,
int numberOfColumns ) throws DebugException;
void reformat( long startAddress,
int format,
void reformat( int format,
int wordSize,
int numberOfRows,
int numberOfColumns,

View file

@ -0,0 +1,106 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.core;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.debug.core.ICMemoryManager;
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IMemoryBlock;
/**
* Enter type comment.
*
* @since: Oct 15, 2002
*/
public class CMemoryManager implements ICMemoryManager
{
private List fBlocks;
private CDebugTarget fDebugTarget;
/**
* Constructor for CMemoryManager.
*/
public CMemoryManager( CDebugTarget target )
{
fBlocks = new ArrayList( 4 );
setDebugTarget( target );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.ICMemoryManager#addBlock(IMemoryBlock)
*/
public void addBlock( IMemoryBlock memoryBlock ) throws DebugException
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.ICMemoryManager#removeBlock(IMemoryBlock)
*/
public void removeBlock( IMemoryBlock memoryBlock ) throws DebugException
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.ICMemoryManager#removeAllBlocks()
*/
public void removeAllBlocks() throws DebugException
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.ICMemoryManager#getBlock(int)
*/
public IMemoryBlock getBlock( int index )
{
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.ICMemoryManager#getBlocks()
*/
public IMemoryBlock[] getBlocks()
{
return null;
}
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
*/
public Object getAdapter( Class adapter )
{
if ( adapter.equals( ICMemoryManager.class ) )
{
return this;
}
if ( adapter.equals( CMemoryManager.class ) )
{
return this;
}
if ( adapter.equals( IDebugTarget.class ) )
{
return fDebugTarget;
}
return null;
}
public IDebugTarget getDebugTarget()
{
return fDebugTarget;
}
protected void setDebugTarget( CDebugTarget target )
{
fDebugTarget = target;
}
public void dispose()
{
}
}

View file

@ -16,6 +16,7 @@ import org.eclipse.cdt.debug.core.ICBreakpoint;
import org.eclipse.cdt.debug.core.ICDebugTargetType;
import org.eclipse.cdt.debug.core.ICExpressionEvaluator;
import org.eclipse.cdt.debug.core.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.ICMemoryManager;
import org.eclipse.cdt.debug.core.ICWatchpoint;
import org.eclipse.cdt.debug.core.IFormattedMemoryBlock;
import org.eclipse.cdt.debug.core.IFormattedMemoryRetrieval;
@ -53,13 +54,14 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLocator;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceManager;
import org.eclipse.cdt.debug.internal.core.sourcelookup.DisassemblyManager;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.core.sourcelookup.ISourceMode;
import org.eclipse.cdt.debug.internal.core.CMemoryManager;
import org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLocator;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceManager;
import org.eclipse.cdt.debug.internal.core.sourcelookup.DisassemblyManager;
import org.eclipse.core.resources.IMarkerDelta;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@ -198,6 +200,11 @@ public class CDebugTarget extends CDebugElement
*/
private List fTemporaryBreakpoints;
/**
* A memory manager for this target.
*/
private CMemoryManager fMemoryManager;
/**
* Constructor for CDebugTarget.
* @param target
@ -241,6 +248,7 @@ public class CDebugTarget extends CDebugElement
setSourceSearchPath();
initializeBreakpoints();
initializeRegisters();
initializeMemoryManager();
getLaunch().addDebugTarget( this );
fireCreationEvent();
}
@ -289,6 +297,11 @@ public class CDebugTarget extends CDebugElement
createMainRegisterGroup();
}
protected void initializeMemoryManager()
{
fMemoryManager = new CMemoryManager( this );
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IDebugTarget#getProcess()
*/
@ -797,6 +810,8 @@ public class CDebugTarget extends CDebugElement
return getSourceLocator();
}
}
if ( adapter.equals( ICMemoryManager.class ) )
return getMemoryManager();
return super.getAdapter( adapter );
}
@ -1044,6 +1059,7 @@ public class CDebugTarget extends CDebugElement
DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener( this );
DebugPlugin.getDefault().getExpressionManager().removeExpressionListener( this );
DebugPlugin.getDefault().getLaunchManager().removeLaunchListener( this );
disposeMemoryManager();
removeAllExpressions();
try
{
@ -1894,4 +1910,14 @@ public class CDebugTarget extends CDebugElement
}
return ISourceMode.MODE_SOURCE;
}
protected CMemoryManager getMemoryManager()
{
return fMemoryManager;
}
private void disposeMemoryManager()
{
getMemoryManager().dispose();
}
}

View file

@ -0,0 +1,219 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.core.model;
import org.eclipse.cdt.debug.core.IFormattedMemoryBlock;
import org.eclipse.cdt.debug.core.IFormattedMemoryBlockRow;
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
import org.eclipse.debug.core.DebugException;
/**
* Enter type comment.
*
* @since: Oct 15, 2002
*/
public class CFormattedMemoryBlock extends CDebugElement implements IFormattedMemoryBlock
{
private ICDIMemoryBlock fCDIMemoryBlock;
private int fFormat;
private int fWordSize;
private int fNumberOfRows;
private int fNumberOfColumns;
private boolean fDisplayAscii = true;
private char fPaddingChar = 0;
/**
* Constructor for CFormattedMemoryBlock.
* @param target
*/
public CFormattedMemoryBlock( CDebugTarget target,
ICDIMemoryBlock cdiMemoryBlock,
int format,
int wordSize,
int numberOfRows,
int numberOfColumns )
{
super( target );
fCDIMemoryBlock = cdiMemoryBlock;
fFormat = format;
fWordSize = wordSize;
fNumberOfRows = numberOfRows;
fNumberOfColumns = numberOfColumns;
fDisplayAscii = false;
fPaddingChar = 0;
}
/**
* Constructor for CFormattedMemoryBlock.
* @param target
*/
public CFormattedMemoryBlock( CDebugTarget target,
ICDIMemoryBlock cdiMemoryBlock,
int format,
int wordSize,
int numberOfRows,
int numberOfColumns,
char paddingChar )
{
super( target );
fCDIMemoryBlock = cdiMemoryBlock;
fFormat = format;
fWordSize = wordSize;
fNumberOfRows = numberOfRows;
fNumberOfColumns = numberOfColumns;
fDisplayAscii = true;
fPaddingChar = paddingChar;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#getFormat()
*/
public int getFormat()
{
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#getWordSize()
*/
public int getWordSize()
{
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#getNumberOfRows()
*/
public int getNumberOfRows()
{
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#getNumberOfColumns()
*/
public int getNumberOfColumns()
{
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#displayASCII()
*/
public boolean displayASCII()
{
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#getRows()
*/
public IFormattedMemoryBlockRow[] getRows()
{
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#nextRowAddress()
*/
public long nextRowAddress()
{
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#previousRowAddress()
*/
public long previousRowAddress()
{
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#nextPageAddress()
*/
public long nextPageAddress()
{
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#previousPageAddress()
*/
public long previousPageAddress()
{
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#reformat(long, int, int, int, int)
*/
public void reformat( int format,
int wordSize,
int numberOfRows,
int numberOfColumns ) throws DebugException
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#reformat(long, int, int, int, int, char)
*/
public void reformat( int format,
int wordSize,
int numberOfRows,
int numberOfColumns,
char paddingChar ) throws DebugException
{
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IMemoryBlock#getStartAddress()
*/
public long getStartAddress()
{
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IMemoryBlock#getLength()
*/
public long getLength()
{
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IMemoryBlock#getBytes()
*/
public byte[] getBytes() throws DebugException
{
return null;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IMemoryBlock#supportsValueModification()
*/
public boolean supportsValueModification()
{
return false;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IMemoryBlock#setValue(long, byte[])
*/
public void setValue( long offset, byte[] bytes ) throws DebugException
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#getPaddingCharacter()
*/
public char getPaddingCharacter()
{
return 0;
}
}