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:
parent
7e143fdba9
commit
7a06b48359
3 changed files with 22 additions and 2 deletions
|
@ -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
|
2004-01-09 Alain Magloire
|
||||||
|
|
||||||
* src/org/eclipse/cdt/core/IBinaryParser.java
|
* src/org/eclipse/cdt/core/IBinaryParser.java
|
||||||
|
|
|
@ -59,15 +59,20 @@ public class BinaryObject extends BinaryFile implements IBinaryObject {
|
||||||
public ISymbol getSymbol(long addr) {
|
public ISymbol getSymbol(long addr) {
|
||||||
ISymbol[] syms = getSymbols();
|
ISymbol[] syms = getSymbols();
|
||||||
int insertion = Arrays.binarySearch(syms, new Long(addr));
|
int insertion = Arrays.binarySearch(syms, new Long(addr));
|
||||||
if (insertion > 0) {
|
if (insertion >= 0) {
|
||||||
return syms[insertion];
|
return syms[insertion];
|
||||||
}
|
}
|
||||||
if (insertion == -1) {
|
if (insertion == -1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
insertion = -insertion - 1;
|
insertion = -insertion - 1;
|
||||||
|
ISymbol symbol = syms[insertion - 1];
|
||||||
|
if (addr < (symbol.getAddress() + symbol.getSize())) {
|
||||||
return syms[insertion - 1];
|
return syms[insertion - 1];
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryFile#getType()
|
* @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryFile#getType()
|
||||||
|
|
|
@ -26,6 +26,7 @@ public class Symbol implements ISymbol {
|
||||||
public int startLine;
|
public int startLine;
|
||||||
public int endLine;
|
public int endLine;
|
||||||
public long addr;
|
public long addr;
|
||||||
|
public long size;
|
||||||
public String name;
|
public String name;
|
||||||
public int type;
|
public int type;
|
||||||
|
|
||||||
|
@ -108,6 +109,13 @@ public class Symbol implements ISymbol {
|
||||||
return (thisVal < anotherVal ? -1 : (thisVal == anotherVal ? 0 : 1));
|
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 () {
|
synchronized Addr2line startAddr2Line () {
|
||||||
if (addr2line == null) {
|
if (addr2line == null) {
|
||||||
addr2line = binary.getAddr2Line();
|
addr2line = binary.getAddr2Line();
|
||||||
|
|
Loading…
Add table
Reference in a new issue