1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 14:15:23 +02:00

Retry to set breakpoints if shared library's symbols are loaded.

This commit is contained in:
Mikhail Khodjaiants 2003-01-21 19:37:27 +00:00
parent c36bf37cb1
commit 7e6802e6e5
4 changed files with 47 additions and 10 deletions

View file

@ -1,3 +1,9 @@
2003-01-21 Mikhail Khodjaiants
Retry to set breakpoints if shared library's symbols are loaded.
* CDebugTarget.java
* CThread.java
* CSharedLibraryManager.java
2003-01-20 Mikhail Khodjaiants
Fix for the 'Show breakpoints supported by selected target' action.
* CDebugTarget.java

View file

@ -67,6 +67,7 @@ public class CSharedLibraryManager implements ICSharedLibraryManager
CSharedLibrary library = find( cdiLibrary );
if ( library != null )
{
((CDebugTarget)getDebugTarget()).setRetryBreakpoints( true );
library.fireChangeEvent( DebugEvent.STATE );
}
}

View file

@ -236,6 +236,12 @@ public class CDebugTarget extends CDebugElement
*/
private IFile fExecFile;
/**
* If is set to 'true' the debugger will try to set breakpoints on
* the next resume or step call.
*/
private boolean fSetBreakpoints = true;
/**
* Constructor for CDebugTarget.
* @param target
@ -257,7 +263,7 @@ public class CDebugTarget extends CDebugElement
setName( name );
setProcesses( debuggeeProcess, debuggerProcess );
setCDITarget( cdiTarget );
setBreakpoints( new HashMap( 5 ) );
initializeBreakpoints( new HashMap( 5 ) );
setExecFile( file );
setConfiguration( cdiTarget.getSession().getConfiguration() );
fSupportsTerminate = allowsTerminate & getConfiguration().supportsTerminate();
@ -279,7 +285,7 @@ public class CDebugTarget extends CDebugElement
{
initializeState();
setSourceSearchPath();
initializeBreakpoints();
setBreakpoints();
initializeRegisters();
initializeMemoryManager();
getLaunch().addDebugTarget( this );
@ -310,17 +316,21 @@ public class CDebugTarget extends CDebugElement
* the breakpoint manager.
*
*/
protected void initializeBreakpoints()
protected void setBreakpoints()
{
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
manager.addBreakpointListener( this );
IBreakpoint[] bps = (IBreakpoint[])manager.getBreakpoints( CDebugModel.getPluginIdentifier() );
for ( int i = 0; i < bps.length; i++ )
if ( getRetryBreakpoints() )
{
if ( bps[i] instanceof ICBreakpoint )
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
manager.addBreakpointListener( this );
IBreakpoint[] bps = (IBreakpoint[])manager.getBreakpoints( CDebugModel.getPluginIdentifier() );
for ( int i = 0; i < bps.length; i++ )
{
breakpointAdded( (ICBreakpoint)bps[i] );
if ( bps[i] instanceof ICBreakpoint && findCDIBreakpoint( bps[i] ) == null )
{
breakpointAdded( (ICBreakpoint)bps[i] );
}
}
setRetryBreakpoints( false );
}
}
@ -528,6 +538,7 @@ public class CDebugTarget extends CDebugElement
{
if ( !isSuspended() )
return;
setBreakpoints();
try
{
getCDITarget().resume();
@ -887,6 +898,8 @@ public class CDebugTarget extends CDebugElement
if ( source instanceof ICDISharedLibrary )
{
getSharedLibraryManager().sharedLibraryLoaded( (ICDISharedLibrary)source );
if ( ((ICDISharedLibrary)source).areSymbolsLoaded() )
setRetryBreakpoints( true );
}
}
else if ( event instanceof ICDISuspendedEvent )
@ -1575,7 +1588,7 @@ public class CDebugTarget extends CDebugElement
*
* @param breakpoints breakpoints map
*/
private void setBreakpoints( HashMap breakpoints )
private void initializeBreakpoints( HashMap breakpoints )
{
fBreakpoints = breakpoints;
}
@ -1834,6 +1847,7 @@ public class CDebugTarget extends CDebugElement
{
if ( !canRunToLine( resource, lineNumber ) )
return;
setBreakpoints();
ICDILocation location = getCDISession().getBreakpointManager().createLocation( resource.getLocation().lastSegment(), null, lineNumber );
try
{
@ -2139,6 +2153,7 @@ public class CDebugTarget extends CDebugElement
{
if ( !canRunToAddress( address ) )
return;
setBreakpoints();
ICDILocation location = getCDISession().getBreakpointManager().createLocation( address );
try
{
@ -2149,4 +2164,14 @@ public class CDebugTarget extends CDebugElement
targetRequestFailed( e.toString(), e );
}
}
private boolean getRetryBreakpoints()
{
return fSetBreakpoints;
}
public void setRetryBreakpoints( boolean retry )
{
fSetBreakpoints = retry;
}
}

View file

@ -585,6 +585,7 @@ public class CThread extends CDebugElement
{
if ( !canStepInto() )
return;
((CDebugTarget)getDebugTarget()).setBreakpoints();
try
{
if ( getRealSourceMode() == ISourceMode.MODE_SOURCE )
@ -609,6 +610,7 @@ public class CThread extends CDebugElement
{
if ( !canStepOver() )
return;
((CDebugTarget)getDebugTarget()).setBreakpoints();
try
{
if ( getRealSourceMode() == ISourceMode.MODE_SOURCE )
@ -633,6 +635,7 @@ public class CThread extends CDebugElement
{
if ( !canStepReturn() )
return;
((CDebugTarget)getDebugTarget()).setBreakpoints();
try
{
getCDIThread().stepReturn();
@ -834,6 +837,7 @@ public class CThread extends CDebugElement
{
if ( !canStepIntoInstruction() )
return;
((CDebugTarget)getDebugTarget()).setBreakpoints();
try
{
getCDIThread().stepIntoInstruction();
@ -851,6 +855,7 @@ public class CThread extends CDebugElement
{
if ( !canStepOverInstruction() )
return;
((CDebugTarget)getDebugTarget()).setBreakpoints();
try
{
getCDIThread().stepOverInstruction();