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

Implement ISymbol.getSize().

This commit is contained in:
Alain Magloire 2004-01-10 05:38:40 +00:00
parent 7e143fdba9
commit 7a06b48359
3 changed files with 22 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2004-01-09 Alain Magloire
* utils/org/eclipse/cdt/utils/coff/parser/BinaryObject.java
Fix bug in finding the symbols.
* utils/org/eclipse/cdt/utils/coff/parser/Symbol.java
Implement ISymbol.java
2004-01-09 Alain Magloire
* src/org/eclipse/cdt/core/IBinaryParser.java

View file

@ -59,15 +59,20 @@ public class BinaryObject extends BinaryFile implements IBinaryObject {
public ISymbol getSymbol(long addr) {
ISymbol[] syms = getSymbols();
int insertion = Arrays.binarySearch(syms, new Long(addr));
if (insertion > 0) {
if (insertion >= 0) {
return syms[insertion];
}
if (insertion == -1) {
return null;
}
insertion = -insertion - 1;
ISymbol symbol = syms[insertion - 1];
if (addr < (symbol.getAddress() + symbol.getSize())) {
return syms[insertion - 1];
}
return null;
}
/**
* @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryFile#getType()

View file

@ -26,6 +26,7 @@ public class Symbol implements ISymbol {
public int startLine;
public int endLine;
public long addr;
public long size;
public String name;
public int type;
@ -108,6 +109,13 @@ public class Symbol implements ISymbol {
return (thisVal < anotherVal ? -1 : (thisVal == anotherVal ? 0 : 1));
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.IBinaryParser.ISymbol#getSize()
*/
public long getSize() {
return size;
}
synchronized Addr2line startAddr2Line () {
if (addr2line == null) {
addr2line = binary.getAddr2Line();