--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/PE.java Thu Oct 08 17:58:14 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/PE.java Thu Oct 08 18:13:59 2009 -0500
@@ -644,15 +644,24 @@
public Symbol[] getSymbols() throws IOException {
if (symbolTable == null) {
+ SectionHeader[] secHeaders = getSectionHeaders();
+ NTOptionalHeader ntHeader = getNTOptionalHeader();
+
RandomAccessFile accessFile = getRandomAccessFile();
long offset = fileHeader.f_symptr;
symbolTable = new Symbol[fileHeader.f_nsyms];
for (int i = 0; i < symbolTable.length; i++, offset += Symbol.SYMSZ) {
- symbolTable[i] = new Symbol(accessFile, offset);
- NTOptionalHeader ntHeader = getNTOptionalHeader();
- // FIXME: What is this again ?
+ Symbol newSym = new Symbol(accessFile, offset);
+
+ // Now convert section offset of the symbol to image offset.
+ if (newSym.n_scnum >= 1 && newSym.n_scnum <= secHeaders.length) // valid section #
+ newSym.n_value += secHeaders[newSym.n_scnum-1].s_vaddr;
+
+ // convert to absolute address.
if (ntHeader != null)
- symbolTable[i].n_value += ntHeader.ImageBase + ntHeader.FileAlignment;
+ newSym.n_value += ntHeader.ImageBase;
+
+ symbolTable[i] = newSym;
}
}
return symbolTable;