1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Do not load the symbols right away

This commit is contained in:
Alain Magloire 2003-11-19 17:37:32 +00:00
parent f9e69cf8c7
commit 93d0a3cccf
2 changed files with 28 additions and 6 deletions

View file

@ -169,9 +169,18 @@ public class BinaryObject extends BinaryFile implements IBinaryObject {
protected PE.Attribute getAttribute() { protected PE.Attribute getAttribute() {
if (hasChanged()) { if (hasChanged()) {
PE pe = null;
try { try {
loadInformation(); pe = getPE();
loadAttributes(pe);
} catch (IOException e) { } catch (IOException e) {
} finally {
if (pe != null) {
try {
pe.dispose();
} catch (IOException e1) {
}
}
} }
} }
return attribute; return attribute;
@ -184,11 +193,11 @@ public class BinaryObject extends BinaryFile implements IBinaryObject {
} }
private void loadInformation(PE pe) throws IOException { private void loadInformation(PE pe) throws IOException {
loadAttribute(pe); loadAttributes(pe);
loadSymbols(pe); loadSymbols(pe);
} }
private void loadAttribute(PE pe) throws IOException { private void loadAttributes(PE pe) throws IOException {
attribute = pe.getAttribute(); attribute = pe.getAttribute();
} }

View file

@ -169,9 +169,15 @@ public class BinaryObject extends BinaryFile implements IBinaryObject {
protected Attribute getAttribute() { protected Attribute getAttribute() {
if (hasChanged()) { if (hasChanged()) {
ElfHelper helper = null;
try { try {
loadInformation(); helper = getElfHelper();
loadAttributes(helper);
} catch (IOException e) { } catch (IOException e) {
} finally {
if (helper != null) {
helper.dispose();
}
} }
} }
return attribute; return attribute;
@ -179,9 +185,15 @@ public class BinaryObject extends BinaryFile implements IBinaryObject {
protected Sizes getSizes() { protected Sizes getSizes() {
if (hasChanged()) { if (hasChanged()) {
ElfHelper helper = null;
try { try {
loadInformation(); helper = getElfHelper();
loadAttributes(helper);
} catch (IOException e) { } catch (IOException e) {
} finally {
if (helper != null) {
helper.dispose();
}
} }
} }
return sizes; return sizes;
@ -263,7 +275,8 @@ public class BinaryObject extends BinaryFile implements IBinaryObject {
if (addr2line != null) { if (addr2line != null) {
try { try {
String filename = addr2line.getFileName(sym.addr); 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.startLine = addr2line.getLineNumber(sym.addr);
sym.endLine = addr2line.getLineNumber(sym.addr + array[i].st_size - 1); sym.endLine = addr2line.getLineNumber(sym.addr + array[i].st_size - 1);
} catch (IOException e) { } catch (IOException e) {