1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Fix bug 91771.

This commit is contained in:
Ken Ryall 2007-02-08 00:06:28 +00:00
parent c24e249051
commit eec83cfb66
2 changed files with 41 additions and 6 deletions

View file

@ -0,0 +1,24 @@
/*******************************************************************************
* Copyright (c) 2007 Nokia and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Nokia - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.core.cdi.model;
import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor;
public interface ICDITarget2 extends ICDITarget {
/** Returns a list of global variables for the targeted process
* @return list of globals for the targeted process
*/
IGlobalVariableDescriptor[] getGlobalVariables();
}

View file

@ -7,7 +7,7 @@
* *
* Contributors: * Contributors:
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
* Ken Ryall (Nokia) - bugs 118894, 170027 * Ken Ryall (Nokia) - bugs 118894, 170027, 91771
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.internal.core.model; package org.eclipse.cdt.debug.internal.core.model;
@ -59,6 +59,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary; import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal; import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget2;
import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration; import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration;
import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration2; import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration2;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread; import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
@ -1343,12 +1344,22 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* @see org.eclipse.cdt.debug.core.model.IExecFileInfo#getGlobals() * @see org.eclipse.cdt.debug.core.model.IExecFileInfo#getGlobals()
*/ */
public IGlobalVariableDescriptor[] getGlobals() throws DebugException { public IGlobalVariableDescriptor[] getGlobals() throws DebugException {
ArrayList list = new ArrayList(); ICDITarget cdiTarget = getCDITarget();
IBinaryObject file = getBinaryFile(); IGlobalVariableDescriptor[] globals = new IGlobalVariableDescriptor[0];
if (file != null) { // If the backend can give us the globals...
list.addAll( getCFileGlobals( file ) ); if (cdiTarget instanceof ICDITarget2)
globals = ((ICDITarget2) cdiTarget).getGlobalVariables();
// otherwise ask the binary
if (globals.length == 0)
{
ArrayList list = new ArrayList();
IBinaryObject file = getBinaryFile();
if (file != null) {
list.addAll( getCFileGlobals( file ) );
}
globals = (IGlobalVariableDescriptor[])list.toArray( new IGlobalVariableDescriptor[list.size()] );
} }
return (IGlobalVariableDescriptor[])list.toArray( new IGlobalVariableDescriptor[list.size()] ); return globals;
} }
private List getCFileGlobals( IBinaryObject file ) throws DebugException { private List getCFileGlobals( IBinaryObject file ) throws DebugException {