mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
If the target is suspended by a line breakpoint the source manager tries to retrieve the file resource from the breakpoint marker.
This commit is contained in:
parent
3a43da5b4b
commit
8720297f8a
3 changed files with 55 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2003-10-17 Mikhail Khodjaiants
|
||||||
|
If the target is suspended by a line breakpoint the source manager tries to retrieve
|
||||||
|
the file resource from the breakpoint marker.
|
||||||
|
* CSourceManager.java
|
||||||
|
* CDebugTarget.java
|
||||||
|
|
||||||
2003-10-15 Mikhail Khodjaiants
|
2003-10-15 Mikhail Khodjaiants
|
||||||
Improving the source search algorithms.
|
Improving the source search algorithms.
|
||||||
* CDirectorySourceLocation.java
|
* CDirectorySourceLocation.java
|
||||||
|
|
|
@ -442,6 +442,13 @@ public class CDebugTarget extends CDebugElement
|
||||||
ISourceLocator locator = getLaunch().getSourceLocator();
|
ISourceLocator locator = getLaunch().getSourceLocator();
|
||||||
if ( locator instanceof IAdaptable )
|
if ( locator instanceof IAdaptable )
|
||||||
{
|
{
|
||||||
|
ICSourceLocator clocator = (ICSourceLocator)((IAdaptable)locator).getAdapter( ICSourceLocator.class );
|
||||||
|
if ( clocator instanceof IAdaptable )
|
||||||
|
{
|
||||||
|
CSourceManager sm = (CSourceManager)((IAdaptable)clocator).getAdapter( CSourceManager.class );
|
||||||
|
if ( sm != null )
|
||||||
|
sm.setDebugTarget( this );
|
||||||
|
}
|
||||||
IResourceChangeListener listener = (IResourceChangeListener)((IAdaptable)locator).getAdapter( IResourceChangeListener.class );
|
IResourceChangeListener listener = (IResourceChangeListener)((IAdaptable)locator).getAdapter( IResourceChangeListener.class );
|
||||||
if ( listener != null )
|
if ( listener != null )
|
||||||
CCorePlugin.getWorkspace().addResourceChangeListener( listener );
|
CCorePlugin.getWorkspace().addResourceChangeListener( listener );
|
||||||
|
@ -2777,6 +2784,26 @@ public class CDebugTarget extends CDebugElement
|
||||||
return fRunningInfo;
|
return fRunningInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IFile getCurrentBreakpointFile()
|
||||||
|
{
|
||||||
|
Object info = getCurrentStateInfo();
|
||||||
|
if ( info instanceof ICDIBreakpointHit )
|
||||||
|
{
|
||||||
|
ICDIBreakpoint cdiBreakpoint = ((ICDIBreakpointHit)info).getBreakpoint();
|
||||||
|
if ( cdiBreakpoint != null )
|
||||||
|
{
|
||||||
|
IBreakpoint breakpoint = findBreakpoint( cdiBreakpoint );
|
||||||
|
if ( breakpoint instanceof ICLineBreakpoint )
|
||||||
|
{
|
||||||
|
IResource resource = ((ICLineBreakpoint)breakpoint).getMarker().getResource();
|
||||||
|
if ( resource instanceof IFile )
|
||||||
|
return (IFile)resource;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
protected void setRunningInfo( RunningInfo info )
|
protected void setRunningInfo( RunningInfo info )
|
||||||
{
|
{
|
||||||
fRunningInfo = info;
|
fRunningInfo = info;
|
||||||
|
@ -2802,6 +2829,7 @@ public class CDebugTarget extends CDebugElement
|
||||||
}
|
}
|
||||||
setRunningInfo( info );
|
setRunningInfo( info );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
private boolean applyDeferredBreakpoints()
|
private boolean applyDeferredBreakpoints()
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
|
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.ISourceMode;
|
import org.eclipse.cdt.debug.core.sourcelookup.ISourceMode;
|
||||||
|
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IResourceChangeListener;
|
import org.eclipse.core.resources.IResourceChangeListener;
|
||||||
|
@ -39,7 +40,8 @@ public class CSourceManager implements ICSourceLocator,
|
||||||
private ISourceLocator fSourceLocator = null;
|
private ISourceLocator fSourceLocator = null;
|
||||||
private int fMode = ISourceMode.MODE_SOURCE;
|
private int fMode = ISourceMode.MODE_SOURCE;
|
||||||
private int fRealMode = fMode;
|
private int fRealMode = fMode;
|
||||||
private ILaunch fLaunch = null;
|
private ILaunch fLaunch = null;
|
||||||
|
private CDebugTarget fDebugTarget = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for CSourceManager.
|
* Constructor for CSourceManager.
|
||||||
|
@ -132,6 +134,8 @@ public class CSourceManager implements ICSourceLocator,
|
||||||
*/
|
*/
|
||||||
public Object getAdapter( Class adapter )
|
public Object getAdapter( Class adapter )
|
||||||
{
|
{
|
||||||
|
if ( adapter.equals( CSourceManager.class ) )
|
||||||
|
return this;
|
||||||
if ( adapter.equals( IResourceChangeListener.class ) &&
|
if ( adapter.equals( IResourceChangeListener.class ) &&
|
||||||
fSourceLocator instanceof IResourceChangeListener )
|
fSourceLocator instanceof IResourceChangeListener )
|
||||||
return fSourceLocator;
|
return fSourceLocator;
|
||||||
|
@ -148,7 +152,12 @@ public class CSourceManager implements ICSourceLocator,
|
||||||
|
|
||||||
if ( getMode() == ISourceMode.MODE_SOURCE && getSourceLocator() != null )
|
if ( getMode() == ISourceMode.MODE_SOURCE && getSourceLocator() != null )
|
||||||
{
|
{
|
||||||
result = getSourceLocator().getSourceElement( stackFrame );
|
// if the target is suspended by a line breakpoint the source manager
|
||||||
|
// tries to retrieve the file resource from the breakpoint marker.
|
||||||
|
if ( getDebugTarget() != null )
|
||||||
|
result = getDebugTarget().getCurrentBreakpointFile();
|
||||||
|
if ( result == null )
|
||||||
|
result = getSourceLocator().getSourceElement( stackFrame );
|
||||||
}
|
}
|
||||||
if ( result == null &&
|
if ( result == null &&
|
||||||
( autoDisassembly || getMode() == ISourceMode.MODE_DISASSEMBLY ) &&
|
( autoDisassembly || getMode() == ISourceMode.MODE_DISASSEMBLY ) &&
|
||||||
|
@ -256,4 +265,14 @@ public class CSourceManager implements ICSourceLocator,
|
||||||
{
|
{
|
||||||
return ( getCSourceLocator() != null ) ? getCSourceLocator().getProject() : null;
|
return ( getCSourceLocator() != null ) ? getCSourceLocator().getProject() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDebugTarget( CDebugTarget target )
|
||||||
|
{
|
||||||
|
fDebugTarget = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CDebugTarget getDebugTarget()
|
||||||
|
{
|
||||||
|
return fDebugTarget;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue