From: <jen...@de...> - 2007-09-27 15:41:04
|
Addresses in the annonymous sample files will be absolute and not relative to the region start amy more. In the generated ELF file for annoymous code the vma of the symbol is exaclty the same vma as the code had during sampling. --- ChangeLog | 12 ++++++++++++ daemon/opd_sfile.c | 9 --------- libpp/op_header.cpp | 7 ------- libpp/profile.cpp | 8 ++++++-- libutil++/op_bfd.cpp | 14 +++++++++++++- libutil++/op_bfd.h | 6 ++++++ 6 files changed, 37 insertions(+), 19 deletions(-) Index: oprofile-CVS-jit/daemon/opd_sfile.c =================================================================== --- oprofile-CVS-jit.orig/daemon/opd_sfile.c +++ oprofile-CVS-jit/daemon/opd_sfile.c @@ -389,12 +389,6 @@ if (trans->last->kernel) to -= trans->last->kernel->start; - if (trans->current->anon) - from -= trans->current->anon->start; - - if (trans->last->anon) - to -= trans->last->anon->start; - if (varcs) verbose_arc(trans, from, to); @@ -435,9 +429,6 @@ if (trans->current->kernel) pc -= trans->current->kernel->start; - if (trans->current->anon) - pc -= trans->current->anon->start; - if (vsamples) verbose_sample(trans, pc); Index: oprofile-CVS-jit/libutil++/op_bfd.h =================================================================== --- oprofile-CVS-jit.orig/libutil++/op_bfd.h +++ oprofile-CVS-jit/libutil++/op_bfd.h @@ -243,6 +243,12 @@ /// filename we open (not including archive path) std::string filename; + + /* flag indicating that this is a synthesized binary from an + * anonymous memory mapping (constructed e.g. by opjitconv) + */ + bool anonobj; + /// path to archive std::string archive_path; Index: oprofile-CVS-jit/libutil++/op_bfd.cpp =================================================================== --- oprofile-CVS-jit.orig/libutil++/op_bfd.cpp +++ oprofile-CVS-jit/libutil++/op_bfd.cpp @@ -103,6 +103,7 @@ asection const * sect; string const image_path = archive_path + filename; + string suf = ".jo"; cverb << vbfd << "op_bfd ctor for " << image_path << endl; @@ -123,6 +124,10 @@ goto out_fail; } + anonobj = false; + if (filename.rfind(suf) == filename.size() - suf.size()) + anonobj = true; + file_size = st.st_size; ibfd.abfd = fdopen_bfd(image_path, fd); @@ -273,6 +278,9 @@ bfd_vma op_bfd::sym_offset(symbol_index_t sym_index, bfd_vma vma) const { + if (anonobj) { + return vma - syms[sym_index].vma(); + } /* take off section offset and symb value */ return vma - syms[sym_index].filepos(); } @@ -376,7 +384,11 @@ bool const verbose = cverb << (vbfd & vlevel1); - start = sym.filepos(); + if (anonobj) { + start = sym.vma(); + } else { + start = sym.filepos(); + } end = start + sym.size(); if (!verbose) Index: oprofile-CVS-jit/libpp/op_header.cpp =================================================================== --- oprofile-CVS-jit.orig/libpp/op_header.cpp +++ oprofile-CVS-jit/libpp/op_header.cpp @@ -44,13 +44,6 @@ << filename << "\n"; throw op_fatal_error(os.str()); } - - if (h1.anon_start != h2.anon_start) { - ostringstream os; - os << "header anon_start flags are different for " - << filename << "\n"; - throw op_fatal_error(os.str()); - } // Note that we don't check CPU speed since that can vary // freely on the same machine Index: oprofile-CVS-jit/libpp/profile.cpp =================================================================== --- oprofile-CVS-jit.orig/libpp/profile.cpp +++ oprofile-CVS-jit/libpp/profile.cpp @@ -125,8 +125,12 @@ void profile_t::set_offset(op_bfd const & abfd) { opd_header const & header = get_header(); - if (header.anon_start || header.is_kernel) - start_offset = abfd.get_start_offset(header.anon_start); + if (header.anon_start) { + // we have absolute addresses in anon samples + start_offset = 0; + } else if (header.is_kernel) { + start_offset = abfd.get_start_offset(0); + } cverb << (vdebug) << "start_offset is now " << start_offset << endl; } Index: oprofile-CVS-jit/ChangeLog =================================================================== --- oprofile-CVS-jit.orig/ChangeLog +++ oprofile-CVS-jit/ChangeLog @@ -1,5 +1,17 @@ 2007-09-27 Jens Wilke <jen...@de...> + * daemon/opd_sfile.c: + * libutil++/op_bfd.h: + * libutil++/op_bfd.cpp: + * libpp/op_header.cpp: + * libpp/profile.cpp: Patch 6 of 6 for JIT code support. + Addresses in the annonymous sample files will be absolute and not + relative to the region start amy more. In the generated ELF file + for annoymous code the vma of the symbol is exaclty the same vma + as the code had during sampling. + +2007-09-27 Jens Wilke <jen...@de...> + * libpp/parse_filename.cpp: * libpp/profile_spec.cpp: Patch 5 of 6 for JIT code support. Changes image file resolution in postprocessing, so that we point -- Jens Wilke Linux on System z - Application Development Tools phone +49-(0)7031-16-3936 - tl *120-3936 - email jen...@de... IBM Germany Lab, Schoenaicher Str. 220, 71032 Boeblingen |