1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Moved getRegisters from the stack frame to the target.

This commit is contained in:
Mikhail Khodjaiants 2002-10-02 21:13:02 +00:00
parent 0c0673d8f4
commit 138cdae85d
5 changed files with 55 additions and 62 deletions

View file

@ -1681,13 +1681,13 @@ public class CDebugTarget extends CDebugElement
return isAvailable() && isSuspended();
}
protected IRegisterGroup[] getRegisterGroups() throws DebugException
{
return (IRegisterGroup[])fRegisterGroups.toArray( new IRegisterGroup[fRegisterGroups.size()] );
}
protected IRegisterGroup[] getRegisterGroups( CStackFrame stackFrame ) throws DebugException
{
Iterator it = fRegisterGroups.iterator();
while( it.hasNext() )
{
((CRegisterGroup)it.next()).refresh( stackFrame );
}
return (IRegisterGroup[])fRegisterGroups.toArray( new IRegisterGroup[fRegisterGroups.size()] );
}
@ -1716,15 +1716,6 @@ public class CDebugTarget extends CDebugElement
((CRegisterGroup)it.next()).dispose();
}
}
protected void preserveRegisters()
{
Iterator it = fRegisterGroups.iterator();
while( it.hasNext() )
{
((CRegisterGroup)it.next()).resetChangeFlags();
}
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.IExpressionListener#expressionAdded(IExpression)
@ -1854,6 +1845,15 @@ public class CDebugTarget extends CDebugElement
}
}
protected void resetRegisters()
{
Iterator it = fRegisterGroups.iterator();
while( it.hasNext() )
{
((CRegisterGroup)it.next()).resetChangeFlags();
}
}
/**
* @see org.eclipse.cdt.debug.core.ICDebugTargetType#getTargetType()
*/

View file

@ -1,5 +1,9 @@
package org.eclipse.cdt.debug.internal.core.model;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IValue;
@ -36,4 +40,31 @@ public class CGlobalVariable extends CModificationVariable
}
return fValue;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvent(ICDIEvent)
*/
public void handleDebugEvent( ICDIEvent event )
{
super.handleDebugEvent( event );
ICDIObject source = event.getSource();
if (source == null)
return;
if ( source.getTarget().equals( getCDITarget() ) )
{
if ( event instanceof ICDIResumedEvent )
{
try
{
setChanged( false );
}
catch( DebugException e )
{
CDebugCorePlugin.log( e );
}
}
}
}
}

View file

@ -28,12 +28,6 @@ public class CRegisterGroup extends CDebugElement implements IRegisterGroup
private String fName;
private ICDIRegisterObject[] fRegisterObjects;
private List fRegisters;
private CStackFrame fCurrentStackFrame = null;
/**
* Whether the registers need refreshing
*/
private boolean fRefresh = true;
/**
* Constructor for CRegisterGroup.
@ -83,13 +77,6 @@ public class CRegisterGroup extends CDebugElement implements IRegisterGroup
fRegisters.add( new CRegister( this, regs[i] ) );
}
}
/*
else if ( fRefresh )
{
updateRegisters();
}
fRefresh = false;
*/
return fRegisters;
}
@ -102,41 +89,21 @@ public class CRegisterGroup extends CDebugElement implements IRegisterGroup
}
fRegisters.clear();
}
protected void refresh( CStackFrame stackFrame )
{
setCurrentStackFrame( stackFrame );
fRefresh = true;
}
private ICDIRegister[] getCDIRegisters() throws DebugException
{
ICDIRegister[] result = new ICDIRegister[0];
CStackFrame currentFrame = getCurrentStackFrame();
if ( currentFrame != null )
try
{
try
{
result = getCurrentStackFrame().getCDIStackFrame().getRegisters( fRegisterObjects );
}
catch( CDIException e )
{
targetRequestFailed( e.getMessage(), null );
}
result = ((CDebugTarget)getDebugTarget()).getCDITarget().getRegisters( fRegisterObjects );
}
catch( CDIException e )
{
targetRequestFailed( e.getMessage(), null );
}
return result;
}
protected void setCurrentStackFrame( CStackFrame stackFrame )
{
fCurrentStackFrame = stackFrame;
}
protected CStackFrame getCurrentStackFrame()
{
return fCurrentStackFrame;
}
private void updateRegisters() throws DebugException
{
ICDIRegister[] cdiRegisters = getCDIRegisters();

View file

@ -222,7 +222,7 @@ public class CStackFrame extends CDebugElement
*/
public IRegisterGroup[] getRegisterGroups() throws DebugException
{
return ((CDebugTarget)getDebugTarget()).getRegisterGroups( this );
return ((CDebugTarget)getDebugTarget()).getRegisterGroups();
}
/* (non-Javadoc)
@ -230,7 +230,7 @@ public class CStackFrame extends CDebugElement
*/
public boolean hasRegisterGroups() throws DebugException
{
return ((CDebugTarget)getDebugTarget()).getRegisterGroups( this ).length > 0;
return ((CDebugTarget)getDebugTarget()).getRegisterGroups().length > 0;
}
/* (non-Javadoc)
@ -686,7 +686,6 @@ public class CStackFrame extends CDebugElement
protected synchronized void preserve()
{
preserveVariables();
preserveRegisters();
}
private void preserveVariables()
@ -707,11 +706,6 @@ public class CStackFrame extends CDebugElement
}
}
private void preserveRegisters()
{
((CDebugTarget)getDebugTarget()).preserveRegisters();
}
// temporary solution
protected ICDIVariable findVariable( List list, ICDIVariable var )
{

View file

@ -963,6 +963,7 @@ public class CThread extends CDebugElement
{
return;
}
// ((CDebugTarget)getDebugTarget()).resetRegisters();
try
{
getCDIThread().setCurrentStackFrame( ((CStackFrame)frame).getCDIStackFrame() );