diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/BinaryObject.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/BinaryObject.java index 1ea7e6d2b93..f38245267f3 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/BinaryObject.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/BinaryObject.java @@ -169,9 +169,18 @@ public class BinaryObject extends BinaryFile implements IBinaryObject { protected PE.Attribute getAttribute() { if (hasChanged()) { + PE pe = null; try { - loadInformation(); + pe = getPE(); + loadAttributes(pe); } catch (IOException e) { + } finally { + if (pe != null) { + try { + pe.dispose(); + } catch (IOException e1) { + } + } } } return attribute; @@ -184,11 +193,11 @@ public class BinaryObject extends BinaryFile implements IBinaryObject { } private void loadInformation(PE pe) throws IOException { - loadAttribute(pe); + loadAttributes(pe); loadSymbols(pe); } - private void loadAttribute(PE pe) throws IOException { + private void loadAttributes(PE pe) throws IOException { attribute = pe.getAttribute(); } diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/BinaryObject.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/BinaryObject.java index d454d9c6e15..fa0fd575c55 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/BinaryObject.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/BinaryObject.java @@ -169,9 +169,15 @@ public class BinaryObject extends BinaryFile implements IBinaryObject { protected Attribute getAttribute() { if (hasChanged()) { + ElfHelper helper = null; try { - loadInformation(); + helper = getElfHelper(); + loadAttributes(helper); } catch (IOException e) { + } finally { + if (helper != null) { + helper.dispose(); + } } } return attribute; @@ -179,9 +185,15 @@ public class BinaryObject extends BinaryFile implements IBinaryObject { protected Sizes getSizes() { if (hasChanged()) { + ElfHelper helper = null; try { - loadInformation(); + helper = getElfHelper(); + loadAttributes(helper); } catch (IOException e) { + } finally { + if (helper != null) { + helper.dispose(); + } } } return sizes; @@ -263,7 +275,8 @@ public class BinaryObject extends BinaryFile implements IBinaryObject { if (addr2line != null) { try { String filename = addr2line.getFileName(sym.addr); - sym.filename = (filename != null) ? new Path(filename) : null; + // Addr2line returns the funny "??" when it can not find the file. + sym.filename = (filename != null && !filename.equals("??")) ? new Path(filename) : null; sym.startLine = addr2line.getLineNumber(sym.addr); sym.endLine = addr2line.getLineNumber(sym.addr + array[i].st_size - 1); } catch (IOException e) {