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