# HG changeset patch # User l12wang # Date 1255043639 18000 # Node ID 6e8bead0f12695eafaab8d3ef68ba131dd1a5543 # Parent 83ae0d82da3b9acb7edbc94e9025a466458b59fb# Parent ba6179dfe20e3a949de0612e01bd71d0e6918b78 Merge with ba6179dfe20e3a949de0612e01bd71d0e6918b78 diff -r ba6179dfe20e -r 6e8bead0f126 cdt/cdt_6_0_x/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/PE.java --- 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;