mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 08:46:02 +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.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||||
|
@ -68,6 +69,10 @@ public class CRegisterManager {
|
||||||
private boolean fUseDefaultRegisterGroups = true;
|
private boolean fUseDefaultRegisterGroups = true;
|
||||||
|
|
||||||
private CStackFrame fCurrentFrame;
|
private CStackFrame fCurrentFrame;
|
||||||
|
|
||||||
|
private ReentrantLock fInitializationLock = new ReentrantLock();
|
||||||
|
|
||||||
|
private boolean fInitialized = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for CRegisterManager.
|
* Constructor for CRegisterManager.
|
||||||
|
@ -123,27 +128,40 @@ public class CRegisterManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
ICDIRegisterGroup[] groups = new ICDIRegisterGroup[0];
|
if ( !fInitialized ) {
|
||||||
try {
|
synchronized( fInitializationLock ) {
|
||||||
groups = getDebugTarget().getCDITarget().getRegisterGroups();
|
if ( !fInitialized ) {
|
||||||
}
|
boolean failed = false;
|
||||||
catch( CDIException e ) {
|
ICDIRegisterGroup[] groups = new ICDIRegisterGroup[0];
|
||||||
CDebugCorePlugin.log( e );
|
try {
|
||||||
}
|
groups = getDebugTarget().getCDITarget().getRegisterGroups();
|
||||||
List list = new ArrayList();
|
}
|
||||||
for( int i = 0; i < groups.length; ++i ) {
|
catch( CDIException e ) {
|
||||||
try {
|
CDebugCorePlugin.log( e );
|
||||||
ICDIRegisterDescriptor[] cdiDescriptors = groups[i].getRegisterDescriptors();
|
failed = true;
|
||||||
for ( int j = 0; j < cdiDescriptors.length; ++j ) {
|
}
|
||||||
list.add( new CRegisterDescriptor( groups[i], cdiDescriptors[j] ) );
|
List<CRegisterDescriptor> list = new ArrayList<CRegisterDescriptor>();
|
||||||
}
|
for( int i = 0; i < groups.length; ++i ) {
|
||||||
}
|
try {
|
||||||
catch( CDIException e ) {
|
ICDIRegisterDescriptor[] cdiDescriptors = groups[i].getRegisterDescriptors();
|
||||||
CDebugCorePlugin.log( e );
|
for ( int j = 0; j < cdiDescriptors.length; ++j ) {
|
||||||
}
|
list.add( new CRegisterDescriptor( groups[i], cdiDescriptors[j] ) );
|
||||||
}
|
}
|
||||||
fRegisterDescriptors = (IRegisterDescriptor[])list.toArray( new IRegisterDescriptor[list.size()] );
|
}
|
||||||
createRegisterGroups();
|
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 ) {
|
public void addRegisterGroup( final String name, final IRegisterDescriptor[] descriptors ) {
|
||||||
|
|
|
@ -1563,6 +1563,9 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
}
|
}
|
||||||
|
|
||||||
public CRegisterManager getRegisterManager() {
|
public CRegisterManager getRegisterManager() {
|
||||||
|
// Workaround for bug #309212. gdb 7.0 returns "No registers" error
|
||||||
|
// at the beginning of the session.
|
||||||
|
fRegisterManager.initialize();
|
||||||
return fRegisterManager;
|
return fRegisterManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue