From: William C. <wc...@us...> - 2004-07-06 20:46:09
|
Update of /cvsroot/oprofile/oprofile/libpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28032/libpp Modified Files: arrange_profiles.cpp arrange_profiles.h callgraph_container.cpp callgraph_container.h locate_images.cpp locate_images.h populate.cpp populate.h profile_spec.cpp profile_spec.h Log Message: Check in oparchive support. Index: arrange_profiles.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/libpp/arrange_profiles.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -u -p -d -r1.33 -r1.34 --- arrange_profiles.cpp 28 May 2004 17:21:40 -0000 1.33 +++ arrange_profiles.cpp 6 Jul 2004 20:45:59 -0000 1.34 @@ -674,8 +674,8 @@ get_iprofile(app_map_t & app_map, string /// Pull out all the images, removing any we can't access. void -verify_and_fill(app_map_t & app_map, list<inverted_profile> & plist, - extra_images const & extra) +verify_and_fill(std::string archive_path, app_map_t & app_map, + list<inverted_profile> & plist, extra_images const & extra) { app_map_t::iterator it = app_map.begin(); app_map_t::iterator const end = app_map.end(); @@ -683,7 +683,8 @@ verify_and_fill(app_map_t & app_map, lis for (; it != end; ++it) { plist.push_back(it->second); inverted_profile & ip = plist.back(); - ip.image = find_image_path(ip.image, extra, ip.error); + ip.image = find_image_path(archive_path, ip.image, extra, + ip.error); } } @@ -691,7 +692,8 @@ verify_and_fill(app_map_t & app_map, lis list<inverted_profile> const -invert_profiles(profile_classes const & classes, extra_images const & extra) +invert_profiles(std::string archive_path, profile_classes const & classes, + extra_images const & extra) { app_map_t app_map; @@ -729,7 +731,7 @@ invert_profiles(profile_classes const & list<inverted_profile> inverted_list; - verify_and_fill(app_map, inverted_list, extra); + verify_and_fill(archive_path, app_map, inverted_list, extra); return inverted_list; } Index: arrange_profiles.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/libpp/arrange_profiles.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -p -d -r1.13 -r1.14 --- arrange_profiles.h 18 Jan 2004 02:21:14 -0000 1.13 +++ arrange_profiles.h 6 Jul 2004 20:45:59 -0000 1.14 @@ -220,6 +220,7 @@ class extra_images; * applicable (hence image_set). */ std::list<inverted_profile> const -invert_profiles(profile_classes const & classes, extra_images const & extra); +invert_profiles(std::string archive_path, profile_classes const & classes, + extra_images const & extra); #endif /* !ARRANGE_PROFILES_H */ Index: callgraph_container.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/libpp/callgraph_container.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -p -d -r1.24 -r1.25 --- callgraph_container.cpp 28 May 2004 17:21:40 -0000 1.24 +++ callgraph_container.cpp 6 Jul 2004 20:45:59 -0000 1.25 @@ -269,7 +269,8 @@ cg_symbol const * arc_recorder::find_cal } -void callgraph_container::populate(list<inverted_profile> const & iprofiles, +void callgraph_container::populate(string const & archive_path, + list<inverted_profile> const & iprofiles, extra_images const & extra, bool debug_info, double threshold, bool merge_lib) { @@ -281,12 +282,13 @@ void callgraph_container::populate(list< list<inverted_profile>::const_iterator const end = iprofiles.end(); for (it = iprofiles.begin(); it != end; ++it) { // populate_caller_image take care about empty sample filename - populate_for_image(symbols, *it, string_filter()); + populate_for_image(archive_path, symbols, *it, + string_filter()); } for (it = iprofiles.begin(); it != end; ++it) { for (size_t i = 0; i < it->groups.size(); ++i) { - populate(it->groups[i], it->image, extra, + populate(archive_path, it->groups[i], it->image, extra, i, symbols, debug_info, merge_lib); } } @@ -297,7 +299,8 @@ void callgraph_container::populate(list< } -void callgraph_container::populate(list<image_set> const & lset, +void callgraph_container::populate(string const & archive_path, + list<image_set> const & lset, string const & app_image, extra_images const & extra, size_t pclass, profile_container const & symbols, bool debug_info, bool merge_lib) { @@ -308,14 +311,16 @@ void callgraph_container::populate(list< list<profile_sample_files>::const_iterator pend = lit->files.end(); for (pit = lit->files.begin(); pit != pend; ++pit) { - populate(pit->cg_files, app_image, extra, pclass, + populate(archive_path, pit->cg_files, app_image, + extra, pclass, symbols, debug_info, merge_lib); } } } -void callgraph_container::populate(list<string> const & cg_files, +void callgraph_container::populate(string const & archive_path, + list<string> const & cg_files, string const & app_image, extra_images const & extra, size_t pclass, profile_container const & symbols, bool debug_info, bool merge_lib) { @@ -327,17 +332,19 @@ void callgraph_container::populate(list< image_error error; string caller_binary = - find_image_path(caller_file.lib_image, extra, error); + find_image_path(archive_path, caller_file.lib_image, + extra, error); if (error != image_ok) - report_image_error(caller_file.lib_image, error, false); + report_image_error(archive_path + caller_file.lib_image, + error, false); cverb << vdebug << "caller binary name: " << caller_binary << "\n"; bool bfd_caller_ok = true; - op_bfd caller_bfd(caller_binary, string_filter(), - bfd_caller_ok); + op_bfd caller_bfd(archive_path, caller_binary, + string_filter(), bfd_caller_ok); if (!bfd_caller_ok) report_image_error(caller_binary, image_format_failure, false); @@ -345,7 +352,7 @@ void callgraph_container::populate(list< parsed_filename callee_file = parse_filename(*it); string callee_binary = - find_image_path(callee_file.cg_image, + find_image_path(archive_path, callee_file.cg_image, extra, error); if (error != image_ok) report_image_error(callee_file.cg_image, error, false); @@ -354,8 +361,8 @@ void callgraph_container::populate(list< << callee_binary << endl; bool bfd_callee_ok = true; - op_bfd callee_bfd(callee_binary, string_filter(), - bfd_callee_ok); + op_bfd callee_bfd(archive_path, callee_binary, + string_filter(), bfd_callee_ok); if (!bfd_callee_ok) report_image_error(callee_binary, image_format_failure, false); Index: callgraph_container.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/libpp/callgraph_container.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -p -d -r1.11 -r1.12 --- callgraph_container.h 17 Feb 2004 22:43:56 -0000 1.11 +++ callgraph_container.h 6 Jul 2004 20:45:59 -0000 1.12 @@ -116,7 +116,8 @@ public: * Currently all errors core dump. * FIXME: consider if this should be a ctor */ - void populate(std::list<inverted_profile> const & iprofiles, + void populate(std::string const & archive_path, + std::list<inverted_profile> const & iprofiles, extra_images const & extra, bool debug_info, double threshold, bool merge_lib); @@ -150,12 +151,14 @@ private: profile_container const & symbols, bool debug_info, size_t pclass); - void populate(std::list<image_set> const & lset, + void populate(std::string const & archive_path, + std::list<image_set> const & lset, std::string const & app_image, extra_images const & extra, size_t pclass, profile_container const & symbols, bool debug_info, bool merge_lib); - void populate(std::list<std::string> const & cg_files, + void populate(std::string const & archive_path, + std::list<std::string> const & cg_files, std::string const & app_image, extra_images const & extra, size_t pclass, profile_container const & symbols, bool debug_info, Index: locate_images.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/libpp/locate_images.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -p -d -r1.12 -r1.13 --- locate_images.cpp 19 Jan 2004 20:00:25 -0000 1.12 +++ locate_images.cpp 6 Jul 2004 20:45:59 -0000 1.13 @@ -93,11 +93,12 @@ public: } // anon namespace -string const find_image_path(string const & image_name, +string const find_image_path(string const & archive_path, + string const & image_name, extra_images const & extra_images, image_error & error) { - string const image = op_realpath(image_name); + string const image = op_realpath(archive_path + image_name); // simplest case if (op_file_readable(image)) { Index: locate_images.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/libpp/locate_images.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -p -d -r1.11 -r1.12 --- locate_images.h 18 Jan 2004 02:21:14 -0000 1.11 +++ locate_images.h 6 Jul 2004 20:45:59 -0000 1.12 @@ -68,7 +68,8 @@ private: * If we fail to find the file we fill in error and return the original string. */ std::string const -find_image_path(std::string const & image_name, +find_image_path(std::string const & archive_path, + std::string const & image_name, extra_images const & extra_images, image_error & error); Index: populate.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/libpp/populate.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -d -r1.2 -r1.3 --- populate.cpp 18 Jan 2004 02:21:15 -0000 1.2 +++ populate.cpp 6 Jul 2004 20:45:59 -0000 1.3 @@ -49,11 +49,12 @@ populate_from_files(profile_t & profile, bool -populate_for_image(profile_container & samples, inverted_profile const & ip, - string_filter const & symbol_filter) +populate_for_image(string const & archive_path, profile_container & samples, + inverted_profile const & ip, string_filter const & symbol_filter) { bool ok = ip.error == image_ok; - op_bfd abfd(ip.image, symbol_filter, ok); + + op_bfd abfd(archive_path, ip.image, symbol_filter, ok); if (!ok && ip.error == image_ok) ip.error = image_format_failure; Index: populate.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/libpp/populate.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -d -r1.2 -r1.3 --- populate.h 18 Jan 2004 02:21:15 -0000 1.2 +++ populate.h 6 Jul 2004 20:45:59 -0000 1.3 @@ -20,7 +20,8 @@ class string_filter; /// Load all sample file information for exactly one binary image. /// return false if none of the image contains debug information bool -populate_for_image(profile_container & samples, inverted_profile const & ip, - string_filter const & symbol_filter); +populate_for_image(std::string const & archive_path, + profile_container & samples, + inverted_profile const & ip, string_filter const & symbol_filter); #endif /* POPULATE_H */ Index: profile_spec.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/libpp/profile_spec.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -p -d -r1.24 -r1.25 --- profile_spec.cpp 7 May 2004 15:18:14 -0000 1.24 +++ profile_spec.cpp 6 Jul 2004 20:45:59 -0000 1.25 @@ -30,9 +30,10 @@ namespace { // we should maintain the original to maintain the wordexp etc. string const fixup_image_spec(string const & str, extra_images const & extra) { + string dummy_archive_path; // FIXME: what todo if an error in find_image_path() ? image_error error; - return find_image_path(str, extra, error); + return find_image_path(dummy_archive_path, str, extra, error); } @@ -55,6 +56,7 @@ profile_spec::profile_spec(extra_images sample_file_set(false), extra(extra) { + parse_table["archive"] = &profile_spec::parse_archive_path; parse_table["sample-file"] = &profile_spec::parse_sample_file; parse_table["binary"] = &profile_spec::parse_binary; parse_table["session"] = &profile_spec::parse_session; @@ -121,6 +123,18 @@ void profile_spec::set_image_or_lib_name } +void profile_spec::parse_archive_path(string const & str) +{ + archive_path = op_realpath(str); +} + + +string profile_spec::get_archive_path() const +{ + return archive_path; +} + + void profile_spec::parse_sample_file(string const & str) { sample_file_set = true; @@ -440,7 +454,7 @@ list<string> profile_spec::generate_file string base_dir; if ((*cit)[0] != '.' && (*cit)[0] != '/') - base_dir = OP_SAMPLES_DIR; + base_dir = archive_path + OP_SAMPLES_DIR; base_dir += *cit; base_dir = op_realpath(base_dir); Index: profile_spec.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/libpp/profile_spec.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -p -d -r1.6 -r1.7 --- profile_spec.h 20 Feb 2004 22:40:43 -0000 1.6 +++ profile_spec.h 6 Jul 2004 20:45:59 -0000 1.7 @@ -58,6 +58,12 @@ public: */ bool match(filename_spec const & file_spec) const; + /** + * return archive name + * returns an empty string if not using an archive. + */ + std::string get_archive_path() const; + private: profile_spec(extra_images const & extra); @@ -91,6 +97,7 @@ private: /** * implement tag parsing: PP:3.3 to 3.16 */ + void parse_archive_path(std::string const &); void parse_sample_file(std::string const &); void parse_binary(std::string const &); void parse_session(std::string const &); @@ -121,6 +128,7 @@ private: std::string & value); filename_spec file_spec; + std::string archive_path; std::string binary; std::vector<std::string> session; std::vector<std::string> session_exclude; |