diff options
| author | Richard Purdie <richard@openedhand.com> | 2007-10-03 15:09:20 +0000 |
|---|---|---|
| committer | Richard Purdie <richard@openedhand.com> | 2007-10-03 15:09:20 +0000 |
| commit | 9ea931ac94fd6957577d20585fd009af8ae622a9 (patch) | |
| tree | 7715e66ae794c557bed3600933ffe56ea448effa | |
| parent | d195594897552a1d18af523a3f7b321482df48df (diff) | |
| download | poky-9ea931ac94fd6957577d20585fd009af8ae622a9.tar.gz | |
oprofile: Add oparchive fix and patch to add --root option to oprofile
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2827 311d38ba-8fff-0310-9ca6-ca027cbcb966
| -rw-r--r-- | meta/packages/oprofile/oprofile/oparchive_fix.patch | 22 | ||||
| -rw-r--r-- | meta/packages/oprofile/oprofile/opstart.patch | 122 | ||||
| -rw-r--r-- | meta/packages/oprofile/oprofile/root_option.patch | 1051 | ||||
| -rw-r--r-- | meta/packages/oprofile/oprofile_0.9.3.bb | 8 |
4 files changed, 1182 insertions, 21 deletions
diff --git a/meta/packages/oprofile/oprofile/oparchive_fix.patch b/meta/packages/oprofile/oprofile/oparchive_fix.patch new file mode 100644 index 0000000000..dbdd5eb4ea --- /dev/null +++ b/meta/packages/oprofile/oprofile/oparchive_fix.patch | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | Index: oprofile/pp/oparchive.cpp | ||
| 2 | =================================================================== | ||
| 3 | --- oprofile.orig/pp/oparchive.cpp | ||
| 4 | +++ oprofile/pp/oparchive.cpp | ||
| 5 | @@ -95,7 +95,7 @@ int oparchive(options::spec const & spec | ||
| 6 | * to avoid overwriting files with the same name. The | ||
| 7 | * /usr/lib/debug search path is not going to work. | ||
| 8 | */ | ||
| 9 | - bfd * ibfd = open_bfd(exe_name); | ||
| 10 | + bfd * ibfd = open_bfd(options::archive_path + exe_name); | ||
| 11 | if (ibfd) { | ||
| 12 | string global(options::archive_path + DEBUGDIR); | ||
| 13 | string dirname = op_dirname(options::archive_path + | ||
| 14 | @@ -106,7 +106,7 @@ int oparchive(options::spec const & spec | ||
| 15 | /* found something copy it over */ | ||
| 16 | string dest_debug_dir = options::outdirectory + | ||
| 17 | dirname + "/.debug/"; | ||
| 18 | - if (create_dir(dest_debug_dir.c_str())) { | ||
| 19 | + if (!options::list_files && create_dir(dest_debug_dir.c_str())) { | ||
| 20 | cerr << "Unable to create directory: " | ||
| 21 | << dest_debug_dir << "." << endl; | ||
| 22 | exit (EXIT_FAILURE); | ||
diff --git a/meta/packages/oprofile/oprofile/opstart.patch b/meta/packages/oprofile/oprofile/opstart.patch index 45109167a4..e8da0922cc 100644 --- a/meta/packages/oprofile/oprofile/opstart.patch +++ b/meta/packages/oprofile/oprofile/opstart.patch | |||
| @@ -1,13 +1,7 @@ | |||
| 1 | --- | 1 | Index: oprofile/utils/Makefile.am |
| 2 | configure.in | 1 | ||
| 3 | utils/Makefile.am | 11 +++++ | ||
| 4 | utils/opstart.c | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 5 | 3 files changed, 116 insertions(+), 1 deletion(-) | ||
| 6 | |||
| 7 | Index: oprofile-0.9.3/utils/Makefile.am | ||
| 8 | =================================================================== | 2 | =================================================================== |
| 9 | --- oprofile-0.9.3.orig/utils/Makefile.am 2007-09-05 12:55:48.000000000 +0100 | 3 | --- oprofile.orig/utils/Makefile.am |
| 10 | +++ oprofile-0.9.3/utils/Makefile.am 2007-09-05 15:20:34.000000000 +0100 | 4 | +++ oprofile/utils/Makefile.am |
| 11 | @@ -3,8 +3,15 @@ AM_CFLAGS = @OP_CFLAGS@ | 5 | @@ -3,8 +3,15 @@ AM_CFLAGS = @OP_CFLAGS@ |
| 12 | 6 | ||
| 13 | LIBS=@POPT_LIBS@ @LIBERTY_LIBS@ | 7 | LIBS=@POPT_LIBS@ @LIBERTY_LIBS@ |
| @@ -25,11 +19,11 @@ Index: oprofile-0.9.3/utils/Makefile.am | |||
| 25 | + cd $(DESTDIR)/$(bindir) && \ | 19 | + cd $(DESTDIR)/$(bindir) && \ |
| 26 | + rm -f opstop && \ | 20 | + rm -f opstop && \ |
| 27 | + $(LN_S) opstart opstop | 21 | + $(LN_S) opstart opstop |
| 28 | Index: oprofile-0.9.3/utils/opstart.c | 22 | Index: oprofile/utils/opstart.c |
| 29 | =================================================================== | 23 | =================================================================== |
| 30 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 24 | --- /dev/null |
| 31 | +++ oprofile-0.9.3/utils/opstart.c 2007-09-05 15:27:38.000000000 +0100 | 25 | +++ oprofile/utils/opstart.c |
| 32 | @@ -0,0 +1,105 @@ | 26 | @@ -0,0 +1,110 @@ |
| 33 | +/** | 27 | +/** |
| 34 | + * @file opstart.c | 28 | + * @file opstart.c |
| 35 | + * Start/Stop oprofile | 29 | + * Start/Stop oprofile |
| @@ -57,6 +51,11 @@ Index: oprofile-0.9.3/utils/opstart.c | |||
| 57 | + FILE *lfile, *efile; | 51 | + FILE *lfile, *efile; |
| 58 | + int sig, enb, err; | 52 | + int sig, enb, err; |
| 59 | + | 53 | + |
| 54 | + if (argc >= 2) { | ||
| 55 | + printf("Error: Invalid options.\n"); | ||
| 56 | + return 1; | ||
| 57 | + } | ||
| 58 | + | ||
| 60 | + lockfile = getenv("LOCK_FILE"); | 59 | + lockfile = getenv("LOCK_FILE"); |
| 61 | + if (!lockfile) | 60 | + if (!lockfile) |
| 62 | + lockfile = "/var/lib/oprofile/lock"; | 61 | + lockfile = "/var/lib/oprofile/lock"; |
| @@ -89,7 +88,7 @@ Index: oprofile-0.9.3/utils/opstart.c | |||
| 89 | + return 1; | 88 | + return 1; |
| 90 | + } | 89 | + } |
| 91 | + | 90 | + |
| 92 | + err = fscanf(lfile, "%ud", &dpid); | 91 | + err = fscanf(lfile, "%lud", (unsigned long *) &dpid); |
| 93 | + if (err != 1) { | 92 | + if (err != 1) { |
| 94 | + printf("Error reading pid from lockfile %s.\n", lockfile); | 93 | + printf("Error reading pid from lockfile %s.\n", lockfile); |
| 95 | + return 1; | 94 | + return 1; |
| @@ -135,11 +134,11 @@ Index: oprofile-0.9.3/utils/opstart.c | |||
| 135 | + return 0; | 134 | + return 0; |
| 136 | +} | 135 | +} |
| 137 | + | 136 | + |
| 138 | Index: oprofile-0.9.3/configure.in | 137 | Index: oprofile/configure.in |
| 139 | =================================================================== | 138 | =================================================================== |
| 140 | --- oprofile-0.9.3.orig/configure.in 2007-09-05 15:23:24.000000000 +0100 | 139 | --- oprofile.orig/configure.in |
| 141 | +++ oprofile-0.9.3/configure.in 2007-09-05 15:23:36.000000000 +0100 | 140 | +++ oprofile/configure.in |
| 142 | @@ -16,6 +16,7 @@ AM_INIT_AUTOMAKE(oprofile, 0.9.3) | 141 | @@ -16,6 +16,7 @@ AM_INIT_AUTOMAKE(oprofile, 0.9.4cvs) |
| 143 | AM_CONFIG_HEADER(config.h) | 142 | AM_CONFIG_HEADER(config.h) |
| 144 | 143 | ||
| 145 | AC_PROG_RANLIB | 144 | AC_PROG_RANLIB |
| @@ -147,3 +146,90 @@ Index: oprofile-0.9.3/configure.in | |||
| 147 | 146 | ||
| 148 | dnl for the man page | 147 | dnl for the man page |
| 149 | DATE="`date '+%a %d %B %Y'`" | 148 | DATE="`date '+%a %d %B %Y'`" |
| 149 | @@ -227,6 +228,8 @@ AC_OUTPUT(Makefile \ | ||
| 150 | doc/xsl/catalog-1.xml \ | ||
| 151 | doc/oprofile.1 \ | ||
| 152 | doc/opcontrol.1 \ | ||
| 153 | + doc/opstart.1 \ | ||
| 154 | + doc/opstop.1 \ | ||
| 155 | doc/ophelp.1 \ | ||
| 156 | doc/opreport.1 \ | ||
| 157 | doc/opannotate.1 \ | ||
| 158 | Index: oprofile/doc/Makefile.am | ||
| 159 | =================================================================== | ||
| 160 | --- oprofile.orig/doc/Makefile.am | ||
| 161 | +++ oprofile/doc/Makefile.am | ||
| 162 | @@ -11,6 +11,8 @@ STYLESHEETS=$(CHUNK_XHTML_STYLESHEET) $( | ||
| 163 | man_MANS = \ | ||
| 164 | oprofile.1 \ | ||
| 165 | opcontrol.1 \ | ||
| 166 | + opstart.1 \ | ||
| 167 | + opstop.1 \ | ||
| 168 | opreport.1 \ | ||
| 169 | opannotate.1 \ | ||
| 170 | opgprof.1 \ | ||
| 171 | Index: oprofile/doc/opstart.1.in | ||
| 172 | =================================================================== | ||
| 173 | --- /dev/null | ||
| 174 | +++ oprofile/doc/opstart.1.in | ||
| 175 | @@ -0,0 +1,27 @@ | ||
| 176 | +.TH OPSTART 1 "@DATE@" "oprofile @VERSION@" | ||
| 177 | +.UC 4 | ||
| 178 | +.SH NAME | ||
| 179 | +opstart \- start OProfile profiling | ||
| 180 | +.SH SYNOPSIS | ||
| 181 | +.br | ||
| 182 | +.B opstart | ||
| 183 | +.SH DESCRIPTION | ||
| 184 | +.B opstart | ||
| 185 | +is a simple optimised command to start profiling with 2.6 Linux kernels. | ||
| 186 | +OProfile should have already been initialised by calling "opcontrol --start-daemon". | ||
| 187 | + | ||
| 188 | +.SH ENVIRONMENT | ||
| 189 | +No special environment variables are recognised by opstart. | ||
| 190 | + | ||
| 191 | +.SH FILES | ||
| 192 | +.TP | ||
| 193 | +.I /var/lib/oprofile/samples/ | ||
| 194 | +The location of the generated sample files. | ||
| 195 | + | ||
| 196 | +.SH VERSION | ||
| 197 | +.TP | ||
| 198 | +This man page is current for @PACKAGE@-@VERSION@. | ||
| 199 | + | ||
| 200 | +.SH SEE ALSO | ||
| 201 | +.BR @OP_DOCDIR@, | ||
| 202 | +.BR oprofile(1) | ||
| 203 | Index: oprofile/doc/opstop.1.in | ||
| 204 | =================================================================== | ||
| 205 | --- /dev/null | ||
| 206 | +++ oprofile/doc/opstop.1.in | ||
| 207 | @@ -0,0 +1,28 @@ | ||
| 208 | +.TH OPSTOP 1 "@DATE@" "oprofile @VERSION@" | ||
| 209 | +.UC 4 | ||
| 210 | +.SH NAME | ||
| 211 | +opstop \- stop OProfile profiling | ||
| 212 | +.SH SYNOPSIS | ||
| 213 | +.br | ||
| 214 | +.B opstop | ||
| 215 | +.SH DESCRIPTION | ||
| 216 | +.B opstop | ||
| 217 | +is a simple optimsed command to stop profiling with 2.6 Linux kernels. | ||
| 218 | +You need to run "opcontrol --dump" before being able to view a profile | ||
| 219 | +with opreport. | ||
| 220 | + | ||
| 221 | +.SH ENVIRONMENT | ||
| 222 | +No special environment variables are recognised by opstop. | ||
| 223 | + | ||
| 224 | +.SH FILES | ||
| 225 | +.TP | ||
| 226 | +.I /var/lib/oprofile/samples/ | ||
| 227 | +The location of the generated sample files. | ||
| 228 | + | ||
| 229 | +.SH VERSION | ||
| 230 | +.TP | ||
| 231 | +This man page is current for @PACKAGE@-@VERSION@. | ||
| 232 | + | ||
| 233 | +.SH SEE ALSO | ||
| 234 | +.BR @OP_DOCDIR@, | ||
| 235 | +.BR oprofile(1) | ||
diff --git a/meta/packages/oprofile/oprofile/root_option.patch b/meta/packages/oprofile/oprofile/root_option.patch new file mode 100644 index 0000000000..bcb05f6c16 --- /dev/null +++ b/meta/packages/oprofile/oprofile/root_option.patch | |||
| @@ -0,0 +1,1051 @@ | |||
| 1 | Index: oprofile/libpp/arrange_profiles.cpp | ||
| 2 | =================================================================== | ||
| 3 | --- oprofile.orig/libpp/arrange_profiles.cpp | ||
| 4 | +++ oprofile/libpp/arrange_profiles.cpp | ||
| 5 | @@ -798,7 +798,7 @@ get_iprofile(app_map_t & app_map, string | ||
| 6 | |||
| 7 | /// Pull out all the images, removing any we can't access. | ||
| 8 | void | ||
| 9 | -verify_and_fill(string archive_path, app_map_t & app_map, | ||
| 10 | +verify_and_fill(std::vector<std::string> const & archive_paths, app_map_t & app_map, | ||
| 11 | list<inverted_profile> & plist, extra_images const & extra) | ||
| 12 | { | ||
| 13 | app_map_t::iterator it = app_map.begin(); | ||
| 14 | @@ -807,7 +807,7 @@ verify_and_fill(string archive_path, app | ||
| 15 | for (; it != end; ++it) { | ||
| 16 | plist.push_back(it->second); | ||
| 17 | inverted_profile & ip = plist.back(); | ||
| 18 | - ip.image = find_image_path(archive_path, ip.image, extra, | ||
| 19 | + ip.image = find_image_path(archive_paths, ip.image, extra, | ||
| 20 | ip.error); | ||
| 21 | } | ||
| 22 | } | ||
| 23 | @@ -816,7 +816,7 @@ verify_and_fill(string archive_path, app | ||
| 24 | |||
| 25 | |||
| 26 | list<inverted_profile> const | ||
| 27 | -invert_profiles(string archive_path, profile_classes const & classes, | ||
| 28 | +invert_profiles(std::vector<std::string> const & archive_paths, profile_classes const & classes, | ||
| 29 | extra_images const & extra) | ||
| 30 | { | ||
| 31 | app_map_t app_map; | ||
| 32 | @@ -855,7 +855,7 @@ invert_profiles(string archive_path, pro | ||
| 33 | |||
| 34 | list<inverted_profile> inverted_list; | ||
| 35 | |||
| 36 | - verify_and_fill(archive_path, app_map, inverted_list, extra); | ||
| 37 | + verify_and_fill(archive_paths, app_map, inverted_list, extra); | ||
| 38 | |||
| 39 | return inverted_list; | ||
| 40 | } | ||
| 41 | Index: oprofile/libpp/arrange_profiles.h | ||
| 42 | =================================================================== | ||
| 43 | --- oprofile.orig/libpp/arrange_profiles.h | ||
| 44 | +++ oprofile/libpp/arrange_profiles.h | ||
| 45 | @@ -239,7 +239,7 @@ class extra_images; | ||
| 46 | * applicable (hence image_set). | ||
| 47 | */ | ||
| 48 | std::list<inverted_profile> const | ||
| 49 | -invert_profiles(std::string archive_path, profile_classes const & classes, | ||
| 50 | +invert_profiles(std::vector<std::string> const & archive_paths, profile_classes const & classes, | ||
| 51 | extra_images const & extra); | ||
| 52 | |||
| 53 | #endif /* !ARRANGE_PROFILES_H */ | ||
| 54 | Index: oprofile/libpp/callgraph_container.cpp | ||
| 55 | =================================================================== | ||
| 56 | --- oprofile.orig/libpp/callgraph_container.cpp | ||
| 57 | +++ oprofile/libpp/callgraph_container.cpp | ||
| 58 | @@ -392,7 +392,7 @@ const symbol_collection & arc_recorder:: | ||
| 59 | } | ||
| 60 | |||
| 61 | |||
| 62 | -void callgraph_container::populate(string const & archive_path, | ||
| 63 | +void callgraph_container::populate(std::vector<std::string> const & archive_paths, | ||
| 64 | list<inverted_profile> const & iprofiles, | ||
| 65 | extra_images const & extra, bool debug_info, double threshold, | ||
| 66 | bool merge_lib, string_filter const & sym_filter) | ||
| 67 | @@ -405,7 +405,7 @@ void callgraph_container::populate(strin | ||
| 68 | list<inverted_profile>::const_iterator const end = iprofiles.end(); | ||
| 69 | for (it = iprofiles.begin(); it != end; ++it) { | ||
| 70 | // populate_caller_image take care about empty sample filename | ||
| 71 | - populate_for_image(archive_path, pc, *it, sym_filter, 0); | ||
| 72 | + populate_for_image(archive_paths, pc, *it, sym_filter, 0); | ||
| 73 | } | ||
| 74 | |||
| 75 | add_symbols(pc); | ||
| 76 | @@ -414,7 +414,7 @@ void callgraph_container::populate(strin | ||
| 77 | |||
| 78 | for (it = iprofiles.begin(); it != end; ++it) { | ||
| 79 | for (size_t i = 0; i < it->groups.size(); ++i) { | ||
| 80 | - populate(archive_path, it->groups[i], it->image, extra, | ||
| 81 | + populate(archive_paths, it->groups[i], it->image, extra, | ||
| 82 | i, pc, debug_info, merge_lib); | ||
| 83 | } | ||
| 84 | } | ||
| 85 | @@ -423,7 +423,7 @@ void callgraph_container::populate(strin | ||
| 86 | } | ||
| 87 | |||
| 88 | |||
| 89 | -void callgraph_container::populate(string const & archive_path, | ||
| 90 | +void callgraph_container::populate(std::vector<std::string> const & archive_paths, | ||
| 91 | list<image_set> const & lset, | ||
| 92 | string const & app_image, extra_images const & extra, size_t pclass, | ||
| 93 | profile_container const & pc, bool debug_info, bool merge_lib) | ||
| 94 | @@ -435,14 +435,14 @@ void callgraph_container::populate(strin | ||
| 95 | list<profile_sample_files>::const_iterator pend | ||
| 96 | = lit->files.end(); | ||
| 97 | for (pit = lit->files.begin(); pit != pend; ++pit) { | ||
| 98 | - populate(archive_path, pit->cg_files, app_image, | ||
| 99 | + populate(archive_paths, pit->cg_files, app_image, | ||
| 100 | extra, pclass, pc, debug_info, merge_lib); | ||
| 101 | } | ||
| 102 | } | ||
| 103 | } | ||
| 104 | |||
| 105 | |||
| 106 | -void callgraph_container::populate(string const & archive_path, | ||
| 107 | +void callgraph_container::populate(std::vector<std::string> const & archive_paths, | ||
| 108 | list<string> const & cg_files, | ||
| 109 | string const & app_image, extra_images const & extra, size_t pclass, | ||
| 110 | profile_container const & pc, bool debug_info, bool merge_lib) | ||
| 111 | @@ -457,15 +457,15 @@ void callgraph_container::populate(strin | ||
| 112 | |||
| 113 | image_error error; | ||
| 114 | string caller_binary = | ||
| 115 | - find_image_path(archive_path, caller_file.lib_image, | ||
| 116 | + find_image_path(archive_paths, caller_file.lib_image, | ||
| 117 | extra, error); | ||
| 118 | |||
| 119 | if (error != image_ok) | ||
| 120 | - report_image_error(archive_path + caller_file.lib_image, | ||
| 121 | + report_image_error(caller_file.lib_image, | ||
| 122 | error, false); | ||
| 123 | |||
| 124 | bool caller_bfd_ok = true; | ||
| 125 | - op_bfd caller_bfd(archive_path, caller_binary, | ||
| 126 | + op_bfd caller_bfd(archive_paths, caller_binary, | ||
| 127 | string_filter(), caller_bfd_ok); | ||
| 128 | if (!caller_bfd_ok) | ||
| 129 | report_image_error(caller_binary, | ||
| 130 | @@ -474,13 +474,13 @@ void callgraph_container::populate(strin | ||
| 131 | parsed_filename callee_file = parse_filename(*it); | ||
| 132 | |||
| 133 | string callee_binary = | ||
| 134 | - find_image_path(archive_path, callee_file.cg_image, | ||
| 135 | + find_image_path(archive_paths, callee_file.cg_image, | ||
| 136 | extra, error); | ||
| 137 | if (error != image_ok) | ||
| 138 | report_image_error(callee_file.cg_image, error, false); | ||
| 139 | |||
| 140 | bool callee_bfd_ok = true; | ||
| 141 | - op_bfd callee_bfd(archive_path, callee_binary, | ||
| 142 | + op_bfd callee_bfd(archive_paths, callee_binary, | ||
| 143 | string_filter(), callee_bfd_ok); | ||
| 144 | if (!callee_bfd_ok) | ||
| 145 | report_image_error(callee_binary, | ||
| 146 | Index: oprofile/libpp/callgraph_container.h | ||
| 147 | =================================================================== | ||
| 148 | --- oprofile.orig/libpp/callgraph_container.h | ||
| 149 | +++ oprofile/libpp/callgraph_container.h | ||
| 150 | @@ -105,7 +105,7 @@ class callgraph_container { | ||
| 151 | public: | ||
| 152 | /** | ||
| 153 | * Populate the container, must be called once only. | ||
| 154 | - * @param archive_path oparchive prefix path | ||
| 155 | + * @param archive_paths oparchive prefix paths | ||
| 156 | * @param iprofiles sample file list including callgraph files. | ||
| 157 | * @param extra extra image list to fixup binary name. | ||
| 158 | * @param debug_info true if we must record linenr information | ||
| 159 | @@ -116,7 +116,7 @@ public: | ||
| 160 | * Currently all errors core dump. | ||
| 161 | * FIXME: consider if this should be a ctor | ||
| 162 | */ | ||
| 163 | - void populate(std::string const & archive_path, | ||
| 164 | + void populate(std::vector<std::string> const & archive_paths, | ||
| 165 | std::list<inverted_profile> const & iprofiles, | ||
| 166 | extra_images const & extra, bool debug_info, | ||
| 167 | double threshold, bool merge_lib, | ||
| 168 | @@ -149,13 +149,13 @@ private: | ||
| 169 | profile_container const & pc, bool debug_info, | ||
| 170 | size_t pclass); | ||
| 171 | |||
| 172 | - void populate(std::string const & archive_path, | ||
| 173 | + void populate(std::vector<std::string> const & archive_paths, | ||
| 174 | std::list<image_set> const & lset, | ||
| 175 | std::string const & app_image, | ||
| 176 | extra_images const & extra, size_t pclass, | ||
| 177 | profile_container const & pc, bool debug_info, | ||
| 178 | bool merge_lib); | ||
| 179 | - void populate(std::string const & archive_path, | ||
| 180 | + void populate(std::vector<std::string> const & archive_paths, | ||
| 181 | std::list<std::string> const & cg_files, | ||
| 182 | std::string const & app_image, | ||
| 183 | extra_images const & extra, size_t pclass, | ||
| 184 | Index: oprofile/libpp/locate_images.cpp | ||
| 185 | =================================================================== | ||
| 186 | --- oprofile.orig/libpp/locate_images.cpp | ||
| 187 | +++ oprofile/libpp/locate_images.cpp | ||
| 188 | @@ -93,14 +93,14 @@ public: | ||
| 189 | } // anon namespace | ||
| 190 | |||
| 191 | |||
| 192 | -string const find_image_path(string const & archive_path, | ||
| 193 | +string const find_image_path(std::vector<std::string> const & archive_paths, | ||
| 194 | string const & image_name, | ||
| 195 | extra_images const & extra_images, | ||
| 196 | image_error & error) | ||
| 197 | { | ||
| 198 | error = image_ok; | ||
| 199 | |||
| 200 | - string const image = op_realpath(archive_path + image_name); | ||
| 201 | + string const image = op_realpath(op_findfile(archive_paths, image_name)); | ||
| 202 | |||
| 203 | // simplest case | ||
| 204 | if (op_file_readable(image)) { | ||
| 205 | Index: oprofile/libpp/locate_images.h | ||
| 206 | =================================================================== | ||
| 207 | --- oprofile.orig/libpp/locate_images.h | ||
| 208 | +++ oprofile/libpp/locate_images.h | ||
| 209 | @@ -70,7 +70,7 @@ private: | ||
| 210 | * If we fail to find the file we fill in error and return the original string. | ||
| 211 | */ | ||
| 212 | std::string const | ||
| 213 | -find_image_path(std::string const & archive_path, | ||
| 214 | +find_image_path(std::vector<std::string> const & archive_paths, | ||
| 215 | std::string const & image_name, | ||
| 216 | extra_images const & extra_images, | ||
| 217 | image_error & error); | ||
| 218 | Index: oprofile/libpp/populate.cpp | ||
| 219 | =================================================================== | ||
| 220 | --- oprofile.orig/libpp/populate.cpp | ||
| 221 | +++ oprofile/libpp/populate.cpp | ||
| 222 | @@ -21,6 +21,7 @@ | ||
| 223 | #include "populate_for_spu.h" | ||
| 224 | |||
| 225 | #include "image_errors.h" | ||
| 226 | +#include "file_manip.h" | ||
| 227 | |||
| 228 | #include <iostream> | ||
| 229 | |||
| 230 | @@ -56,16 +57,16 @@ populate_from_files(profile_t & profile, | ||
| 231 | |||
| 232 | |||
| 233 | void | ||
| 234 | -populate_for_image(string const & archive_path, profile_container & samples, | ||
| 235 | +populate_for_image(std::vector<std::string> const & archive_paths, profile_container & samples, | ||
| 236 | inverted_profile const & ip, string_filter const & symbol_filter, | ||
| 237 | bool * has_debug_info) | ||
| 238 | { | ||
| 239 | if (is_spu_profile(ip)) | ||
| 240 | - return populate_for_spu_image(archive_path, samples, ip, | ||
| 241 | + return populate_for_spu_image(archive_paths, samples, ip, | ||
| 242 | symbol_filter, has_debug_info); | ||
| 243 | |||
| 244 | bool ok = ip.error == image_ok; | ||
| 245 | - op_bfd abfd(archive_path, ip.image, symbol_filter, ok); | ||
| 246 | + op_bfd abfd(archive_paths, ip.image, symbol_filter, ok); | ||
| 247 | if (!ok && ip.error == image_ok) | ||
| 248 | ip.error = image_format_failure; | ||
| 249 | |||
| 250 | @@ -96,7 +97,7 @@ populate_for_image(string const & archiv | ||
| 251 | } | ||
| 252 | |||
| 253 | if (found == true && ip.error == image_ok) | ||
| 254 | - check_mtime(archive_path + abfd.get_filename(), header); | ||
| 255 | + check_mtime(op_findfile(archive_paths, abfd.get_filename()), header); | ||
| 256 | |||
| 257 | if (has_debug_info) | ||
| 258 | *has_debug_info = abfd.has_debug_info(); | ||
| 259 | Index: oprofile/libpp/populate.h | ||
| 260 | =================================================================== | ||
| 261 | --- oprofile.orig/libpp/populate.h | ||
| 262 | +++ oprofile/libpp/populate.h | ||
| 263 | @@ -19,7 +19,7 @@ class string_filter; | ||
| 264 | |||
| 265 | /// Load all sample file information for exactly one binary image. | ||
| 266 | void | ||
| 267 | -populate_for_image(std::string const & archive_path, | ||
| 268 | +populate_for_image(std::vector<std::string> const & archive_paths, | ||
| 269 | profile_container & samples, inverted_profile const & ip, | ||
| 270 | string_filter const & symbol_filter, bool * has_debug_info); | ||
| 271 | |||
| 272 | Index: oprofile/libpp/populate_for_spu.cpp | ||
| 273 | =================================================================== | ||
| 274 | --- oprofile.orig/libpp/populate_for_spu.cpp | ||
| 275 | +++ oprofile/libpp/populate_for_spu.cpp | ||
| 276 | @@ -19,6 +19,7 @@ | ||
| 277 | #include "populate_for_spu.h" | ||
| 278 | |||
| 279 | #include "image_errors.h" | ||
| 280 | +#include "file_manip.h" | ||
| 281 | |||
| 282 | #include <iostream> | ||
| 283 | |||
| 284 | @@ -46,7 +47,7 @@ static int spu_profile = unknown_profile | ||
| 285 | void | ||
| 286 | populate_spu_profile_from_files(list<profile_sample_files> const & files, | ||
| 287 | string const app_image, | ||
| 288 | - string const & archive_path, | ||
| 289 | + std::vector<std::string> const & archive_paths, | ||
| 290 | profile_container & samples, | ||
| 291 | inverted_profile const & ip, | ||
| 292 | string_filter const & symbol_filter, | ||
| 293 | @@ -65,14 +66,14 @@ populate_spu_profile_from_files(list<pro | ||
| 294 | profile.add_sample_file(it->sample_filename); | ||
| 295 | opd_header header = profile.get_header(); | ||
| 296 | if (header.embedded_offset) { | ||
| 297 | - abfd = new op_bfd(archive_path, | ||
| 298 | + abfd = new op_bfd(archive_paths, | ||
| 299 | header.embedded_offset, | ||
| 300 | ip.image, | ||
| 301 | symbol_filter, | ||
| 302 | ok); | ||
| 303 | fname_to_check = ip.image; | ||
| 304 | } else { | ||
| 305 | - abfd = new op_bfd(archive_path, | ||
| 306 | + abfd = new op_bfd(archive_paths, | ||
| 307 | ip.image, | ||
| 308 | symbol_filter, | ||
| 309 | ok); | ||
| 310 | @@ -87,7 +88,7 @@ populate_spu_profile_from_files(list<pro | ||
| 311 | |||
| 312 | samples.add(profile, *abfd, app_image, ip_grp_num); | ||
| 313 | if (ip.error == image_ok) | ||
| 314 | - check_mtime(archive_path + fname_to_check, | ||
| 315 | + check_mtime(op_findfile(archive_paths, fname_to_check), | ||
| 316 | profile.get_header()); | ||
| 317 | |||
| 318 | if (has_debug_info && !*has_debug_info) | ||
| 319 | @@ -98,7 +99,7 @@ populate_spu_profile_from_files(list<pro | ||
| 320 | } // anon namespace | ||
| 321 | |||
| 322 | void | ||
| 323 | -populate_for_spu_image(string const & archive_path, | ||
| 324 | +populate_for_spu_image(std::vector<std::string> const & archive_paths, | ||
| 325 | profile_container & samples, | ||
| 326 | inverted_profile const & ip, | ||
| 327 | string_filter const & symbol_filter, | ||
| 328 | @@ -113,7 +114,7 @@ populate_for_spu_image(string const & ar | ||
| 329 | |||
| 330 | for (; it != end; ++it) | ||
| 331 | populate_spu_profile_from_files(it->files, | ||
| 332 | - it->app_image, archive_path, samples, ip, | ||
| 333 | + it->app_image, archive_paths, samples, ip, | ||
| 334 | symbol_filter, i, has_debug_info); | ||
| 335 | } | ||
| 336 | } | ||
| 337 | Index: oprofile/libpp/populate_for_spu.h | ||
| 338 | =================================================================== | ||
| 339 | --- oprofile.orig/libpp/populate_for_spu.h | ||
| 340 | +++ oprofile/libpp/populate_for_spu.h | ||
| 341 | @@ -13,6 +13,8 @@ | ||
| 342 | #ifndef POPULATE_FOR_SPU_H | ||
| 343 | #define POPULATE_FOR_SPU_H | ||
| 344 | |||
| 345 | +#include <vector> | ||
| 346 | + | ||
| 347 | class profile_container; | ||
| 348 | class inverted_profile; | ||
| 349 | class string_filter; | ||
| 350 | @@ -28,7 +30,7 @@ bool is_spu_profile(inverted_profile con | ||
| 351 | * This is a special-purpose function for CELL BE SPU profiling. | ||
| 352 | * See populate_spu_profile_from_files prologue for more details. | ||
| 353 | */ | ||
| 354 | -void populate_for_spu_image(std::string const & archive_path, | ||
| 355 | +void populate_for_spu_image(std::vector<std::string> const & archive_paths, | ||
| 356 | profile_container & samples, | ||
| 357 | inverted_profile const & ip, | ||
| 358 | string_filter const & symbol_filter, | ||
| 359 | Index: oprofile/libpp/profile_spec.cpp | ||
| 360 | =================================================================== | ||
| 361 | --- oprofile.orig/libpp/profile_spec.cpp | ||
| 362 | +++ oprofile/libpp/profile_spec.cpp | ||
| 363 | @@ -30,7 +30,7 @@ namespace { | ||
| 364 | // we should maintain the original to maintain the wordexp etc. | ||
| 365 | string const fixup_image_spec(string const & str, extra_images const & extra) | ||
| 366 | { | ||
| 367 | - string dummy_archive_path; | ||
| 368 | + std::vector<std::string> const dummy_archive_path; | ||
| 369 | // FIXME: what todo if an error in find_image_path() ? | ||
| 370 | image_error error; | ||
| 371 | return find_image_path(dummy_archive_path, str, extra, error); | ||
| 372 | Index: oprofile/libpp/xml_utils.cpp | ||
| 373 | =================================================================== | ||
| 374 | --- oprofile.orig/libpp/xml_utils.cpp | ||
| 375 | +++ oprofile/libpp/xml_utils.cpp | ||
| 376 | @@ -111,10 +111,10 @@ string get_cpu_num(size_t pclass) | ||
| 377 | |||
| 378 | xml_utils::xml_utils(format_output::xml_formatter * xo, | ||
| 379 | symbol_collection const & s, size_t nc, | ||
| 380 | - string_filter * sf, string const & ap) | ||
| 381 | + string_filter * sf, std::vector<std::string> const & ap) | ||
| 382 | : | ||
| 383 | symbol_filter(sf), | ||
| 384 | - archive_path(ap), | ||
| 385 | + archive_paths(ap), | ||
| 386 | has_subclasses(false), | ||
| 387 | bytes_index(0) | ||
| 388 | { | ||
| 389 | @@ -379,11 +379,11 @@ xml_utils::output_symbol_bytes(ostream & | ||
| 390 | string const & image_name = get_image_name(symb->image_name, true); | ||
| 391 | op_bfd * abfd = NULL; | ||
| 392 | if (symb->spu_offset) | ||
| 393 | - abfd = new op_bfd(archive_path, symb->spu_offset, | ||
| 394 | + abfd = new op_bfd(archive_paths, symb->spu_offset, | ||
| 395 | get_image_name(symb->embedding_filename, true), | ||
| 396 | *symbol_filter, ok); | ||
| 397 | else | ||
| 398 | - abfd = new op_bfd(archive_path, image_name, *symbol_filter, ok); | ||
| 399 | + abfd = new op_bfd(archive_paths, image_name, *symbol_filter, ok); | ||
| 400 | if (!ok) { | ||
| 401 | report_image_error(image_name, image_format_failure, false); | ||
| 402 | delete abfd; | ||
| 403 | Index: oprofile/libpp/xml_utils.h | ||
| 404 | =================================================================== | ||
| 405 | --- oprofile.orig/libpp/xml_utils.h | ||
| 406 | +++ oprofile/libpp/xml_utils.h | ||
| 407 | @@ -22,7 +22,7 @@ class xml_utils { | ||
| 408 | public: | ||
| 409 | xml_utils(format_output::xml_formatter * xo, | ||
| 410 | symbol_collection const & s, size_t nc, | ||
| 411 | - string_filter * sf, std::string const & ap); | ||
| 412 | + string_filter * sf, std::vector<std::string> const & ap); | ||
| 413 | // these members are static because they are invoked before | ||
| 414 | // the xml_utils object has been created | ||
| 415 | static std::string get_timer_setup(size_t count); | ||
| 416 | @@ -51,7 +51,7 @@ public: | ||
| 417 | private: | ||
| 418 | string_filter * symbol_filter; | ||
| 419 | bool multiple_events; | ||
| 420 | - std::string archive_path; | ||
| 421 | + std::vector<std::string> const & archive_paths; | ||
| 422 | bool has_subclasses; | ||
| 423 | size_t bytes_index; | ||
| 424 | static bool has_nonzero_masks; | ||
| 425 | Index: oprofile/libutil++/op_bfd.cpp | ||
| 426 | =================================================================== | ||
| 427 | --- oprofile.orig/libutil++/op_bfd.cpp | ||
| 428 | +++ oprofile/libutil++/op_bfd.cpp | ||
| 429 | @@ -27,6 +27,7 @@ | ||
| 430 | #include "string_filter.h" | ||
| 431 | #include "stream_util.h" | ||
| 432 | #include "cverb.h" | ||
| 433 | +#include "file_manip.h" | ||
| 434 | |||
| 435 | using namespace std; | ||
| 436 | |||
| 437 | @@ -87,11 +88,11 @@ bool op_bfd_symbol::operator<(op_bfd_sym | ||
| 438 | } | ||
| 439 | |||
| 440 | |||
| 441 | -op_bfd::op_bfd(string const & archive, string const & fname, | ||
| 442 | +op_bfd::op_bfd(std::vector<std::string> const & archive, string const & fname, | ||
| 443 | string_filter const & symbol_filter, bool & ok) | ||
| 444 | : | ||
| 445 | filename(fname), | ||
| 446 | - archive_path(archive), | ||
| 447 | + archive_paths(archive), | ||
| 448 | file_size(-1) | ||
| 449 | { | ||
| 450 | int fd; | ||
| 451 | @@ -102,7 +103,7 @@ op_bfd::op_bfd(string const & archive, s | ||
| 452 | symbols_found_t symbols; | ||
| 453 | asection const * sect; | ||
| 454 | |||
| 455 | - string const image_path = archive_path + filename; | ||
| 456 | + string const image_path = op_findfile(archive_paths, filename); | ||
| 457 | |||
| 458 | cverb << vbfd << "op_bfd ctor for " << image_path << endl; | ||
| 459 | |||
| 460 | @@ -321,8 +322,8 @@ bool op_bfd::has_debug_info() const | ||
| 461 | return debug_info.reset(true); | ||
| 462 | |||
| 463 | // check to see if there is an .debug file | ||
| 464 | - string const global(archive_path + DEBUGDIR); | ||
| 465 | - string const image_path = archive_path + filename; | ||
| 466 | + string const global(op_findfile(archive_paths, DEBUGDIR)); | ||
| 467 | + string const image_path = op_findfile(archive_paths, filename); | ||
| 468 | string const dirname(image_path.substr(0, image_path.rfind('/'))); | ||
| 469 | |||
| 470 | if (find_separate_debug_file(ibfd.abfd, dirname, global, debug_filename)) { | ||
| 471 | Index: oprofile/libutil++/op_bfd.h | ||
| 472 | =================================================================== | ||
| 473 | --- oprofile.orig/libutil++/op_bfd.h | ||
| 474 | +++ oprofile/libutil++/op_bfd.h | ||
| 475 | @@ -89,14 +89,14 @@ private: | ||
| 476 | class op_bfd { | ||
| 477 | public: | ||
| 478 | /** | ||
| 479 | - * @param archive_path oparchive prefix path | ||
| 480 | + * @param archive_paths oparchive prefix paths | ||
| 481 | * @param filename the name of the image file | ||
| 482 | * @param symbol_filter filter to apply to symbols | ||
| 483 | * @param ok in-out parameter: on in, if not set, don't | ||
| 484 | * open the bfd (because it's not there or whatever). On out, | ||
| 485 | * it's set to false if the bfd couldn't be loaded. | ||
| 486 | */ | ||
| 487 | - op_bfd(std::string const & archive_path, | ||
| 488 | + op_bfd(std::vector<std::string> const & archive_paths, | ||
| 489 | std::string const & filename, | ||
| 490 | string_filter const & symbol_filter, | ||
| 491 | bool & ok); | ||
| 492 | @@ -105,7 +105,7 @@ public: | ||
| 493 | * This constructor is used when processing an SPU profile | ||
| 494 | * where the SPU ELF is embedded within the PPE binary. | ||
| 495 | */ | ||
| 496 | - op_bfd(std::string const & archive_path, | ||
| 497 | + op_bfd(std::vector<std::string> const & archive_paths, | ||
| 498 | uint64_t spu_offset, | ||
| 499 | std::string const & filename, | ||
| 500 | string_filter const & symbol_filter, | ||
| 501 | @@ -243,8 +243,8 @@ private: | ||
| 502 | /// filename we open (not including archive path) | ||
| 503 | std::string filename; | ||
| 504 | |||
| 505 | - /// path to archive | ||
| 506 | - std::string archive_path; | ||
| 507 | + /// paths to archive | ||
| 508 | + std::vector<std::string> archive_paths; | ||
| 509 | |||
| 510 | /// file size in bytes | ||
| 511 | off_t file_size; | ||
| 512 | Index: oprofile/libutil++/op_spu_bfd.cpp | ||
| 513 | =================================================================== | ||
| 514 | --- oprofile.orig/libutil++/op_spu_bfd.cpp | ||
| 515 | +++ oprofile/libutil++/op_spu_bfd.cpp | ||
| 516 | @@ -19,6 +19,7 @@ | ||
| 517 | #include "op_libiberty.h" | ||
| 518 | #include "string_filter.h" | ||
| 519 | #include "cverb.h" | ||
| 520 | +#include "file_manip.h" | ||
| 521 | |||
| 522 | using namespace std; | ||
| 523 | |||
| 524 | @@ -29,11 +30,11 @@ extern verbose vbfd; | ||
| 525 | * constructor in libutil++/op_bfd.cpp, with the additional processing | ||
| 526 | * needed to handle an embedded spu offset. | ||
| 527 | */ | ||
| 528 | -op_bfd::op_bfd(string const & archive, uint64_t spu_offset, | ||
| 529 | +op_bfd::op_bfd(std::vector<std::string> const & archive, uint64_t spu_offset, | ||
| 530 | string const & fname, | ||
| 531 | string_filter const & symbol_filter, bool & ok) | ||
| 532 | : | ||
| 533 | - archive_path(archive), | ||
| 534 | + archive_paths(archive), | ||
| 535 | file_size(-1), | ||
| 536 | embedding_filename(fname) | ||
| 537 | { | ||
| 538 | @@ -48,7 +49,7 @@ op_bfd::op_bfd(string const & archive, u | ||
| 539 | symbols_found_t symbols; | ||
| 540 | asection const * sect; | ||
| 541 | |||
| 542 | - string const image_path = archive_path + fname; | ||
| 543 | + string const image_path = op_findfile(archive_paths, fname); | ||
| 544 | |||
| 545 | cverb << vbfd << "op_bfd ctor for " << image_path << endl; | ||
| 546 | if (!ok) | ||
| 547 | Index: oprofile/pp/opannotate_options.cpp | ||
| 548 | =================================================================== | ||
| 549 | --- oprofile.orig/pp/opannotate_options.cpp | ||
| 550 | +++ oprofile/pp/opannotate_options.cpp | ||
| 551 | @@ -26,7 +26,7 @@ using namespace std; | ||
| 552 | profile_classes classes; | ||
| 553 | |||
| 554 | namespace options { | ||
| 555 | - string archive_path; | ||
| 556 | + vector<string> archive_paths; | ||
| 557 | demangle_type demangle = dmt_normal; | ||
| 558 | string output_dir; | ||
| 559 | vector<string> search_dirs; | ||
| 560 | @@ -87,6 +87,7 @@ popt::option options_array[] = { | ||
| 561 | void handle_options(options::spec const & spec) | ||
| 562 | { | ||
| 563 | using namespace options; | ||
| 564 | + string archive_path; | ||
| 565 | |||
| 566 | if (spec.first.size()) { | ||
| 567 | cerr << "differential profiles not allowed" << endl; | ||
| 568 | @@ -125,7 +126,9 @@ void handle_options(options::spec const | ||
| 569 | list<string> sample_files = pspec.generate_file_list(exclude_dependent, true); | ||
| 570 | |||
| 571 | archive_path = pspec.get_archive_path(); | ||
| 572 | + archive_paths.push_back(archive_path); | ||
| 573 | cverb << vsfile << "Archive: " << archive_path << endl; | ||
| 574 | + archive_paths.push_back(options::root_path); | ||
| 575 | |||
| 576 | cverb << vsfile << "Matched sample files: " << sample_files.size() | ||
| 577 | << endl; | ||
| 578 | Index: oprofile/pp/opannotate_options.h | ||
| 579 | =================================================================== | ||
| 580 | --- oprofile.orig/pp/opannotate_options.h | ||
| 581 | +++ oprofile/pp/opannotate_options.h | ||
| 582 | @@ -21,7 +21,7 @@ | ||
| 583 | class profile_classes; | ||
| 584 | |||
| 585 | namespace options { | ||
| 586 | - extern std::string archive_path; | ||
| 587 | + extern std::vector<std::string> archive_paths; | ||
| 588 | extern demangle_type demangle; | ||
| 589 | extern bool source; | ||
| 590 | extern bool assembly; | ||
| 591 | Index: oprofile/pp/oparchive.cpp | ||
| 592 | =================================================================== | ||
| 593 | --- oprofile.orig/pp/oparchive.cpp | ||
| 594 | +++ oprofile/pp/oparchive.cpp | ||
| 595 | @@ -59,7 +59,7 @@ int oparchive(options::spec const & spec | ||
| 596 | |||
| 597 | /* copy over each of the executables and the debuginfo files */ | ||
| 598 | list<inverted_profile> iprofiles | ||
| 599 | - = invert_profiles(options::archive_path, classes, | ||
| 600 | + = invert_profiles(options::archive_paths, classes, | ||
| 601 | options::extra_found_images); | ||
| 602 | |||
| 603 | report_image_errors(iprofiles); | ||
| 604 | @@ -86,7 +86,7 @@ int oparchive(options::spec const & spec | ||
| 605 | } | ||
| 606 | |||
| 607 | /* Copy actual executable files */ | ||
| 608 | - copy_one_file(it->error, options::archive_path + exe_name, | ||
| 609 | + copy_one_file(it->error, op_findfile(options::archive_paths, exe_name), | ||
| 610 | exe_archive_file); | ||
| 611 | |||
| 612 | /* If there are any debuginfo files, copy them over. | ||
| 613 | @@ -95,11 +95,10 @@ int oparchive(options::spec const & spec | ||
| 614 | * to avoid overwriting files with the same name. The | ||
| 615 | * /usr/lib/debug search path is not going to work. | ||
| 616 | */ | ||
| 617 | - bfd * ibfd = open_bfd(options::archive_path + exe_name); | ||
| 618 | + bfd * ibfd = open_bfd(op_findfile(options::archive_paths, exe_name)); | ||
| 619 | if (ibfd) { | ||
| 620 | - string global(options::archive_path + DEBUGDIR); | ||
| 621 | - string dirname = op_dirname(options::archive_path + | ||
| 622 | - exe_name); | ||
| 623 | + string global(op_findfile(options::archive_paths, DEBUGDIR)); | ||
| 624 | + string dirname = op_dirname(op_findfile(options::archive_paths, exe_name)); | ||
| 625 | string debug_filename; | ||
| 626 | if (find_separate_debug_file(ibfd, dirname, global, | ||
| 627 | debug_filename)) { | ||
| 628 | @@ -130,8 +129,8 @@ int oparchive(options::spec const & spec | ||
| 629 | string sample_name = *sit; | ||
| 630 | string sample_base = sample_name; | ||
| 631 | /* Get rid of the the archive_path from the name */ | ||
| 632 | - sample_base.replace(sample_base.find(options::archive_path), | ||
| 633 | - options::archive_path.size(), ""); | ||
| 634 | + sample_base.replace(sample_base.find(options::archive_paths[0]), | ||
| 635 | + options::archive_paths[0].size(), ""); | ||
| 636 | string sample_archive_file = options::outdirectory + sample_base; | ||
| 637 | |||
| 638 | cverb << vdebug << (sample_name) << endl; | ||
| 639 | @@ -149,12 +148,12 @@ int oparchive(options::spec const & spec | ||
| 640 | |||
| 641 | /* copy over the /var/lib/oprofile/abi file if it exists */ | ||
| 642 | string abi_name = "/var/lib/oprofile/abi"; | ||
| 643 | - copy_one_file(image_ok, options::archive_path + abi_name, | ||
| 644 | + copy_one_file(image_ok, op_findfile(options::archive_paths, abi_name), | ||
| 645 | options::outdirectory + abi_name); | ||
| 646 | |||
| 647 | /* copy over the /var/lib/oprofile/oprofiled.log file */ | ||
| 648 | string log_name = "/var/lib/oprofile/oprofiled.log"; | ||
| 649 | - copy_one_file(image_ok, options::archive_path + log_name, | ||
| 650 | + copy_one_file(image_ok, op_findfile(options::archive_paths, log_name), | ||
| 651 | options::outdirectory + log_name); | ||
| 652 | |||
| 653 | return 0; | ||
| 654 | Index: oprofile/pp/oparchive_options.cpp | ||
| 655 | =================================================================== | ||
| 656 | --- oprofile.orig/pp/oparchive_options.cpp | ||
| 657 | +++ oprofile/pp/oparchive_options.cpp | ||
| 658 | @@ -31,7 +31,7 @@ profile_classes classes; | ||
| 659 | list<string> sample_files; | ||
| 660 | |||
| 661 | namespace options { | ||
| 662 | - string archive_path; | ||
| 663 | + std::vector<std::string> archive_paths; | ||
| 664 | demangle_type demangle = dmt_normal; | ||
| 665 | bool exclude_dependent; | ||
| 666 | merge_option merge_by; | ||
| 667 | @@ -75,6 +75,7 @@ void check_options() | ||
| 668 | void handle_options(options::spec const & spec) | ||
| 669 | { | ||
| 670 | using namespace options; | ||
| 671 | + std::string archive_path; | ||
| 672 | |||
| 673 | if (spec.first.size()) { | ||
| 674 | cerr << "differential profiles not allowed" << endl; | ||
| 675 | @@ -96,7 +97,9 @@ void handle_options(options::spec const | ||
| 676 | sample_files = pspec.generate_file_list(exclude_dependent, false); | ||
| 677 | |||
| 678 | archive_path = pspec.get_archive_path(); | ||
| 679 | + archive_paths.push_back(archive_path); | ||
| 680 | cverb << vsfile << "Archive: " << archive_path << endl; | ||
| 681 | + archive_paths.push_back(options::root_path); | ||
| 682 | |||
| 683 | cverb << vsfile << "Matched sample files: " << sample_files.size() | ||
| 684 | << endl; | ||
| 685 | Index: oprofile/pp/oparchive_options.h | ||
| 686 | =================================================================== | ||
| 687 | --- oprofile.orig/pp/oparchive_options.h | ||
| 688 | +++ oprofile/pp/oparchive_options.h | ||
| 689 | @@ -18,7 +18,7 @@ class profile_classes; | ||
| 690 | class merge_option; | ||
| 691 | |||
| 692 | namespace options { | ||
| 693 | - extern std::string archive_path; | ||
| 694 | + extern std::vector<std::string> archive_paths; | ||
| 695 | extern bool exclude_dependent; | ||
| 696 | extern merge_option merge_by; | ||
| 697 | extern std::string outdirectory; | ||
| 698 | Index: oprofile/pp/opgprof_options.cpp | ||
| 699 | =================================================================== | ||
| 700 | --- oprofile.orig/pp/opgprof_options.cpp | ||
| 701 | +++ oprofile/pp/opgprof_options.cpp | ||
| 702 | @@ -26,7 +26,7 @@ profile_classes classes; | ||
| 703 | inverted_profile image_profile; | ||
| 704 | |||
| 705 | namespace options { | ||
| 706 | - string archive_path; | ||
| 707 | + std::vector<std::string> archive_paths; | ||
| 708 | string gmon_filename = "gmon.out"; | ||
| 709 | |||
| 710 | // Ugly, for build only | ||
| 711 | @@ -71,7 +71,7 @@ bool try_merge_profiles(profile_spec con | ||
| 712 | size_t nr_classes = classes.v.size(); | ||
| 713 | |||
| 714 | list<inverted_profile> iprofiles | ||
| 715 | - = invert_profiles(options::archive_path, classes, | ||
| 716 | + = invert_profiles(options::archive_paths, classes, | ||
| 717 | options::extra_found_images); | ||
| 718 | |||
| 719 | if (nr_classes == 1 && iprofiles.size() == 1) { | ||
| 720 | @@ -104,6 +104,8 @@ bool try_merge_profiles(profile_spec con | ||
| 721 | |||
| 722 | void handle_options(options::spec const & spec) | ||
| 723 | { | ||
| 724 | + string archive_path; | ||
| 725 | + | ||
| 726 | if (spec.first.size()) { | ||
| 727 | cerr << "differential profiles not allowed" << endl; | ||
| 728 | exit(EXIT_FAILURE); | ||
| 729 | @@ -112,8 +114,10 @@ void handle_options(options::spec const | ||
| 730 | profile_spec const pspec = | ||
| 731 | profile_spec::create(spec.common, options::extra_found_images); | ||
| 732 | |||
| 733 | - options::archive_path = pspec.get_archive_path(); | ||
| 734 | - cverb << vsfile << "Archive: " << options::archive_path << endl; | ||
| 735 | + archive_path = pspec.get_archive_path(); | ||
| 736 | + options::archive_paths.push_back(archive_path); | ||
| 737 | + cverb << vsfile << "Archive: " << archive_path << endl; | ||
| 738 | + options::archive_paths.push_back(options::root_path); | ||
| 739 | |||
| 740 | cverb << vsfile << "output filename: " << options::gmon_filename | ||
| 741 | << endl; | ||
| 742 | Index: oprofile/pp/opgprof_options.h | ||
| 743 | =================================================================== | ||
| 744 | --- oprofile.orig/pp/opgprof_options.h | ||
| 745 | +++ oprofile/pp/opgprof_options.h | ||
| 746 | @@ -17,7 +17,7 @@ | ||
| 747 | #include "common_option.h" | ||
| 748 | |||
| 749 | namespace options { | ||
| 750 | - extern std::string archive_path; | ||
| 751 | + extern std::vector<std::string> archive_paths; | ||
| 752 | extern std::string gmon_filename; | ||
| 753 | } | ||
| 754 | |||
| 755 | Index: oprofile/pp/opreport_options.cpp | ||
| 756 | =================================================================== | ||
| 757 | --- oprofile.orig/pp/opreport_options.cpp | ||
| 758 | +++ oprofile/pp/opreport_options.cpp | ||
| 759 | @@ -32,8 +32,8 @@ profile_classes classes; | ||
| 760 | profile_classes classes2; | ||
| 761 | |||
| 762 | namespace options { | ||
| 763 | - string archive_path; | ||
| 764 | - string archive_path2; | ||
| 765 | + std::vector<std::string> archive_paths; | ||
| 766 | + std::vector<std::string> archive_paths2; | ||
| 767 | demangle_type demangle = dmt_normal; | ||
| 768 | bool symbols; | ||
| 769 | bool callgraph; | ||
| 770 | @@ -314,16 +314,19 @@ void handle_options(options::spec const | ||
| 771 | symbol_filter = string_filter(include_symbols, exclude_symbols); | ||
| 772 | |||
| 773 | if (!spec.first.size()) { | ||
| 774 | - archive_path = process_spec(classes, spec.common); | ||
| 775 | + archive_paths.push_back(process_spec(classes, spec.common)); | ||
| 776 | + archive_paths.push_back(options::root_path); | ||
| 777 | } else { | ||
| 778 | if (options::xml) { | ||
| 779 | cerr << "differential profiles are incompatible with --xml" << endl; | ||
| 780 | exit(EXIT_FAILURE); | ||
| 781 | } | ||
| 782 | cverb << vsfile << "profile spec 1:" << endl; | ||
| 783 | - archive_path = process_spec(classes, spec.first); | ||
| 784 | + archive_paths.push_back(process_spec(classes, spec.first)); | ||
| 785 | + archive_paths.push_back(options::root_path); | ||
| 786 | cverb << vsfile << "profile spec 2:" << endl; | ||
| 787 | - archive_path2 = process_spec(classes2, spec.second); | ||
| 788 | + archive_paths2.push_back(process_spec(classes2, spec.second)); | ||
| 789 | + archive_paths2.push_back(options::root_path); | ||
| 790 | |||
| 791 | if (!classes.matches(classes2)) { | ||
| 792 | cerr << "profile classes are incompatible" << endl; | ||
| 793 | Index: oprofile/pp/opreport_options.h | ||
| 794 | =================================================================== | ||
| 795 | --- oprofile.orig/pp/opreport_options.h | ||
| 796 | +++ oprofile/pp/opreport_options.h | ||
| 797 | @@ -24,8 +24,8 @@ class profile_classes; | ||
| 798 | class merge_option; | ||
| 799 | |||
| 800 | namespace options { | ||
| 801 | - extern std::string archive_path; | ||
| 802 | - extern std::string archive_path2; | ||
| 803 | + extern std::vector<std::string> archive_paths; | ||
| 804 | + extern std::vector<std::string> archive_paths2; | ||
| 805 | extern demangle_type demangle; | ||
| 806 | extern bool symbols; | ||
| 807 | extern bool callgraph; | ||
| 808 | Index: oprofile/libutil++/file_manip.cpp | ||
| 809 | =================================================================== | ||
| 810 | --- oprofile.orig/libutil++/file_manip.cpp | ||
| 811 | +++ oprofile/libutil++/file_manip.cpp | ||
| 812 | @@ -205,3 +205,14 @@ string op_basename(string const & path_n | ||
| 813 | |||
| 814 | return erase_to_last_of(result, '/'); | ||
| 815 | } | ||
| 816 | + | ||
| 817 | +string op_findfile(const vector<string> & paths, string const & file) | ||
| 818 | +{ | ||
| 819 | + for (vector<string>::const_iterator it = paths.begin(); it!=paths.end(); ++it) | ||
| 820 | + { | ||
| 821 | + if (op_file_readable(*it + file)) | ||
| 822 | + return *it + file; | ||
| 823 | + } | ||
| 824 | + return ""; | ||
| 825 | +} | ||
| 826 | + | ||
| 827 | Index: oprofile/libutil++/file_manip.h | ||
| 828 | =================================================================== | ||
| 829 | --- oprofile.orig/libutil++/file_manip.h | ||
| 830 | +++ oprofile/libutil++/file_manip.h | ||
| 831 | @@ -12,6 +12,7 @@ | ||
| 832 | #ifndef FILE_MANIP_H | ||
| 833 | #define FILE_MANIP_H | ||
| 834 | |||
| 835 | +#include <vector> | ||
| 836 | #include <string> | ||
| 837 | #include <list> | ||
| 838 | |||
| 839 | @@ -86,4 +87,14 @@ std::string op_dirname(std::string const | ||
| 840 | */ | ||
| 841 | std::string op_basename(std::string const & path_name); | ||
| 842 | |||
| 843 | +/** | ||
| 844 | + * | ||
| 845 | + * op_findfile - search a set of paths for file | ||
| 846 | + * @param paths paths to search | ||
| 847 | + * @param file filename to search for | ||
| 848 | + * | ||
| 849 | + * Returns the path to the first matching file or an empty string if not found. | ||
| 850 | + */ | ||
| 851 | +std::string op_findfile(const std::vector<std::string> & paths, std::string const & file); | ||
| 852 | + | ||
| 853 | #endif /* !FILE_MANIP_H */ | ||
| 854 | Index: oprofile/pp/common_option.cpp | ||
| 855 | =================================================================== | ||
| 856 | --- oprofile.orig/pp/common_option.cpp | ||
| 857 | +++ oprofile/pp/common_option.cpp | ||
| 858 | @@ -30,6 +30,7 @@ namespace options { | ||
| 859 | string session_dir = OP_SESSION_DIR_DEFAULT; | ||
| 860 | string command_options; | ||
| 861 | vector<string> image_path; | ||
| 862 | + string root_path; | ||
| 863 | } | ||
| 864 | |||
| 865 | namespace { | ||
| 866 | @@ -44,6 +45,8 @@ popt::option common_options_array[] = { | ||
| 867 | "specify session path to hold samples database and session data (" OP_SESSION_DIR_DEFAULT ")", "path"), | ||
| 868 | popt::option(options::image_path, "image-path", 'p', | ||
| 869 | "comma-separated path to search missing binaries", "path"), | ||
| 870 | + popt::option(options::root_path, "root", 'R', | ||
| 871 | + "path to filesystem to search for missing binaries", "path"), | ||
| 872 | }; | ||
| 873 | |||
| 874 | |||
| 875 | Index: oprofile/pp/common_option.h | ||
| 876 | =================================================================== | ||
| 877 | --- oprofile.orig/pp/common_option.h | ||
| 878 | +++ oprofile/pp/common_option.h | ||
| 879 | @@ -26,6 +26,7 @@ namespace options { | ||
| 880 | extern std::string threshold_opt; | ||
| 881 | extern std::string command_options; | ||
| 882 | extern std::vector<std::string> image_path; | ||
| 883 | + extern std::string root_path; | ||
| 884 | |||
| 885 | struct spec { | ||
| 886 | std::list<std::string> common; | ||
| 887 | Index: oprofile/pp/opreport.cpp | ||
| 888 | =================================================================== | ||
| 889 | --- oprofile.orig/pp/opreport.cpp | ||
| 890 | +++ oprofile/pp/opreport.cpp | ||
| 891 | @@ -403,7 +403,7 @@ void output_symbols(profile_container co | ||
| 892 | |||
| 893 | if (options::xml) { | ||
| 894 | xml_support = new xml_utils(xml_out, symbols, nr_classes, | ||
| 895 | - &options::symbol_filter, options::archive_path); | ||
| 896 | + &options::symbol_filter, options::archive_paths); | ||
| 897 | xml_out->output(cout); | ||
| 898 | } else { | ||
| 899 | text_out->output(cout, symbols); | ||
| 900 | @@ -479,7 +479,7 @@ void output_cg_symbols(callgraph_contain | ||
| 901 | |||
| 902 | if (options::xml) { | ||
| 903 | xml_support = new xml_utils(xml_out, symbols, nr_classes, | ||
| 904 | - &options::symbol_filter, options::archive_path); | ||
| 905 | + &options::symbol_filter, options::archive_paths); | ||
| 906 | xml_out->output(cout); | ||
| 907 | } else { | ||
| 908 | text_out->output(cout, symbols); | ||
| 909 | @@ -511,7 +511,7 @@ int opreport(options::spec const & spec) | ||
| 910 | } | ||
| 911 | |||
| 912 | list<inverted_profile> iprofiles | ||
| 913 | - = invert_profiles(options::archive_path, classes, | ||
| 914 | + = invert_profiles(options::archive_paths, classes, | ||
| 915 | options::extra_found_images); | ||
| 916 | |||
| 917 | report_image_errors(iprofiles); | ||
| 918 | @@ -535,11 +535,11 @@ int opreport(options::spec const & spec) | ||
| 919 | list<inverted_profile>::iterator const end = iprofiles.end(); | ||
| 920 | |||
| 921 | for (; it != end; ++it) | ||
| 922 | - populate_for_image(options::archive_path, pc1, | ||
| 923 | + populate_for_image(options::archive_paths, pc1, | ||
| 924 | *it, options::symbol_filter, 0); | ||
| 925 | |||
| 926 | list<inverted_profile> iprofiles2 | ||
| 927 | - = invert_profiles(options::archive_path2, classes2, | ||
| 928 | + = invert_profiles(options::archive_paths2, classes2, | ||
| 929 | options::extra_found_images); | ||
| 930 | |||
| 931 | report_image_errors(iprofiles2); | ||
| 932 | @@ -550,13 +550,13 @@ int opreport(options::spec const & spec) | ||
| 933 | list<inverted_profile>::iterator const end2 = iprofiles2.end(); | ||
| 934 | |||
| 935 | for (; it2 != end2; ++it2) | ||
| 936 | - populate_for_image(options::archive_path2, pc2, | ||
| 937 | + populate_for_image(options::archive_paths2, pc2, | ||
| 938 | *it2, options::symbol_filter, 0); | ||
| 939 | |||
| 940 | output_diff_symbols(pc1, pc2, multiple_apps); | ||
| 941 | } else if (options::callgraph) { | ||
| 942 | callgraph_container cg_container; | ||
| 943 | - cg_container.populate(options::archive_path, iprofiles, | ||
| 944 | + cg_container.populate(options::archive_paths, iprofiles, | ||
| 945 | options::extra_found_images, | ||
| 946 | options::debug_info, options::threshold, | ||
| 947 | options::merge_by.lib, options::symbol_filter); | ||
| 948 | @@ -569,7 +569,7 @@ int opreport(options::spec const & spec) | ||
| 949 | list<inverted_profile>::iterator const end = iprofiles.end(); | ||
| 950 | |||
| 951 | for (; it != end; ++it) | ||
| 952 | - populate_for_image(options::archive_path, samples, | ||
| 953 | + populate_for_image(options::archive_paths, samples, | ||
| 954 | *it, options::symbol_filter, 0); | ||
| 955 | |||
| 956 | output_symbols(samples, multiple_apps); | ||
| 957 | Index: oprofile/pp/opannotate.cpp | ||
| 958 | =================================================================== | ||
| 959 | --- oprofile.orig/pp/opannotate.cpp | ||
| 960 | +++ oprofile/pp/opannotate.cpp | ||
| 961 | @@ -690,7 +690,7 @@ int opannotate(options::spec const & spe | ||
| 962 | list<string> images; | ||
| 963 | |||
| 964 | list<inverted_profile> iprofiles | ||
| 965 | - = invert_profiles(options::archive_path, classes, | ||
| 966 | + = invert_profiles(options::archive_paths, classes, | ||
| 967 | options::extra_found_images); | ||
| 968 | |||
| 969 | report_image_errors(iprofiles); | ||
| 970 | @@ -701,7 +701,7 @@ int opannotate(options::spec const & spe | ||
| 971 | bool debug_info = false; | ||
| 972 | for (; it != end; ++it) { | ||
| 973 | bool tmp = false; | ||
| 974 | - populate_for_image(options::archive_path, *samples, *it, | ||
| 975 | + populate_for_image(options::archive_paths, *samples, *it, | ||
| 976 | options::symbol_filter, &tmp); | ||
| 977 | images.push_back(it->image); | ||
| 978 | if (tmp) | ||
| 979 | Index: oprofile/pp/opgprof.cpp | ||
| 980 | =================================================================== | ||
| 981 | --- oprofile.orig/pp/opgprof.cpp | ||
| 982 | +++ oprofile/pp/opgprof.cpp | ||
| 983 | @@ -282,7 +282,7 @@ int opgprof(options::spec const & spec) | ||
| 984 | |||
| 985 | bool ok = image_profile.error == image_ok; | ||
| 986 | // FIXME: symbol_filter would be allowed through option | ||
| 987 | - op_bfd abfd(options::archive_path, image_profile.image, | ||
| 988 | + op_bfd abfd(options::archive_paths, image_profile.image, | ||
| 989 | string_filter(), ok); | ||
| 990 | if (!ok && image_profile.error == image_ok) | ||
| 991 | image_profile.error = image_format_failure; | ||
| 992 | Index: oprofile/doc/opannotate.1.in | ||
| 993 | =================================================================== | ||
| 994 | --- oprofile.orig/doc/opannotate.1.in | ||
| 995 | +++ oprofile/doc/opannotate.1.in | ||
| 996 | @@ -50,6 +50,10 @@ Comma-separated list of additional paths | ||
| 997 | This is needed to find modules in kernels 2.6 and upwards. | ||
| 998 | .br | ||
| 999 | .TP | ||
| 1000 | +.BI "--root / -R [path]" | ||
| 1001 | +A path to a filesystem to search for additional binaries. | ||
| 1002 | +.br | ||
| 1003 | +.TP | ||
| 1004 | .BI "--include-file [files]" | ||
| 1005 | Only include files in the given comma-separated list of glob patterns. | ||
| 1006 | .br | ||
| 1007 | Index: oprofile/doc/oparchive.1.in | ||
| 1008 | =================================================================== | ||
| 1009 | --- oprofile.orig/doc/oparchive.1.in | ||
| 1010 | +++ oprofile/doc/oparchive.1.in | ||
| 1011 | @@ -42,6 +42,10 @@ Comma-separated list of additional paths | ||
| 1012 | This is needed to find modules in kernels 2.6 and upwards. | ||
| 1013 | .br | ||
| 1014 | .TP | ||
| 1015 | +.BI "--root / -R [path]" | ||
| 1016 | +A path to a filesystem to search for additional binaries. | ||
| 1017 | +.br | ||
| 1018 | +.TP | ||
| 1019 | .BI "--output-directory / -o [directory]" | ||
| 1020 | Output to the given directory. There is no default. This must be specified. | ||
| 1021 | .br | ||
| 1022 | Index: oprofile/doc/opgprof.1.in | ||
| 1023 | =================================================================== | ||
| 1024 | --- oprofile.orig/doc/opgprof.1.in | ||
| 1025 | +++ oprofile/doc/opgprof.1.in | ||
| 1026 | @@ -38,6 +38,10 @@ Comma-separated list of additional paths | ||
| 1027 | This is needed to find modules in kernels 2.6 and upwards. | ||
| 1028 | .br | ||
| 1029 | .TP | ||
| 1030 | +.BI "--root / -R [path]" | ||
| 1031 | +A path to a filesystem to search for additional binaries. | ||
| 1032 | +.br | ||
| 1033 | +.TP | ||
| 1034 | .BI "--threshold / -t [percentage]" | ||
| 1035 | Only output data for symbols that have more than the given percentage | ||
| 1036 | of total samples. | ||
| 1037 | Index: oprofile/doc/opreport.1.in | ||
| 1038 | =================================================================== | ||
| 1039 | --- oprofile.orig/doc/opreport.1.in | ||
| 1040 | +++ oprofile/doc/opreport.1.in | ||
| 1041 | @@ -61,6 +61,10 @@ Comma-separated list of additional paths | ||
| 1042 | This is needed to find modules in kernels 2.6 and upwards. | ||
| 1043 | .br | ||
| 1044 | .TP | ||
| 1045 | +.BI "--root / -R [path]" | ||
| 1046 | +A path to a filesystem to search for additional binaries. | ||
| 1047 | +.br | ||
| 1048 | +.TP | ||
| 1049 | .BI "--include-symbols / -i [symbols]" | ||
| 1050 | Only include symbols in the given comma-separated list. | ||
| 1051 | .br | ||
diff --git a/meta/packages/oprofile/oprofile_0.9.3.bb b/meta/packages/oprofile/oprofile_0.9.3.bb index ac7ba3b602..c4ea585c85 100644 --- a/meta/packages/oprofile/oprofile_0.9.3.bb +++ b/meta/packages/oprofile/oprofile_0.9.3.bb | |||
| @@ -4,12 +4,14 @@ of profiling all running code at low overhead." | |||
| 4 | LICENSE = "GPL" | 4 | LICENSE = "GPL" |
| 5 | DEPENDS = "popt binutils" | 5 | DEPENDS = "popt binutils" |
| 6 | RDEPENDS = "binutils-symlinks" | 6 | RDEPENDS = "binutils-symlinks" |
| 7 | PR = "r2" | 7 | PR = "r3" |
| 8 | 8 | ||
| 9 | SRC_URI = "${SOURCEFORGE_MIRROR}/oprofile/oprofile-${PV}.tar.gz \ | 9 | SRC_URI = "${SOURCEFORGE_MIRROR}/oprofile/oprofile-${PV}.tar.gz \ |
| 10 | file://armv6_fix.patch;patch=1 \ | ||
| 11 | file://oparchive_fix.patch;patch=1 \ | ||
| 12 | file://root_option.patch;patch=1 \ | ||
| 10 | file://opstart.patch;patch=1 \ | 13 | file://opstart.patch;patch=1 \ |
| 11 | file://armv6_fix.patch;patch=1 \ | 14 | file://acinclude.m4" |
| 12 | file://acinclude.m4" | ||
| 13 | S = "${WORKDIR}/oprofile-${PV}" | 15 | S = "${WORKDIR}/oprofile-${PV}" |
| 14 | 16 | ||
| 15 | inherit autotools | 17 | inherit autotools |
