1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-17 05:05:43 +02:00

The registers with errors shouldn't be disposed when the target is suspended. Added synchronization to the "getRegisters" method.

This commit is contained in:
Mikhail Khodjaiants 2005-07-29 19:24:19 +00:00
parent a644748bb8
commit c16a83969c
2 changed files with 14 additions and 6 deletions

View file

@ -1,3 +1,8 @@
2005-07-29 Mikhail Khodjaiants
The registers with errors shouldn't be disposed when the target is suspended.
Added synchronization to the "getRegisters" method.
* CRegisterGroup.java
2005-07-28 Mikhail Khodjaiants 2005-07-28 Mikhail Khodjaiants
Bug 104421: Register view can not show correct value when switch between different thread or stack frame. Bug 104421: Register view can not show correct value when switch between different thread or stack frame.
* ICDIRegister.java * ICDIRegister.java

View file

@ -79,12 +79,16 @@ public class CRegisterGroup extends CDebugElement implements IPersistableRegiste
public IRegister[] getRegisters() throws DebugException { public IRegister[] getRegisters() throws DebugException {
if ( fDisposed ) if ( fDisposed )
return new IRegister[0]; return new IRegister[0];
if ( fRegisters == null ) {
synchronized( this ) {
if ( fRegisters == null ) { if ( fRegisters == null ) {
fRegisters = new IRegister[fRegisterDescriptors.length]; fRegisters = new IRegister[fRegisterDescriptors.length];
for( int i = 0; i < fRegisters.length; ++i ) { for( int i = 0; i < fRegisters.length; ++i ) {
fRegisters[i] = new CRegister( this, fRegisterDescriptors[i] ); fRegisters[i] = new CRegister( this, fRegisterDescriptors[i] );
} }
} }
}
}
return fRegisters; return fRegisters;
} }
@ -101,13 +105,12 @@ public class CRegisterGroup extends CDebugElement implements IPersistableRegiste
} }
public void targetSuspended() { public void targetSuspended() {
if (fRegisters == null) { if ( fRegisters == null ) {
return; return;
} }
for ( int i = 0; i < fRegisters.length; ++i ) { for ( int i = 0; i < fRegisters.length; ++i ) {
if ( fRegisters[i] != null && ((CRegister)fRegisters[i]).hasErrors() ) { if ( fRegisters[i] != null && ((CRegister)fRegisters[i]).hasErrors() ) {
((CRegister)fRegisters[i]).dispose(); ((CRegister)fRegisters[i]).resetStatus();
fRegisters[i] = null;
} }
} }
} }