1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-06 07:45:50 +02:00

The "getCFileGlobals" method of "IExecFileInfo" throws "DebugException".

This commit is contained in:
Mikhail Khodjaiants 2004-04-20 16:03:27 +00:00
parent 41a3d5d9ff
commit 125213c8be
6 changed files with 70 additions and 19 deletions

View file

@ -1,3 +1,11 @@
2004-04-20 Mikhail Khodjaiants
The "getCFileGlobals" method of "IExecFileInfo" throws "DebugException".
* IExecFileInfo.java
* CoreModelMessages.properties
* CDebugTarget.java
* CoreModelMessages.java
* Disassembly.java
2004-04-19 Alain Magloire 2004-04-19 Alain Magloire
CoreModel throws Exception. CoreModel throws Exception.

View file

@ -1,23 +1,26 @@
/* /**********************************************************************
*(c) Copyright QNX Software Systems Ltd. 2002. * Copyright (c) 2004 QNX Software Systems and others.
* All Rights Reserved. * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
* *
*/ * Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.core.model; package org.eclipse.cdt.debug.core.model;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.debug.core.DebugException;
/** /**
* Provides access to executable file information. * Provides access to executable file information.
*
* @since: Nov 1, 2002
*/ */
public interface IExecFileInfo public interface IExecFileInfo {
{
public IFile getExecFile(); public IFile getExecFile();
public boolean isLittleEndian(); public boolean isLittleEndian();
public IGlobalVariable[] getGlobals(); public IGlobalVariable[] getGlobals() throws DebugException;
} }

View file

@ -2011,7 +2011,7 @@ public class CDebugTarget extends CDebugElement
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IExecFileInfo#getGlobals() * @see org.eclipse.cdt.debug.core.IExecFileInfo#getGlobals()
*/ */
public IGlobalVariable[] getGlobals() public IGlobalVariable[] getGlobals() throws DebugException
{ {
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
if ( getExecFile() != null && CoreModel.getDefault().isBinary( getExecFile() ) ) if ( getExecFile() != null && CoreModel.getDefault().isBinary( getExecFile() ) )
@ -2025,10 +2025,11 @@ public class CDebugTarget extends CDebugElement
return (IGlobalVariable[])list.toArray( new IGlobalVariable[list.size()] ); return (IGlobalVariable[])list.toArray( new IGlobalVariable[list.size()] );
} }
private List getCFileGlobals( IParent file ) private List getCFileGlobals( IParent file ) throws DebugException
{ {
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
try { try
{
ICElement[] elements = file.getChildren(); ICElement[] elements = file.getChildren();
for ( int i = 0; i < elements.length; ++i ) for ( int i = 0; i < elements.length; ++i )
{ {
@ -2041,7 +2042,10 @@ public class CDebugTarget extends CDebugElement
list.addAll( getCFileGlobals( (org.eclipse.cdt.core.model.IParent)elements[i] ) ); list.addAll( getCFileGlobals( (org.eclipse.cdt.core.model.IParent)elements[i] ) );
} }
} }
} catch (CModelException e) { }
catch( CModelException e )
{
requestFailed( CoreModelMessages.getString( "CDebugTarget.Unable_to_get_globals_1" ) + e.getMessage(), e ); //$NON-NLS-1$
} }
return list; return list;
} }
@ -2057,7 +2061,7 @@ public class CDebugTarget extends CDebugElement
public IPath getPath() public IPath getPath()
{ {
IPath path = new Path(""); //$NON-NLS-1$ IPath path = new Path( "" ); //$NON-NLS-1$
ICElement parent = var.getParent(); ICElement parent = var.getParent();
if ( parent instanceof IBinaryModule ) if ( parent instanceof IBinaryModule )
{ {

View file

@ -0,0 +1,33 @@
/**********************************************************************
* Copyright (c) 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.internal.core.model;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class CoreModelMessages {
private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.core.model.CoreModelMessages"; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
private CoreModelMessages() {
}
public static String getString( String key ) {
try {
return RESOURCE_BUNDLE.getString( key );
}
catch( MissingResourceException e ) {
return '!' + key + '!';
}
}
}

View file

@ -0,0 +1,3 @@
CDebugTarget.Unable_to_get_globals_1=Unable to get globals. Reason:
Disassembly.Unable_to_get_disassembly_instructions_1=Unable to get disassembly instructions.
Disassembly.Unable_to_get_disassembly_instructions_2=Unable to get disassembly instructions.

View file

@ -95,7 +95,7 @@ public class Disassembly extends CDebugElement implements IDisassembly {
CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS ) ); CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS ) );
} }
catch( CDIException e ) { catch( CDIException e ) {
targetRequestFailed( "Unable to get disassembly instructions.", e ); targetRequestFailed( CoreModelMessages.getString( "Disassembly.Unable_to_get_disassembly_instructions_1" ), e ); //$NON-NLS-1$
} }
} }
if ( instructions.length == 0 || if ( instructions.length == 0 ||
@ -106,7 +106,7 @@ public class Disassembly extends CDebugElement implements IDisassembly {
instructions = getFunctionInstructions( sm.getInstructions( address, address + DISASSEMBLY_BLOCK_SIZE ) ); instructions = getFunctionInstructions( sm.getInstructions( address, address + DISASSEMBLY_BLOCK_SIZE ) );
} }
catch( CDIException e ) { catch( CDIException e ) {
targetRequestFailed( "Unable to get disassembly instructions.", e ); targetRequestFailed( CoreModelMessages.getString( "Disassembly.Unable_to_get_disassembly_instructions_2" ), e ); //$NON-NLS-1$
} }
} }
} }