1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 18:56:02 +02:00

Partial fix for bug 25956. Filter out the instructions that do not belong to the current function.

This commit is contained in:
Mikhail Khodjaiants 2002-11-19 22:55:00 +00:00
parent a0eb6d4b36
commit 22b835c277
2 changed files with 35 additions and 6 deletions

View file

@ -1,3 +1,7 @@
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 2002-11-15 Mikhail Khodjaiants
If the backtrace is very deep the debugger is unable to parse MI output. If the backtrace is very deep the debugger is unable to parse MI output.
The limited number of stack frames will be displayed. The limited number of stack frames will be displayed.

View file

@ -6,6 +6,8 @@
package org.eclipse.cdt.debug.internal.core.sourcelookup; 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.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.IStackFrameInfo; import org.eclipse.cdt.debug.core.IStackFrameInfo;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
@ -105,6 +107,8 @@ public class DisassemblyManager
String fileName = frameInfo.getFile(); String fileName = frameInfo.getFile();
int lineNumber = frameInfo.getFrameLineNumber(); int lineNumber = frameInfo.getFrameLineNumber();
ICDIInstruction[] instructions = new ICDIInstruction[0]; ICDIInstruction[] instructions = new ICDIInstruction[0];
if ( fileName != null && fileName.length() > 0 )
{
try try
{ {
instructions = sm.getInstructions( fileName, lineNumber, DISASSEMBLY_MAX_LINE_COUNT ); instructions = sm.getInstructions( fileName, lineNumber, DISASSEMBLY_MAX_LINE_COUNT );
@ -112,6 +116,7 @@ public class DisassemblyManager
catch( CDIException e ) catch( CDIException e )
{ {
} }
}
if ( instructions.length == 0 ) if ( instructions.length == 0 )
{ {
long address = frameInfo.getAddress(); long address = frameInfo.getAddress();
@ -119,7 +124,7 @@ public class DisassemblyManager
{ {
try try
{ {
instructions = sm.getInstructions( address, address + DISASSEMBLY_BLOCK_SIZE ); instructions = getFunctionInstructions( sm.getInstructions( address, address + DISASSEMBLY_BLOCK_SIZE ) );
} }
catch( CDIException e ) catch( CDIException e )
{ {
@ -135,4 +140,24 @@ public class DisassemblyManager
} }
return getDisassemblyStorage(); 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;
}
} }