Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Retry to set breakpoints if shared library's symbols are loaded

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/ChangeLog,v
retrieving revision 1.104
diff -u -r1.104 ChangeLog
--- ChangeLog 20 Jan 2003 23:23:20 -0000 1.104
+++ ChangeLog 21 Jan 2003 19:36:41 -0000
@@ -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
Index: src/org/eclipse/cdt/debug/internal/core/CSharedLibraryManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CSharedLibraryManager.java,v
retrieving revision 1.1
diff -u -r1.1 CSharedLibraryManager.java
--- src/org/eclipse/cdt/debug/internal/core/CSharedLibraryManager.java 17 Jan 2003 00:15:10 -0000 1.1
+++ src/org/eclipse/cdt/debug/internal/core/CSharedLibraryManager.java 21 Jan 2003 19:36:42 -0000
@@ -67,6 +67,7 @@
   CSharedLibrary library = find( cdiLibrary );
   if ( library != null )
   {
+   ((CDebugTarget)getDebugTarget()).setRetryBreakpoints( true );
    library.fireChangeEvent( DebugEvent.STATE );
   }
  }
Index: src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java,v
retrieving revision 1.71
diff -u -r1.71 CDebugTarget.java
--- src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java 20 Jan 2003 23:23:20 -0000 1.71
+++ src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java 21 Jan 2003 19:36:42 -0000
@@ -237,6 +237,12 @@
  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 @@
   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 @@
  {
   initializeState();
   setSourceSearchPath();
-  initializeBreakpoints();
+  setBreakpoints();
   initializeRegisters();
   initializeMemoryManager();
   getLaunch().addDebugTarget( this );
@@ -310,17 +316,21 @@
   * 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 @@
  {
   if ( !isSuspended() )
    return;
+  setBreakpoints();
   try
   {
    getCDITarget().resume();
@@ -887,6 +898,8 @@
     if ( source instanceof ICDISharedLibrary )
     {
      getSharedLibraryManager().sharedLibraryLoaded( (ICDISharedLibrary)source );
+     if ( ((ICDISharedLibrary)source).areSymbolsLoaded() )
+      setRetryBreakpoints( true );
     }
    }
    else if ( event instanceof ICDISuspendedEvent )
@@ -1575,7 +1588,7 @@
   *
   * @param breakpoints breakpoints map
   */
- private void setBreakpoints( HashMap breakpoints )
+ private void initializeBreakpoints( HashMap breakpoints )
  {
   fBreakpoints = breakpoints;
  }
@@ -1834,6 +1847,7 @@
  {
   if ( !canRunToLine( resource, lineNumber ) )
    return;
+  setBreakpoints();
   ICDILocation location = getCDISession().getBreakpointManager().createLocation( resource.getLocation().lastSegment(), null, lineNumber );
   try
   {
@@ -2139,6 +2153,7 @@
  {
   if ( !canRunToAddress( address ) )
    return;
+  setBreakpoints();
   ICDILocation location = getCDISession().getBreakpointManager().createLocation( address );
   try
   {
@@ -2148,5 +2163,15 @@
   {
    targetRequestFailed( e.toString(), e );
   }
+ }

+ private boolean getRetryBreakpoints()
+ {
+  return fSetBreakpoints;
+ }
+
+ public void setRetryBreakpoints( boolean retry )
+ {
+  fSetBreakpoints = retry;
  }
 }
Index: src/org/eclipse/cdt/debug/internal/core/model/CThread.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CThread.java,v
retrieving revision 1.22
diff -u -r1.22 CThread.java
--- src/org/eclipse/cdt/debug/internal/core/model/CThread.java 14 Jan 2003 22:26:53 -0000 1.22
+++ src/org/eclipse/cdt/debug/internal/core/model/CThread.java 21 Jan 2003 19:36:42 -0000
@@ -585,6 +585,7 @@
  {
   if ( !canStepInto() )
    return;
+  ((CDebugTarget)getDebugTarget()).setBreakpoints();
   try
   {
    if ( getRealSourceMode() == ISourceMode.MODE_SOURCE )
@@ -609,6 +610,7 @@
  {
   if ( !canStepOver() )
    return;
+  ((CDebugTarget)getDebugTarget()).setBreakpoints();
   try
   {
    if ( getRealSourceMode() == ISourceMode.MODE_SOURCE )
@@ -633,6 +635,7 @@
  {
   if ( !canStepReturn() )
    return;
+  ((CDebugTarget)getDebugTarget()).setBreakpoints();
   try
   {
    getCDIThread().stepReturn();
@@ -834,6 +837,7 @@
  {
   if ( !canStepIntoInstruction() )
    return;
+  ((CDebugTarget)getDebugTarget()).setBreakpoints();
   try
   {
    getCDIThread().stepIntoInstruction();
@@ -851,6 +855,7 @@
  {
   if ( !canStepOverInstruction() )
    return;
+  ((CDebugTarget)getDebugTarget()).setBreakpoints();
   try
   {
    getCDIThread().stepOverInstruction();

Back to the top