Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Partial fix for bug 25956

Partial fix for bug 25956.

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/ChangeLog,v
retrieving revision 1.53
diff -u -r1.53 ChangeLog
--- ChangeLog 16 Nov 2002 00:48:31 -0000 1.53
+++ ChangeLog 19 Nov 2002 22:53:30 -0000
@@ -1,4 +1,8 @@
 2002-11-15 Mikhail Khodjaiants
+ Partial fix for bug 25956.
+ * DisassemblyManager.java: Filter out the instructions that do not belong to the function.
+
+2002-11-15 Mikhail Khodjaiants
  If the backtrace is very deep the debugger is unable to parse MI output.
  The limited number of stack frames will be displayed.
  * IDummyStackFrame.java
Index: src/org/eclipse/cdt/debug/internal/core/sourcelookup/DisassemblyManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/DisassemblyManager.java,v
retrieving revision 1.4
diff -u -r1.4 DisassemblyManager.java
--- src/org/eclipse/cdt/debug/internal/core/sourcelookup/DisassemblyManager.java 10 Oct 2002 18:36:07 -0000 1.4
+++ src/org/eclipse/cdt/debug/internal/core/sourcelookup/DisassemblyManager.java 19 Nov 2002 22:53:30 -0000
@@ -6,6 +6,8 @@
 
 package org.eclipse.cdt.debug.internal.core.sourcelookup;
 
+import java.util.ArrayList;
+
 import org.eclipse.cdt.debug.core.CDebugCorePlugin;
 import org.eclipse.cdt.debug.core.IStackFrameInfo;
 import org.eclipse.cdt.debug.core.cdi.CDIException;
@@ -105,12 +107,15 @@
     String fileName = frameInfo.getFile();
     int lineNumber = frameInfo.getFrameLineNumber();
     ICDIInstruction[] instructions = new ICDIInstruction[0];
-    try
-    {
-     instructions = sm.getInstructions( fileName, lineNumber, DISASSEMBLY_MAX_LINE_COUNT );
-    }
-    catch( CDIException e )
+    if ( fileName != null && fileName.length() > 0 )
     {
+     try
+     {
+      instructions = sm.getInstructions( fileName, lineNumber, DISASSEMBLY_MAX_LINE_COUNT );
+     }
+     catch( CDIException e )
+     {
+     }
     }
     if ( instructions.length == 0 )
     {
@@ -119,7 +124,7 @@
      {
       try
       {
-       instructions = sm.getInstructions( address, address + DISASSEMBLY_BLOCK_SIZE );
+       instructions = getFunctionInstructions( sm.getInstructions( address, address + DISASSEMBLY_BLOCK_SIZE ) );
       }
       catch( CDIException e )
       {
@@ -134,5 +139,25 @@
    }
   }
   return getDisassemblyStorage();
+ }

+ private ICDIInstruction[] getFunctionInstructions( ICDIInstruction[] rawInstructions )
+ {
+  if ( rawInstructions.length > 0 &&
+    rawInstructions[0].getFuntionName() != null &&
+    rawInstructions[0].getFuntionName().length() > 0 )
+  {
+   ArrayList list = new ArrayList( rawInstructions.length );
+   list.add( rawInstructions[0] );
+   for ( int i = 1; i < rawInstructions.length; ++i )
+   {
+    if ( rawInstructions[0].getFuntionName().equals( rawInstructions[i].getFuntionName() ) )
+    {
+     list.add( rawInstructions[i] );
+    }
+   }
+   return (ICDIInstruction[])list.toArray( new ICDIInstruction[list.size()] );
+  }
+  return rawInstructions;
  }
 }


Back to the top