mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-21 07:55:24 +02:00
Bug 118809: Failure to evaluate stack frame.
This commit is contained in:
parent
32d8ac98ea
commit
fff6cffa2d
2 changed files with 53 additions and 27 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2005-12-08 Mikhail Khodjaiants
|
||||||
|
Bug 118809: Failure to evaluate stack frame.
|
||||||
|
* CThread.java
|
||||||
|
|
||||||
2005-11-28 Mikhail Khodjaiants
|
2005-11-28 Mikhail Khodjaiants
|
||||||
Bug 118272: Invalid stack trace when stepping out of function.
|
Bug 118272: Invalid stack trace when stepping out of function.
|
||||||
* CThread.java
|
* CThread.java
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
|
||||||
fStackFrames = new ArrayList();
|
fStackFrames = new ArrayList();
|
||||||
}
|
}
|
||||||
else if ( refreshChildren ) {
|
else if ( refreshChildren ) {
|
||||||
// If the last frame is dummy remove it
|
// Remove dummy frame
|
||||||
if ( fStackFrames.size() > 0 ) {
|
if ( fStackFrames.size() > 0 ) {
|
||||||
Object frame = fStackFrames.get( fStackFrames.size() - 1 );
|
Object frame = fStackFrames.get( fStackFrames.size() - 1 );
|
||||||
if ( frame instanceof IDummyStackFrame ) {
|
if ( frame instanceof IDummyStackFrame ) {
|
||||||
|
@ -153,12 +153,22 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
|
||||||
// Retrieve stack frames from the backend
|
// Retrieve stack frames from the backend
|
||||||
int depth = getStackDepth();
|
int depth = getStackDepth();
|
||||||
ICDIStackFrame[] frames = ( depth != 0 ) ? getCDIStackFrames( 0, ( depth >= getMaxStackDepth() ) ? getMaxStackDepth() - 1 : depth ) : new ICDIStackFrame[0];
|
ICDIStackFrame[] frames = ( depth != 0 ) ? getCDIStackFrames( 0, ( depth >= getMaxStackDepth() ) ? getMaxStackDepth() - 1 : depth ) : new ICDIStackFrame[0];
|
||||||
|
|
||||||
if ( fStackFrames.isEmpty() ) {
|
if ( fStackFrames.isEmpty() ) {
|
||||||
if ( frames.length > 0 ) {
|
if ( frames.length > 0 ) {
|
||||||
addStackFrames( frames, 0, frames.length, false );
|
addStackFrames( frames, 0, frames.length, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( depth < getLastStackDepth() ) {
|
else {
|
||||||
|
int diff = depth - getLastStackDepth();
|
||||||
|
int offset = ( diff > 0 ) ? frames.length - diff : 0;
|
||||||
|
int length = ( diff > 0 ) ? diff : -diff;
|
||||||
|
if ( !compareStackFrames( frames, fStackFrames, offset, length ) ) {
|
||||||
|
// replace all frames
|
||||||
|
disposeStackFrames( 0, fStackFrames.size() );
|
||||||
|
addStackFrames( frames, 0, frames.length, false );
|
||||||
|
}
|
||||||
|
if ( diff < 0 ) {
|
||||||
// stepping out of the last frame
|
// stepping out of the last frame
|
||||||
disposeStackFrames( 0, getLastStackDepth() - depth );
|
disposeStackFrames( 0, getLastStackDepth() - depth );
|
||||||
if ( frames.length > 0 ) {
|
if ( frames.length > 0 ) {
|
||||||
|
@ -168,24 +178,15 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( depth > getLastStackDepth() ) {
|
else if ( diff > 0 ) {
|
||||||
// stepping into a new frame
|
// stepping into a new frame
|
||||||
disposeStackFrames( frames.length - depth + getLastStackDepth(), depth - getLastStackDepth() );
|
disposeStackFrames( frames.length - depth + getLastStackDepth(), depth - getLastStackDepth() );
|
||||||
addStackFrames( frames, 0, depth - getLastStackDepth(), false );
|
addStackFrames( frames, 0, depth - getLastStackDepth(), false );
|
||||||
updateStackFrames( frames, depth - getLastStackDepth(), fStackFrames, frames.length - depth + getLastStackDepth() );
|
updateStackFrames( frames, depth - getLastStackDepth(), fStackFrames, frames.length - depth + getLastStackDepth() );
|
||||||
}
|
}
|
||||||
else { // depth == getLastStackDepth()
|
else { // diff == 0
|
||||||
if ( depth != 0 ) {
|
if ( depth != 0 ) {
|
||||||
// same number of frames - if top frames are in different
|
// we are in the same frame
|
||||||
// function, replace all frames
|
|
||||||
ICDIStackFrame newTopFrame = (frames.length > 0) ? frames[0] : null;
|
|
||||||
ICDIStackFrame oldTopFrame = (fStackFrames.size() > 0) ? ((CStackFrame)fStackFrames.get( 0 )).getLastCDIStackFrame() : null;
|
|
||||||
if ( !CStackFrame.equalFrame( newTopFrame, oldTopFrame ) ) {
|
|
||||||
disposeStackFrames( 0, fStackFrames.size() );
|
|
||||||
addStackFrames( frames, 0, frames.length, false );
|
|
||||||
}
|
|
||||||
else // we are in the same frame
|
|
||||||
{
|
|
||||||
updateStackFrames( frames, 0, fStackFrames, frames.length );
|
updateStackFrames( frames, 0, fStackFrames, frames.length );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,6 +201,27 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
|
||||||
return fStackFrames;
|
return fStackFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares the lists of the old and new frames.
|
||||||
|
*
|
||||||
|
* @param newFrames the array of the new frames
|
||||||
|
* @param oldFrames the list of the old frames
|
||||||
|
* @param offset the offset in the new frames array
|
||||||
|
* @param length the number of frames to compare
|
||||||
|
*
|
||||||
|
* @return <code>true</code> if all frames are same
|
||||||
|
*/
|
||||||
|
private boolean compareStackFrames( ICDIStackFrame[] newFrames, List oldFrames, int offset, int length ) {
|
||||||
|
int index = offset;
|
||||||
|
Iterator it = oldFrames.iterator();
|
||||||
|
while( it.hasNext() && index < newFrames.length ) {
|
||||||
|
CStackFrame frame = (CStackFrame)it.next();
|
||||||
|
if ( !frame.getCDIStackFrame().equals( newFrames[index++] ) )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves and returns all underlying stack frames
|
* Retrieves and returns all underlying stack frames
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue