summaryrefslogtreecommitdiffstats
path: root/meta/packages/oprofile/oprofile
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2008-07-14 16:24:22 +0000
committerRichard Purdie <richard@openedhand.com>2008-07-14 16:24:22 +0000
commit4c78c04481b6326a11499d10b139f2af35478ca0 (patch)
treec202e23adaae08da3925e07a461b7142ce021f03 /meta/packages/oprofile/oprofile
parent1166e112d0745fb6ef96d1ae4368bba9e36e5bc1 (diff)
downloadpoky-4c78c04481b6326a11499d10b139f2af35478ca0.tar.gz
oprofile: Fix patches to work with a more recent version
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4836 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/oprofile/oprofile')
-rw-r--r--meta/packages/oprofile/oprofile/fix_debug_search.patch222
-rw-r--r--meta/packages/oprofile/oprofile/op-cross-compile.patch136
-rw-r--r--meta/packages/oprofile/oprofile/opstart.patch34
3 files changed, 375 insertions, 17 deletions
diff --git a/meta/packages/oprofile/oprofile/fix_debug_search.patch b/meta/packages/oprofile/oprofile/fix_debug_search.patch
new file mode 100644
index 0000000000..b894908144
--- /dev/null
+++ b/meta/packages/oprofile/oprofile/fix_debug_search.patch
@@ -0,0 +1,222 @@
1Index: libutil++/bfd_support.cpp
2===================================================================
3RCS file: /cvsroot/oprofile/oprofile/libutil++/bfd_support.cpp,v
4retrieving revision 1.9
5diff -u -r1.9 bfd_support.cpp
6--- libutil++/bfd_support.cpp 29 Apr 2008 12:07:46 -0000 1.9
7+++ libutil++/bfd_support.cpp 2 Jul 2008 20:55:09 -0000
8@@ -12,8 +12,11 @@
9
10 #include "op_bfd.h"
11 #include "op_fileio.h"
12+#include "op_config.h"
13 #include "string_manip.h"
14+#include "file_manip.h"
15 #include "cverb.h"
16+#include "locate_images.h"
17
18 #include <cstdlib>
19 #include <cstring>
20@@ -42,13 +45,22 @@
21 }
22
23
24-bool separate_debug_file_exists(string const & name, unsigned long const crc)
25+bool separate_debug_file_exists(string & name, unsigned long const crc,
26+ extra_images const & extra)
27 {
28 unsigned long file_crc = 0;
29 // The size of 2 * 1024 elements for the buffer is arbitrary.
30 char buffer[2 * 1024];
31-
32- ifstream file(name.c_str());
33+
34+ image_error img_ok;
35+ string const image_path = extra.find_image_path(name, img_ok, true);
36+
37+ if (img_ok != image_ok)
38+ return false;
39+
40+ name = image_path;
41+
42+ ifstream file(image_path.c_str());
43 if (!file)
44 return false;
45
46@@ -281,40 +293,35 @@
47 }
48
49
50-bool find_separate_debug_file(bfd * ibfd, string const & dir_in,
51- string const & global_in, string & filename)
52+bool find_separate_debug_file(bfd * ibfd, string const & filepath_in,
53+ string & debug_filename, extra_images const & extra)
54 {
55- string dir(dir_in);
56- string global(global_in);
57+ string filepath(filepath_in);
58 string basename;
59 unsigned long crc32;
60
61 if (!get_debug_link_info(ibfd, basename, crc32))
62 return false;
63-
64- if (dir.size() > 0 && dir.at(dir.size() - 1) != '/')
65- dir += '/';
66-
67- if (global.size() > 0 && global.at(global.size() - 1) != '/')
68- global += '/';
69+
70+ // Work out the image file's directory prefix
71+ string filedir = op_dirname(filepath);
72+ // Make sure it starts with /
73+ if (filedir.size() > 0 && filedir.at(filedir.size() - 1) != '/')
74+ filedir += '/';
75+
76+ string first_try(filedir + ".debug/" + basename);
77+ string second_try(DEBUGDIR + filedir + basename);
78+ string third_try(filedir + basename);
79
80 cverb << vbfd << "looking for debugging file " << basename
81 << " with crc32 = " << hex << crc32 << endl;
82-
83- string first_try(dir + basename);
84- string second_try(dir + ".debug/" + basename);
85-
86- if (dir.size() > 0 && dir[0] == '/')
87- dir = dir.substr(1);
88
89- string third_try(global + dir + basename);
90-
91- if (separate_debug_file_exists(first_try, crc32))
92- filename = first_try;
93- else if (separate_debug_file_exists(second_try, crc32))
94- filename = second_try;
95- else if (separate_debug_file_exists(third_try, crc32))
96- filename = third_try;
97+ if (separate_debug_file_exists(first_try, crc32, extra))
98+ debug_filename = first_try;
99+ else if (separate_debug_file_exists(second_try, crc32, extra))
100+ debug_filename = second_try;
101+ else if (separate_debug_file_exists(third_try, crc32, extra))
102+ debug_filename = third_try;
103 else
104 return false;
105
106Index: libutil++/bfd_support.h
107===================================================================
108RCS file: /cvsroot/oprofile/oprofile/libutil++/bfd_support.h,v
109retrieving revision 1.5
110diff -u -r1.5 bfd_support.h
111--- libutil++/bfd_support.h 28 Apr 2008 21:23:25 -0000 1.5
112+++ libutil++/bfd_support.h 2 Jul 2008 20:55:09 -0000
113@@ -13,6 +13,7 @@
114
115 #include "utility.h"
116 #include "op_types.h"
117+#include "locate_images.h"
118
119 #include <bfd.h>
120 #include <stdint.h>
121@@ -84,9 +85,9 @@
122 */
123 extern bool
124 find_separate_debug_file(bfd * ibfd,
125- std::string const & dir_in,
126- std::string const & global_in,
127- std::string & filename);
128+ std::string const & filepath_in,
129+ std::string & debug_filename,
130+ extra_images const & extra);
131
132 /// open the given BFD
133 bfd * open_bfd(std::string const & file);
134Index: libutil++/op_bfd.cpp
135===================================================================
136RCS file: /cvsroot/oprofile/oprofile/libutil++/op_bfd.cpp,v
137retrieving revision 1.83
138diff -u -r1.83 op_bfd.cpp
139--- libutil++/op_bfd.cpp 19 May 2008 23:15:04 -0000 1.83
140+++ libutil++/op_bfd.cpp 2 Jul 2008 20:55:09 -0000
141@@ -97,6 +97,7 @@
142 :
143 filename(fname),
144 archive_path(extra_images.get_archive_path()),
145+ extra_found_images(extra_images),
146 file_size(-1),
147 anon_obj(false)
148 {
149@@ -341,11 +342,8 @@
150 return debug_info.reset(true);
151
152 // check to see if there is an .debug file
153- string const global(archive_path + DEBUGDIR);
154- string const image_path = archive_path + filename;
155- string const dirname(image_path.substr(0, image_path.rfind('/')));
156
157- if (find_separate_debug_file(ibfd.abfd, dirname, global, debug_filename)) {
158+ if (find_separate_debug_file(ibfd.abfd, filename, debug_filename, extra_found_images)) {
159 cverb << vbfd << "now loading: " << debug_filename << endl;
160 dbfd.abfd = open_bfd(debug_filename);
161 if (dbfd.has_debug_info())
162Index: libutil++/op_bfd.h
163===================================================================
164RCS file: /cvsroot/oprofile/oprofile/libutil++/op_bfd.h,v
165retrieving revision 1.51
166diff -u -r1.51 op_bfd.h
167--- libutil++/op_bfd.h 19 May 2008 23:15:04 -0000 1.51
168+++ libutil++/op_bfd.h 2 Jul 2008 20:55:09 -0000
169@@ -21,6 +21,7 @@
170 #include <set>
171
172 #include "bfd_support.h"
173+#include "locate_images.h"
174 #include "utility.h"
175 #include "cached_value.h"
176 #include "op_types.h"
177@@ -261,6 +262,9 @@
178 /// path to archive
179 std::string archive_path;
180
181+ /// reference to extra_images
182+ extra_images const & extra_found_images;
183+
184 /// file size in bytes
185 off_t file_size;
186
187Index: libutil++/op_spu_bfd.cpp
188===================================================================
189RCS file: /cvsroot/oprofile/oprofile/libutil++/op_spu_bfd.cpp,v
190retrieving revision 1.6
191diff -u -r1.6 op_spu_bfd.cpp
192--- libutil++/op_spu_bfd.cpp 29 Apr 2008 12:07:46 -0000 1.6
193+++ libutil++/op_spu_bfd.cpp 2 Jul 2008 20:55:09 -0000
194@@ -43,6 +43,7 @@
195 extra_images const & extra_images, bool & ok)
196 :
197 archive_path(extra_images.get_archive_path()),
198+ extra_found_images(extra_images),
199 file_size(-1),
200 embedding_filename(fname)
201 {
202Index: pp/oparchive.cpp
203===================================================================
204RCS file: /cvsroot/oprofile/oprofile/pp/oparchive.cpp,v
205retrieving revision 1.17
206diff -u -r1.17 oparchive.cpp
207--- pp/oparchive.cpp 29 Apr 2008 12:07:46 -0000 1.17
208+++ pp/oparchive.cpp 2 Jul 2008 20:55:09 -0000
209@@ -116,11 +116,10 @@
210 */
211 bfd * ibfd = open_bfd(real_exe_name);
212 if (ibfd) {
213- string global(archive_path + DEBUGDIR);
214 string dirname = op_dirname(real_exe_name);
215 string debug_filename;
216- if (find_separate_debug_file(ibfd, dirname, global,
217- debug_filename)) {
218+ if (find_separate_debug_file(ibfd, real_exe_name,
219+ debug_filename, classes.extra_found_images)) {
220 /* found something copy it over */
221 string dest_debug_dir = options::outdirectory +
222 dirname + "/.debug/";
diff --git a/meta/packages/oprofile/oprofile/op-cross-compile.patch b/meta/packages/oprofile/oprofile/op-cross-compile.patch
new file mode 100644
index 0000000000..bc75b9ac39
--- /dev/null
+++ b/meta/packages/oprofile/oprofile/op-cross-compile.patch
@@ -0,0 +1,136 @@
1Index: libopagent/Makefile.am
2===================================================================
3RCS file: /cvsroot/oprofile/oprofile/libopagent/Makefile.am,v
4retrieving revision 1.2
5diff -p -a -u -r1.2 Makefile.am
6--- libopagent/Makefile.am 28 Apr 2008 21:23:25 -0000 1.2
7+++ libopagent/Makefile.am 1 Jul 2008 21:56:02 -0000
8@@ -9,9 +9,9 @@ libopagent_la_SOURCES = opagent.c \
9
10 EXTRA_DIST = opagent_symbols.ver
11
12-nodist_libopagent_la_SOURCES = bfdheader.h
13
14 libopagent_la_CFLAGS = -fPIC -I ${top_srcdir}/libop -I ${top_srcdir}/libutil
15+libopagent_la_LIBADD = $(BFD_LIBS)
16
17 # Do not increment the major version for this library except to
18 # intentionally break backward ABI compatability. Use the
19@@ -23,21 +23,3 @@ libopagent_la_LDFLAGS = -version-info 1
20 -Wl,--version-script=${top_srcdir}/libopagent/opagent_symbols.ver
21
22
23-# the bfdheader.h is generated by bfddefines at compile time
24-# to extract the machine and architecture ids we need
25-# to write out a bfd file for this arch.
26-# automake does not support modelling such dependency, but
27-# has the variable BUILT_SOURCE for all sources that need to
28-# be made before the actual compile
29-# see automake info page section 8.4.1
30-BUILT_SOURCES = bfdheader.h
31-
32-CLEANFILES = bfdheader.h
33-
34-noinst_PROGRAMS = bfddefines
35-
36-bfddefines_LDADD = $(BFD_LIBS)
37-
38-bfdheader.h: bfddefines
39- ./bfddefines bfddefines > $@
40-
41Index: libopagent/opagent.c
42===================================================================
43RCS file: /cvsroot/oprofile/oprofile/libopagent/opagent.c,v
44retrieving revision 1.2
45diff -p -a -u -r1.2 opagent.c
46--- libopagent/opagent.c 28 Apr 2008 21:23:25 -0000 1.2
47+++ libopagent/opagent.c 1 Jul 2008 21:56:02 -0000
48@@ -60,12 +60,57 @@
49 #include <fcntl.h>
50 #include <unistd.h>
51 #include <time.h>
52+#include <bfd.h>
53
54 #include "opagent.h"
55-#include "bfdheader.h"
56 #include "op_config.h"
57 #include "jitdump.h"
58
59+// Declare BFD-related global variables.
60+static char * _bfd_target_name;
61+static int _bfd_arch;
62+static unsigned int _bfd_mach;
63+
64+// Define BFD-related global variables.
65+static int define_bfd_vars(void)
66+{
67+ bfd * bfd;
68+ bfd_boolean r;
69+ int len;
70+#define MAX_PATHLENGTH 2048
71+ char mypath[MAX_PATHLENGTH];
72+
73+ len = readlink("/proc/self/exe", mypath, sizeof(mypath));
74+
75+ if (len < 0) {
76+ fprintf(stderr, "libopagent: readlink /proc/self/exe failed\n");
77+ return -1;
78+ }
79+ if (len >= MAX_PATHLENGTH) {
80+ fprintf(stderr, "libopagent: readlink /proc/self/exe returned"
81+ " path length longer than %d.\n", MAX_PATHLENGTH);
82+
83+ return -1;
84+ }
85+ mypath[len] = '\0';
86+
87+ bfd_init();
88+ bfd = bfd_openr(mypath, NULL);
89+ if (bfd == NULL) {
90+ bfd_perror("bfd_openr error. Cannot get required BFD info");
91+ return -1;
92+ }
93+ r = bfd_check_format(bfd, bfd_object);
94+ if (!r) {
95+ bfd_perror("bfd_get_arch error. Cannot get required BFD info");
96+ return -1;
97+ }
98+ _bfd_target_name = bfd->xvec->name;
99+ _bfd_arch = bfd_get_arch(bfd);
100+ _bfd_mach = bfd_get_mach(bfd);
101+
102+ return 0;
103+}
104 /**
105 * Define the version of the opagent library.
106 */
107@@ -112,15 +157,16 @@ op_agent_t op_open_agent(void)
108 fprintf(stderr, "%s\n", err_msg);
109 return NULL;
110 }
111-
112+ if (define_bfd_vars())
113+ return NULL;
114 header.magic = JITHEADER_MAGIC;
115 header.version = JITHEADER_VERSION;
116- header.totalsize = sizeof(header) + strlen(BFD_TARGET_NAME) + 1;
117+ header.totalsize = sizeof(header) + strlen(_bfd_target_name) + 1;
118 /* calculate amount of padding '\0' */
119 pad_cnt = PADDING_8ALIGNED(header.totalsize);
120 header.totalsize += pad_cnt;
121- header.bfd_arch = BFD_ARCH;
122- header.bfd_mach = BFD_MACH;
123+ header.bfd_arch = _bfd_arch;
124+ header.bfd_mach = _bfd_mach;
125 if (gettimeofday(&tv, NULL)) {
126 fprintf(stderr, "gettimeofday failed\n");
127 return NULL;
128@@ -132,7 +178,7 @@ op_agent_t op_open_agent(void)
129 fprintf(stderr, "%s\n", err_msg);
130 return NULL;
131 }
132- if (!fwrite(BFD_TARGET_NAME, strlen(BFD_TARGET_NAME) + 1, 1,
133+ if (!fwrite(_bfd_target_name, strlen(_bfd_target_name) + 1, 1,
134 dumpfile)) {
135 fprintf(stderr, "%s\n", err_msg);
136 return NULL;
diff --git a/meta/packages/oprofile/oprofile/opstart.patch b/meta/packages/oprofile/oprofile/opstart.patch
index e8da0922cc..d61c30095f 100644
--- a/meta/packages/oprofile/oprofile/opstart.patch
+++ b/meta/packages/oprofile/oprofile/opstart.patch
@@ -1,8 +1,8 @@
1Index: oprofile/utils/Makefile.am 1Index: oprofile/utils/Makefile.am
2=================================================================== 2===================================================================
3--- oprofile.orig/utils/Makefile.am 3--- oprofile.orig/utils/Makefile.am 2005-03-31 18:20:41.000000000 +0100
4+++ oprofile/utils/Makefile.am 4+++ oprofile/utils/Makefile.am 2008-07-02 15:14:07.000000000 +0100
5@@ -3,8 +3,15 @@ AM_CFLAGS = @OP_CFLAGS@ 5@@ -3,8 +3,15 @@
6 6
7 LIBS=@POPT_LIBS@ @LIBERTY_LIBS@ 7 LIBS=@POPT_LIBS@ @LIBERTY_LIBS@
8 8
@@ -21,8 +21,8 @@ Index: oprofile/utils/Makefile.am
21+ $(LN_S) opstart opstop 21+ $(LN_S) opstart opstop
22Index: oprofile/utils/opstart.c 22Index: oprofile/utils/opstart.c
23=================================================================== 23===================================================================
24--- /dev/null 24--- /dev/null 1970-01-01 00:00:00.000000000 +0000
25+++ oprofile/utils/opstart.c 25+++ oprofile/utils/opstart.c 2008-07-02 15:14:07.000000000 +0100
26@@ -0,0 +1,110 @@ 26@@ -0,0 +1,110 @@
27+/** 27+/**
28+ * @file opstart.c 28+ * @file opstart.c
@@ -136,17 +136,17 @@ Index: oprofile/utils/opstart.c
136+ 136+
137Index: oprofile/configure.in 137Index: oprofile/configure.in
138=================================================================== 138===================================================================
139--- oprofile.orig/configure.in 139--- oprofile.orig/configure.in 2008-07-02 15:13:58.000000000 +0100
140+++ oprofile/configure.in 140+++ oprofile/configure.in 2008-07-02 15:17:37.000000000 +0100
141@@ -16,6 +16,7 @@ AM_INIT_AUTOMAKE(oprofile, 0.9.4cvs) 141@@ -16,6 +16,7 @@
142 AM_CONFIG_HEADER(config.h) 142 AM_CONFIG_HEADER(config.h)
143 143
144 AC_PROG_RANLIB 144 AC_PROG_RANLIB
145+AC_PROG_LN_S 145+AC_PROG_LN_S
146 AC_PROG_LIBTOOL
146 147
147 dnl for the man page 148 dnl for the man page
148 DATE="`date '+%a %d %B %Y'`" 149@@ -241,6 +242,8 @@
149@@ -227,6 +228,8 @@ AC_OUTPUT(Makefile \
150 doc/xsl/catalog-1.xml \ 150 doc/xsl/catalog-1.xml \
151 doc/oprofile.1 \ 151 doc/oprofile.1 \
152 doc/opcontrol.1 \ 152 doc/opcontrol.1 \
@@ -157,9 +157,9 @@ Index: oprofile/configure.in
157 doc/opannotate.1 \ 157 doc/opannotate.1 \
158Index: oprofile/doc/Makefile.am 158Index: oprofile/doc/Makefile.am
159=================================================================== 159===================================================================
160--- oprofile.orig/doc/Makefile.am 160--- oprofile.orig/doc/Makefile.am 2008-07-02 15:13:59.000000000 +0100
161+++ oprofile/doc/Makefile.am 161+++ oprofile/doc/Makefile.am 2008-07-02 15:14:07.000000000 +0100
162@@ -11,6 +11,8 @@ STYLESHEETS=$(CHUNK_XHTML_STYLESHEET) $( 162@@ -11,6 +11,8 @@
163 man_MANS = \ 163 man_MANS = \
164 oprofile.1 \ 164 oprofile.1 \
165 opcontrol.1 \ 165 opcontrol.1 \
@@ -170,8 +170,8 @@ Index: oprofile/doc/Makefile.am
170 opgprof.1 \ 170 opgprof.1 \
171Index: oprofile/doc/opstart.1.in 171Index: oprofile/doc/opstart.1.in
172=================================================================== 172===================================================================
173--- /dev/null 173--- /dev/null 1970-01-01 00:00:00.000000000 +0000
174+++ oprofile/doc/opstart.1.in 174+++ oprofile/doc/opstart.1.in 2008-07-02 15:14:07.000000000 +0100
175@@ -0,0 +1,27 @@ 175@@ -0,0 +1,27 @@
176+.TH OPSTART 1 "@DATE@" "oprofile @VERSION@" 176+.TH OPSTART 1 "@DATE@" "oprofile @VERSION@"
177+.UC 4 177+.UC 4
@@ -202,8 +202,8 @@ Index: oprofile/doc/opstart.1.in
202+.BR oprofile(1) 202+.BR oprofile(1)
203Index: oprofile/doc/opstop.1.in 203Index: oprofile/doc/opstop.1.in
204=================================================================== 204===================================================================
205--- /dev/null 205--- /dev/null 1970-01-01 00:00:00.000000000 +0000
206+++ oprofile/doc/opstop.1.in 206+++ oprofile/doc/opstop.1.in 2008-07-02 15:14:07.000000000 +0100
207@@ -0,0 +1,28 @@ 207@@ -0,0 +1,28 @@
208+.TH OPSTOP 1 "@DATE@" "oprofile @VERSION@" 208+.TH OPSTOP 1 "@DATE@" "oprofile @VERSION@"
209+.UC 4 209+.UC 4