1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

minor tweaks bin obj

Change-Id: Ib2a5463bc71f05358a137c1c2bb547fd5577e8e9
This commit is contained in:
Alena Laskavaia 2015-11-05 09:18:58 -05:00 committed by Gerrit Code Review @ Eclipse.org
parent 67f78c8094
commit 75aa6665a0
3 changed files with 35 additions and 15 deletions

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.cdt.core" version="2">
<resource path="utils/org/eclipse/cdt/utils/BinaryObjectAdapter.java" type="org.eclipse.cdt.utils.BinaryObjectAdapter">
<filter comment="NO_SYMBOLS array should be final" id="388100214">
<message_arguments>
<message_argument value="org.eclipse.cdt.utils.BinaryObjectAdapter"/>
<message_argument value="NO_SYMBOLS"/>
</message_arguments>
</filter>
<filter comment="NO_SYMBOLS array should be static" id="388108357">
<message_arguments>
<message_argument value="org.eclipse.cdt.utils.BinaryObjectAdapter"/>
<message_argument value="NO_SYMBOLS"/>
</message_arguments>
</filter>
</resource>
</component>

View file

@ -23,7 +23,7 @@ import org.eclipse.core.runtime.IPath;
*/ */
public abstract class BinaryObjectAdapter extends BinaryFile implements IBinaryObject { public abstract class BinaryObjectAdapter extends BinaryFile implements IBinaryObject {
protected ISymbol[] NO_SYMBOLS = new ISymbol[0]; protected static final ISymbol[] NO_SYMBOLS = new ISymbol[0];
public class BinaryObjectInfo { public class BinaryObjectInfo {
public long bss; public long bss;

View file

@ -37,7 +37,7 @@ public class GNUElfBinaryObject extends ElfBinaryObject {
private Addr2line symbolLoadingAddr2line; private Addr2line symbolLoadingAddr2line;
private CPPFilt symbolLoadingCPPFilt; private CPPFilt symbolLoadingCPPFilt;
long starttime; long starttime;
/** /**
* @param parser * @param parser
* @param path * @param path
@ -103,7 +103,7 @@ public class GNUElfBinaryObject extends ElfBinaryObject {
} }
return null; return null;
} }
protected CPPFilt getCPPFilt() { protected CPPFilt getCPPFilt() {
IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class); IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) { if (factory != null) {
@ -143,7 +143,7 @@ public class GNUElfBinaryObject extends ElfBinaryObject {
return stream; return stream;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.utils.elf.parser.ElfBinaryObject#loadSymbols(org.eclipse.cdt.utils.elf.ElfHelper) * @see org.eclipse.cdt.utils.elf.parser.ElfBinaryObject#loadSymbols(org.eclipse.cdt.utils.elf.ElfHelper)
*/ */
@ -151,20 +151,23 @@ public class GNUElfBinaryObject extends ElfBinaryObject {
protected void loadSymbols(ElfHelper helper) throws IOException { protected void loadSymbols(ElfHelper helper) throws IOException {
symbolLoadingAddr2line = getAddr2line(false); symbolLoadingAddr2line = getAddr2line(false);
symbolLoadingCPPFilt = getCPPFilt(); symbolLoadingCPPFilt = getCPPFilt();
super.loadSymbols(helper); try {
if (symbolLoadingAddr2line != null) { super.loadSymbols(helper);
symbolLoadingAddr2line.dispose(); } finally {
symbolLoadingAddr2line = null; if (symbolLoadingAddr2line != null) {
} symbolLoadingAddr2line.dispose();
if (symbolLoadingCPPFilt != null) { symbolLoadingAddr2line = null;
symbolLoadingCPPFilt.dispose(); }
symbolLoadingCPPFilt = null; if (symbolLoadingCPPFilt != null) {
symbolLoadingCPPFilt.dispose();
symbolLoadingCPPFilt = null;
}
} }
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.eclipse.cdt.utils.elf.parser.ElfBinaryObject#addSymbols(org.eclipse.cdt.utils.elf.Elf.Symbol[], * @see org.eclipse.cdt.utils.elf.parser.ElfBinaryObject#addSymbols(org.eclipse.cdt.utils.elf.Elf.Symbol[],
* int, java.util.List) * int, java.util.List)
*/ */
@ -205,7 +208,7 @@ public class GNUElfBinaryObject extends ElfBinaryObject {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class) * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")