1
0
Fork 0
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:
Mikhail Khodjaiants 2010-04-17 21:42:13 +00:00
parent f2876e9a5c
commit a67b587f77
2 changed files with 42 additions and 21 deletions

View file

@ -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;
@ -69,6 +70,10 @@ public class CRegisterManager {
private CStackFrame fCurrentFrame;
private ReentrantLock fInitializationLock = new ReentrantLock();
private boolean fInitialized = false;
/**
* Constructor for CRegisterManager.
*/
@ -123,14 +128,19 @@ public class CRegisterManager {
}
public void initialize() {
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 list = new ArrayList();
List<CRegisterDescriptor> list = new ArrayList<CRegisterDescriptor>();
for( int i = 0; i < groups.length; ++i ) {
try {
ICDIRegisterDescriptor[] cdiDescriptors = groups[i].getRegisterDescriptors();
@ -140,11 +150,19 @@ public class CRegisterManager {
}
catch( CDIException e ) {
CDebugCorePlugin.log( e );
failed = true;
}
}
fRegisterDescriptors = (IRegisterDescriptor[])list.toArray( new IRegisterDescriptor[list.size()] );
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 ) {
DebugPlugin.getDefault().asyncExec(

View file

@ -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;
}