1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-28 19:35:36 +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 2003-01-20 Mikhail Khodjaiants
Fix for the 'Show breakpoints supported by selected target' action. Fix for the 'Show breakpoints supported by selected target' action.
* CDebugTarget.java * CDebugTarget.java

View file

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

View file

@ -236,6 +236,12 @@ public class CDebugTarget extends CDebugElement
*/ */
private IFile fExecFile; 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. * Constructor for CDebugTarget.
* @param target * @param target
@ -257,7 +263,7 @@ public class CDebugTarget extends CDebugElement
setName( name ); setName( name );
setProcesses( debuggeeProcess, debuggerProcess ); setProcesses( debuggeeProcess, debuggerProcess );
setCDITarget( cdiTarget ); setCDITarget( cdiTarget );
setBreakpoints( new HashMap( 5 ) ); initializeBreakpoints( new HashMap( 5 ) );
setExecFile( file ); setExecFile( file );
setConfiguration( cdiTarget.getSession().getConfiguration() ); setConfiguration( cdiTarget.getSession().getConfiguration() );
fSupportsTerminate = allowsTerminate & getConfiguration().supportsTerminate(); fSupportsTerminate = allowsTerminate & getConfiguration().supportsTerminate();
@ -279,7 +285,7 @@ public class CDebugTarget extends CDebugElement
{ {
initializeState(); initializeState();
setSourceSearchPath(); setSourceSearchPath();
initializeBreakpoints(); setBreakpoints();
initializeRegisters(); initializeRegisters();
initializeMemoryManager(); initializeMemoryManager();
getLaunch().addDebugTarget( this ); getLaunch().addDebugTarget( this );
@ -310,17 +316,21 @@ public class CDebugTarget extends CDebugElement
* the breakpoint manager. * the breakpoint manager.
* *
*/ */
protected void initializeBreakpoints() protected void setBreakpoints()
{ {
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager(); if ( getRetryBreakpoints() )
manager.addBreakpointListener( this );
IBreakpoint[] bps = (IBreakpoint[])manager.getBreakpoints( CDebugModel.getPluginIdentifier() );
for ( int i = 0; i < bps.length; i++ )
{ {
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() ) if ( !isSuspended() )
return; return;
setBreakpoints();
try try
{ {
getCDITarget().resume(); getCDITarget().resume();
@ -887,6 +898,8 @@ public class CDebugTarget extends CDebugElement
if ( source instanceof ICDISharedLibrary ) if ( source instanceof ICDISharedLibrary )
{ {
getSharedLibraryManager().sharedLibraryLoaded( (ICDISharedLibrary)source ); getSharedLibraryManager().sharedLibraryLoaded( (ICDISharedLibrary)source );
if ( ((ICDISharedLibrary)source).areSymbolsLoaded() )
setRetryBreakpoints( true );
} }
} }
else if ( event instanceof ICDISuspendedEvent ) else if ( event instanceof ICDISuspendedEvent )
@ -1575,7 +1588,7 @@ public class CDebugTarget extends CDebugElement
* *
* @param breakpoints breakpoints map * @param breakpoints breakpoints map
*/ */
private void setBreakpoints( HashMap breakpoints ) private void initializeBreakpoints( HashMap breakpoints )
{ {
fBreakpoints = breakpoints; fBreakpoints = breakpoints;
} }
@ -1834,6 +1847,7 @@ public class CDebugTarget extends CDebugElement
{ {
if ( !canRunToLine( resource, lineNumber ) ) if ( !canRunToLine( resource, lineNumber ) )
return; return;
setBreakpoints();
ICDILocation location = getCDISession().getBreakpointManager().createLocation( resource.getLocation().lastSegment(), null, lineNumber ); ICDILocation location = getCDISession().getBreakpointManager().createLocation( resource.getLocation().lastSegment(), null, lineNumber );
try try
{ {
@ -2139,6 +2153,7 @@ public class CDebugTarget extends CDebugElement
{ {
if ( !canRunToAddress( address ) ) if ( !canRunToAddress( address ) )
return; return;
setBreakpoints();
ICDILocation location = getCDISession().getBreakpointManager().createLocation( address ); ICDILocation location = getCDISession().getBreakpointManager().createLocation( address );
try try
{ {
@ -2149,4 +2164,14 @@ public class CDebugTarget extends CDebugElement
targetRequestFailed( e.toString(), e ); 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() ) if ( !canStepInto() )
return; return;
((CDebugTarget)getDebugTarget()).setBreakpoints();
try try
{ {
if ( getRealSourceMode() == ISourceMode.MODE_SOURCE ) if ( getRealSourceMode() == ISourceMode.MODE_SOURCE )
@ -609,6 +610,7 @@ public class CThread extends CDebugElement
{ {
if ( !canStepOver() ) if ( !canStepOver() )
return; return;
((CDebugTarget)getDebugTarget()).setBreakpoints();
try try
{ {
if ( getRealSourceMode() == ISourceMode.MODE_SOURCE ) if ( getRealSourceMode() == ISourceMode.MODE_SOURCE )
@ -633,6 +635,7 @@ public class CThread extends CDebugElement
{ {
if ( !canStepReturn() ) if ( !canStepReturn() )
return; return;
((CDebugTarget)getDebugTarget()).setBreakpoints();
try try
{ {
getCDIThread().stepReturn(); getCDIThread().stepReturn();
@ -834,6 +837,7 @@ public class CThread extends CDebugElement
{ {
if ( !canStepIntoInstruction() ) if ( !canStepIntoInstruction() )
return; return;
((CDebugTarget)getDebugTarget()).setBreakpoints();
try try
{ {
getCDIThread().stepIntoInstruction(); getCDIThread().stepIntoInstruction();
@ -851,6 +855,7 @@ public class CThread extends CDebugElement
{ {
if ( !canStepOverInstruction() ) if ( !canStepOverInstruction() )
return; return;
((CDebugTarget)getDebugTarget()).setBreakpoints();
try try
{ {
getCDIThread().stepOverInstruction(); getCDIThread().stepOverInstruction();