mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-11 02:05:39 +02:00
Bug 118272: Invalid stack trace when stepping out of function.
This commit is contained in:
parent
e10de4fc65
commit
a7d1231811
2 changed files with 18 additions and 7 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2005-11-28 Mikhail Khodjaiants
|
||||||
|
Bug 118272: Invalid stack trace when stepping out of function.
|
||||||
|
* CThread.java
|
||||||
|
|
||||||
2005-11-07 Mikhail Khodjaiants
|
2005-11-07 Mikhail Khodjaiants
|
||||||
Bug 115385: Pointer to a structure is not updated correctly
|
Bug 115385: Pointer to a structure is not updated correctly
|
||||||
* CVariable.java
|
* CVariable.java
|
||||||
|
|
|
@ -143,31 +143,35 @@ 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
|
||||||
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 ) {
|
||||||
fStackFrames.remove( frame );
|
fStackFrames.remove( frame );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Retrieve stack frames from the backend
|
||||||
int depth = getStackDepth();
|
int depth = getStackDepth();
|
||||||
ICDIStackFrame[] frames = (depth != 0) ? getCDIStackFrames( 0, (depth > getMaxStackDepth()) ? getMaxStackDepth() : 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 );
|
addStackFrames( frames, 0, frames.length, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( depth < getLastStackDepth() ) {
|
else if ( depth < getLastStackDepth() ) {
|
||||||
|
// stepping out of the last frame
|
||||||
disposeStackFrames( 0, getLastStackDepth() - depth );
|
disposeStackFrames( 0, getLastStackDepth() - depth );
|
||||||
if ( frames.length > 0 ) {
|
if ( frames.length > 0 ) {
|
||||||
updateStackFrames( frames, 0, fStackFrames, fStackFrames.size() );
|
updateStackFrames( frames, 0, fStackFrames, fStackFrames.size() );
|
||||||
if ( fStackFrames.size() < frames.length ) {
|
if ( fStackFrames.size() < frames.length ) {
|
||||||
addStackFrames( frames, fStackFrames.size(), frames.length - fStackFrames.size() );
|
addStackFrames( frames, fStackFrames.size(), frames.length - fStackFrames.size(), true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( depth > getLastStackDepth() ) {
|
else if ( depth > getLastStackDepth() ) {
|
||||||
|
// stepping into a new frame
|
||||||
disposeStackFrames( frames.length - depth + getLastStackDepth(), depth - getLastStackDepth() );
|
disposeStackFrames( frames.length - depth + getLastStackDepth(), depth - getLastStackDepth() );
|
||||||
addStackFrames( frames, 0, depth - getLastStackDepth() );
|
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 { // depth == getLastStackDepth()
|
||||||
|
@ -178,7 +182,7 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
|
||||||
ICDIStackFrame oldTopFrame = (fStackFrames.size() > 0) ? ((CStackFrame)fStackFrames.get( 0 )).getLastCDIStackFrame() : null;
|
ICDIStackFrame oldTopFrame = (fStackFrames.size() > 0) ? ((CStackFrame)fStackFrames.get( 0 )).getLastCDIStackFrame() : null;
|
||||||
if ( !CStackFrame.equalFrame( newTopFrame, oldTopFrame ) ) {
|
if ( !CStackFrame.equalFrame( newTopFrame, oldTopFrame ) ) {
|
||||||
disposeStackFrames( 0, fStackFrames.size() );
|
disposeStackFrames( 0, fStackFrames.size() );
|
||||||
addStackFrames( frames, 0, frames.length );
|
addStackFrames( frames, 0, frames.length, false );
|
||||||
}
|
}
|
||||||
else // we are in the same frame
|
else // we are in the same frame
|
||||||
{
|
{
|
||||||
|
@ -245,9 +249,12 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addStackFrames( ICDIStackFrame[] newFrames, int startIndex, int length ) {
|
protected void addStackFrames( ICDIStackFrame[] newFrames, int startIndex, int length, boolean append ) {
|
||||||
if ( newFrames.length >= startIndex + length ) {
|
if ( newFrames.length >= startIndex + length ) {
|
||||||
for( int i = 0; i < length; ++i ) {
|
for( int i = 0; i < length; ++i ) {
|
||||||
|
if ( append )
|
||||||
|
fStackFrames.add( new CStackFrame( this, newFrames[startIndex + i] ) );
|
||||||
|
else
|
||||||
fStackFrames.add( i, new CStackFrame( this, newFrames[startIndex + i] ) );
|
fStackFrames.add( i, new CStackFrame( this, newFrames[startIndex + i] ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue