From: Philippe E. <ph...@us...> - 2004-01-18 14:02:57
|
Update of /cvsroot/oprofile/oprofile/libutil++ In directory sc8-pr-cvs1:/tmp/cvs-serv30950/libutil++ Modified Files: op_bfd.cpp op_bfd.h Log Message: Fix wrong offset in symbols section position, it's not a complete fix but avoid to break the normal case (no debuginfo file). A corner case remains: symbol coming from separated debug info file and not living in .text section are mis-offseted Index: op_bfd.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/libutil++/op_bfd.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -u -p -d -r1.43 -r1.44 --- op_bfd.cpp 18 Jan 2004 02:21:15 -0000 1.43 +++ op_bfd.cpp 18 Jan 2004 14:02:54 -0000 1.44 @@ -369,8 +369,13 @@ void op_bfd::get_symbols_from_file(bfd * for (symbol_index_t i = start; i < start+nr_all_syms; i++) { if (interesting_symbol(bfd_syms[i])) { - // need to use filepos of original file - bfd_syms[i]->section->filepos = text_offset; + // need to use filepos of original file for debug + // file symbs + if (debug_file) + // FIXME: this is not enough, we must get the + // offset where this symbol live in the + // original file. + bfd_syms[i]->section->filepos = text_offset; symbols.push_back(op_bfd_symbol(bfd_syms[i])); } } @@ -399,10 +404,10 @@ void op_bfd::get_symbols(op_bfd::symbols bfd_syms.reset(new asymbol*[size]); if (size_binary > 0) - get_symbols_from_file(ibfd, 0, symbols); + get_symbols_from_file(ibfd, 0, symbols, false); if (size_debug > 0) - get_symbols_from_file(dbfd, size_binary, symbols); + get_symbols_from_file(dbfd, size_binary, symbols, true); symbols.sort(); Index: op_bfd.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/libutil++/op_bfd.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -p -d -r1.27 -r1.28 --- op_bfd.h 18 Jan 2004 02:21:15 -0000 1.27 +++ op_bfd.h 18 Jan 2004 14:02:54 -0000 1.28 @@ -198,7 +198,8 @@ private: * Populates bfd_syms and extracts the "interesting_symbol"s. */ void get_symbols_from_file(bfd * ibfd, size_t start, - op_bfd::symbols_found_t & symbols); + op_bfd::symbols_found_t & symbols, + bool debug_file); /** * Parse and sort in ascending order all symbols |