mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 309212: No registers with HEAD. Workaround for gdb 7.0.
This commit is contained in:
parent
f2876e9a5c
commit
a67b587f77
2 changed files with 42 additions and 21 deletions
|
@ -15,6 +15,7 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||
|
@ -68,6 +69,10 @@ public class CRegisterManager {
|
|||
private boolean fUseDefaultRegisterGroups = true;
|
||||
|
||||
private CStackFrame fCurrentFrame;
|
||||
|
||||
private ReentrantLock fInitializationLock = new ReentrantLock();
|
||||
|
||||
private boolean fInitialized = false;
|
||||
|
||||
/**
|
||||
* Constructor for CRegisterManager.
|
||||
|
@ -123,27 +128,40 @@ public class CRegisterManager {
|
|||
}
|
||||
|
||||
public void initialize() {
|
||||
ICDIRegisterGroup[] groups = new ICDIRegisterGroup[0];
|
||||
try {
|
||||
groups = getDebugTarget().getCDITarget().getRegisterGroups();
|
||||
}
|
||||
catch( CDIException e ) {
|
||||
CDebugCorePlugin.log( e );
|
||||
}
|
||||
List list = new ArrayList();
|
||||
for( int i = 0; i < groups.length; ++i ) {
|
||||
try {
|
||||
ICDIRegisterDescriptor[] cdiDescriptors = groups[i].getRegisterDescriptors();
|
||||
for ( int j = 0; j < cdiDescriptors.length; ++j ) {
|
||||
list.add( new CRegisterDescriptor( groups[i], cdiDescriptors[j] ) );
|
||||
}
|
||||
}
|
||||
catch( CDIException e ) {
|
||||
CDebugCorePlugin.log( e );
|
||||
}
|
||||
}
|
||||
fRegisterDescriptors = (IRegisterDescriptor[])list.toArray( new IRegisterDescriptor[list.size()] );
|
||||
createRegisterGroups();
|
||||
if ( !fInitialized ) {
|
||||
synchronized( fInitializationLock ) {
|
||||
if ( !fInitialized ) {
|
||||
boolean failed = false;
|
||||
ICDIRegisterGroup[] groups = new ICDIRegisterGroup[0];
|
||||
try {
|
||||
groups = getDebugTarget().getCDITarget().getRegisterGroups();
|
||||
}
|
||||
catch( CDIException e ) {
|
||||
CDebugCorePlugin.log( e );
|
||||
failed = true;
|
||||
}
|
||||
List<CRegisterDescriptor> list = new ArrayList<CRegisterDescriptor>();
|
||||
for( int i = 0; i < groups.length; ++i ) {
|
||||
try {
|
||||
ICDIRegisterDescriptor[] cdiDescriptors = groups[i].getRegisterDescriptors();
|
||||
for ( int j = 0; j < cdiDescriptors.length; ++j ) {
|
||||
list.add( new CRegisterDescriptor( groups[i], cdiDescriptors[j] ) );
|
||||
}
|
||||
}
|
||||
catch( CDIException e ) {
|
||||
CDebugCorePlugin.log( e );
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
fRegisterDescriptors = list.toArray( new IRegisterDescriptor[list.size()] );
|
||||
fInitialized = !failed;
|
||||
if ( failed )
|
||||
fRegisterGroups = Collections.emptyList();
|
||||
else
|
||||
createRegisterGroups();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addRegisterGroup( final String name, final IRegisterDescriptor[] descriptors ) {
|
||||
|
|
|
@ -1563,6 +1563,9 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
|||
}
|
||||
|
||||
public CRegisterManager getRegisterManager() {
|
||||
// Workaround for bug #309212. gdb 7.0 returns "No registers" error
|
||||
// at the beginning of the session.
|
||||
fRegisterManager.initialize();
|
||||
return fRegisterManager;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue