mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Moved getRegisters from the stack frame to the target.
This commit is contained in:
parent
0c0673d8f4
commit
138cdae85d
5 changed files with 55 additions and 62 deletions
|
@ -1681,13 +1681,13 @@ public class CDebugTarget extends CDebugElement
|
||||||
return isAvailable() && isSuspended();
|
return isAvailable() && isSuspended();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected IRegisterGroup[] getRegisterGroups() throws DebugException
|
||||||
|
{
|
||||||
|
return (IRegisterGroup[])fRegisterGroups.toArray( new IRegisterGroup[fRegisterGroups.size()] );
|
||||||
|
}
|
||||||
|
|
||||||
protected IRegisterGroup[] getRegisterGroups( CStackFrame stackFrame ) throws DebugException
|
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()] );
|
return (IRegisterGroup[])fRegisterGroups.toArray( new IRegisterGroup[fRegisterGroups.size()] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1716,15 +1716,6 @@ public class CDebugTarget extends CDebugElement
|
||||||
((CRegisterGroup)it.next()).dispose();
|
((CRegisterGroup)it.next()).dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void preserveRegisters()
|
|
||||||
{
|
|
||||||
Iterator it = fRegisterGroups.iterator();
|
|
||||||
while( it.hasNext() )
|
|
||||||
{
|
|
||||||
((CRegisterGroup)it.next()).resetChangeFlags();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.debug.core.IExpressionListener#expressionAdded(IExpression)
|
* @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()
|
* @see org.eclipse.cdt.debug.core.ICDebugTargetType#getTargetType()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package org.eclipse.cdt.debug.internal.core.model;
|
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.cdt.debug.core.cdi.model.ICDIVariable;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IValue;
|
import org.eclipse.debug.core.model.IValue;
|
||||||
|
@ -36,4 +40,31 @@ public class CGlobalVariable extends CModificationVariable
|
||||||
}
|
}
|
||||||
return fValue;
|
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 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,12 +28,6 @@ public class CRegisterGroup extends CDebugElement implements IRegisterGroup
|
||||||
private String fName;
|
private String fName;
|
||||||
private ICDIRegisterObject[] fRegisterObjects;
|
private ICDIRegisterObject[] fRegisterObjects;
|
||||||
private List fRegisters;
|
private List fRegisters;
|
||||||
private CStackFrame fCurrentStackFrame = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the registers need refreshing
|
|
||||||
*/
|
|
||||||
private boolean fRefresh = true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for CRegisterGroup.
|
* Constructor for CRegisterGroup.
|
||||||
|
@ -83,13 +77,6 @@ public class CRegisterGroup extends CDebugElement implements IRegisterGroup
|
||||||
fRegisters.add( new CRegister( this, regs[i] ) );
|
fRegisters.add( new CRegister( this, regs[i] ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
else if ( fRefresh )
|
|
||||||
{
|
|
||||||
updateRegisters();
|
|
||||||
}
|
|
||||||
fRefresh = false;
|
|
||||||
*/
|
|
||||||
return fRegisters;
|
return fRegisters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,41 +89,21 @@ public class CRegisterGroup extends CDebugElement implements IRegisterGroup
|
||||||
}
|
}
|
||||||
fRegisters.clear();
|
fRegisters.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void refresh( CStackFrame stackFrame )
|
|
||||||
{
|
|
||||||
setCurrentStackFrame( stackFrame );
|
|
||||||
fRefresh = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ICDIRegister[] getCDIRegisters() throws DebugException
|
private ICDIRegister[] getCDIRegisters() throws DebugException
|
||||||
{
|
{
|
||||||
ICDIRegister[] result = new ICDIRegister[0];
|
ICDIRegister[] result = new ICDIRegister[0];
|
||||||
CStackFrame currentFrame = getCurrentStackFrame();
|
try
|
||||||
if ( currentFrame != null )
|
|
||||||
{
|
{
|
||||||
try
|
result = ((CDebugTarget)getDebugTarget()).getCDITarget().getRegisters( fRegisterObjects );
|
||||||
{
|
}
|
||||||
result = getCurrentStackFrame().getCDIStackFrame().getRegisters( fRegisterObjects );
|
catch( CDIException e )
|
||||||
}
|
{
|
||||||
catch( CDIException e )
|
targetRequestFailed( e.getMessage(), null );
|
||||||
{
|
|
||||||
targetRequestFailed( e.getMessage(), null );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setCurrentStackFrame( CStackFrame stackFrame )
|
|
||||||
{
|
|
||||||
fCurrentStackFrame = stackFrame;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected CStackFrame getCurrentStackFrame()
|
|
||||||
{
|
|
||||||
return fCurrentStackFrame;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateRegisters() throws DebugException
|
private void updateRegisters() throws DebugException
|
||||||
{
|
{
|
||||||
ICDIRegister[] cdiRegisters = getCDIRegisters();
|
ICDIRegister[] cdiRegisters = getCDIRegisters();
|
||||||
|
|
|
@ -222,7 +222,7 @@ public class CStackFrame extends CDebugElement
|
||||||
*/
|
*/
|
||||||
public IRegisterGroup[] getRegisterGroups() throws DebugException
|
public IRegisterGroup[] getRegisterGroups() throws DebugException
|
||||||
{
|
{
|
||||||
return ((CDebugTarget)getDebugTarget()).getRegisterGroups( this );
|
return ((CDebugTarget)getDebugTarget()).getRegisterGroups();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -230,7 +230,7 @@ public class CStackFrame extends CDebugElement
|
||||||
*/
|
*/
|
||||||
public boolean hasRegisterGroups() throws DebugException
|
public boolean hasRegisterGroups() throws DebugException
|
||||||
{
|
{
|
||||||
return ((CDebugTarget)getDebugTarget()).getRegisterGroups( this ).length > 0;
|
return ((CDebugTarget)getDebugTarget()).getRegisterGroups().length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -686,7 +686,6 @@ public class CStackFrame extends CDebugElement
|
||||||
protected synchronized void preserve()
|
protected synchronized void preserve()
|
||||||
{
|
{
|
||||||
preserveVariables();
|
preserveVariables();
|
||||||
preserveRegisters();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void preserveVariables()
|
private void preserveVariables()
|
||||||
|
@ -707,11 +706,6 @@ public class CStackFrame extends CDebugElement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void preserveRegisters()
|
|
||||||
{
|
|
||||||
((CDebugTarget)getDebugTarget()).preserveRegisters();
|
|
||||||
}
|
|
||||||
|
|
||||||
// temporary solution
|
// temporary solution
|
||||||
protected ICDIVariable findVariable( List list, ICDIVariable var )
|
protected ICDIVariable findVariable( List list, ICDIVariable var )
|
||||||
{
|
{
|
||||||
|
|
|
@ -963,6 +963,7 @@ public class CThread extends CDebugElement
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// ((CDebugTarget)getDebugTarget()).resetRegisters();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getCDIThread().setCurrentStackFrame( ((CStackFrame)frame).getCDIStackFrame() );
|
getCDIThread().setCurrentStackFrame( ((CStackFrame)frame).getCDIStackFrame() );
|
||||||
|
|
Loading…
Add table
Reference in a new issue