From: Philippe E. <ph...@us...> - 2007-11-24 20:01:20
|
Update of /cvsroot/oprofile/oprofile/libpp In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27301/libpp Modified Files: Tag: JIT_SUPPORT callgraph_container.cpp profile.cpp profile_container.cpp Log Message: make anon samples relative to the start of the mapping. Add support in op_bfd for multiple code section. Change the way kernel/module binary are handled because allowing mutiple code section expose to ob_bfd the broken layout of module Index: callgraph_container.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/libpp/callgraph_container.cpp,v retrieving revision 1.37.2.3 retrieving revision 1.37.2.4 diff -u -p -d -r1.37.2.3 -r1.37.2.4 --- callgraph_container.cpp 16 Nov 2007 16:18:32 -0000 1.37.2.3 +++ callgraph_container.cpp 24 Nov 2007 20:01:21 -0000 1.37.2.4 @@ -132,12 +132,12 @@ public: app(aid), debug(debug_info) {} /// point to a caller symbol - void caller_sym(symbol_index_t i) { + void caller_sym(symbol_index_t i, bool is_kernel) { sym = symbol_entry(); unsigned long start; unsigned long end; - b.get_symbol_range(i, start, end); + b.get_symbol_range(i, start, end, is_kernel); samples.clear(); @@ -547,7 +547,7 @@ add(profile_t const & profile, op_bfd co for (symbol_index_t i = 0; i < caller_bfd.syms.size(); ++i) { - caller.caller_sym(i); + caller.caller_sym(i, header.is_kernel); call_data::const_iterator dit = caller.samples.begin(); call_data::const_iterator dend = caller.samples.end(); Index: profile.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/libpp/profile.cpp,v retrieving revision 1.26.2.2 retrieving revision 1.26.2.3 diff -u -p -d -r1.26.2.2 -r1.26.2.3 --- profile.cpp 24 Oct 2007 19:04:56 -0000 1.26.2.2 +++ profile.cpp 24 Nov 2007 20:01:21 -0000 1.26.2.3 @@ -127,8 +127,14 @@ void profile_t::set_offset(op_bfd const { opd_header const & header = get_header(); if (header.anon_start) { - // we have absolute addresses in anon samples - start_offset = 0; + // address in anon samples files are relative to the start of + // mapping, we need two corrections, first we have no warranty + // the first code vma is equal to the mapped vma, second + // we need to make samples relative to start of elf file not + // to the start of the code in the elf file. This allow to + // treat these elf file as other elf file. + start_offset = abfd.get_anon_start_file_pos() - + (abfd.get_anon_start_vma() - header.anon_start); } else if (header.is_kernel) { start_offset = abfd.get_start_offset(0); } Index: profile_container.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/libpp/profile_container.cpp,v retrieving revision 1.32.2.1 retrieving revision 1.32.2.2 diff -u -p -d -r1.32.2.1 -r1.32.2.2 --- profile_container.cpp 27 Oct 2007 16:31:14 -0000 1.32.2.1 +++ profile_container.cpp 24 Nov 2007 20:01:21 -0000 1.32.2.2 @@ -82,7 +82,7 @@ void profile_container::add(profile_t co unsigned long start, end; symbol_entry symb_entry; - abfd.get_symbol_range(i, start, end); + abfd.get_symbol_range(i, start, end, header.is_kernel); profile_t::iterator_pair p_it = profile.samples_range(start, end); |