Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2015-04-23 05:57:50 +0000
committerUwe Stieber2015-04-23 05:57:50 +0000
commit05cfd00814ad6d0854ffdb6127b190217747695c (patch)
treeb0f7e0165cd01eb1276fe1437ea01c05dbe9d2d2
parent140f6b2597754c310d5a37b07caccc929f5fd826 (diff)
downloadorg.eclipse.tcf-05cfd00814ad6d0854ffdb6127b190217747695c.tar.gz
org.eclipse.tcf-05cfd00814ad6d0854ffdb6127b190217747695c.tar.xz
org.eclipse.tcf-05cfd00814ad6d0854ffdb6127b190217747695c.zip
Target Explorer: Get machine type from ELF file and cleanup ISimulatorServiceUIDelegate interface
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.cdt/src/org/eclipse/tcf/te/core/cdt/elf/ElfUtils.java24
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/interfaces/ISimulatorServiceUIDelegate.java12
2 files changed, 25 insertions, 11 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.cdt/src/org/eclipse/tcf/te/core/cdt/elf/ElfUtils.java b/target_explorer/plugins/org.eclipse.tcf.te.core.cdt/src/org/eclipse/tcf/te/core/cdt/elf/ElfUtils.java
index 7d41b6277..98e74b385 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.core.cdt/src/org/eclipse/tcf/te/core/cdt/elf/ElfUtils.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.cdt/src/org/eclipse/tcf/te/core/cdt/elf/ElfUtils.java
@@ -70,4 +70,28 @@ public final class ElfUtils {
return elfclass;
}
+ /**
+ * Returns the ELF machine type if the specified file is an ELF file at all.
+ *
+ * @param file The file representation of the physical file to test. Must not be <code>null</code>!
+ * @return The ELF address class as defined within <code>org.eclipse.cdt.utils.elf.Elf.ELFhdr.ELFCLASS*</code>. <code>ELFCLASSNONE</code> (0) if the ELF address class is not set.
+ */
+ public static int getELFMachine(File file) throws IOException {
+ int elfclass = Elf.ELFhdr.EM_NONE;
+
+ if (file != null) {
+ Elf elfFile = null;
+ try {
+ elfFile = new Elf(file.getAbsolutePath());
+ elfclass = elfFile.getELFhdr().e_machine;
+ }
+ finally {
+ if (elfFile != null) {
+ elfFile.dispose();
+ }
+ elfFile = null;
+ }
+ }
+ return elfclass;
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/interfaces/ISimulatorServiceUIDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/interfaces/ISimulatorServiceUIDelegate.java
index 239c5cfd9..8d3cb03c2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/interfaces/ISimulatorServiceUIDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/interfaces/ISimulatorServiceUIDelegate.java
@@ -51,15 +51,6 @@ public interface ISimulatorServiceUIDelegate {
public Image getImage();
/**
- * Get a description for the given config.
- * This description is shown i.e. as tooltip of the configure button.
- * @param context The context for which the simulator should be configured.
- * @param config The configuration or <code>null</code>.
- * @return The description of the given config.
- */
- public String getDescription(Object context, String config);
-
- /**
* Get properties for ui configuration.
* @param context The context.
* @param config The current config.
@@ -95,10 +86,9 @@ public interface ISimulatorServiceUIDelegate {
* I.e. check for further needed files and set message to the messageProvider
*
* @param path The path. Must not be <code>null</code>.
- * @param path The BSP. Must not be <code>null</code>.
* @param messageProvider The message provider. Must not be <code>null</code>:
*
* @return <code>True</code> if the given kernel image path is valid, <code>false</code> otherwise.
*/
- public boolean validateKernelImage(IPath path, String bsp, BaseControl messageProvider);
+ public boolean validateKernelImage(IPath path, BaseControl messageProvider);
}

Back to the top