diff options
author | Richard Purdie <richard@openedhand.com> | 2008-07-14 16:24:22 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2008-07-14 16:24:22 +0000 |
commit | 4c78c04481b6326a11499d10b139f2af35478ca0 (patch) | |
tree | c202e23adaae08da3925e07a461b7142ce021f03 | |
parent | 1166e112d0745fb6ef96d1ae4368bba9e36e5bc1 (diff) | |
download | openembedded-core-4c78c04481b6326a11499d10b139f2af35478ca0.tar.gz openembedded-core-4c78c04481b6326a11499d10b139f2af35478ca0.tar.bz2 openembedded-core-4c78c04481b6326a11499d10b139f2af35478ca0.zip |
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
-rw-r--r-- | meta/packages/oprofile/oprofile/fix_debug_search.patch | 222 | ||||
-rw-r--r-- | meta/packages/oprofile/oprofile/op-cross-compile.patch | 136 | ||||
-rw-r--r-- | meta/packages/oprofile/oprofile/opstart.patch | 34 | ||||
-rw-r--r-- | meta/packages/oprofile/oprofile_0.9.3.bb | 15 | ||||
-rw-r--r-- | meta/packages/oprofile/oprofile_cvs.bb | 22 |
5 files changed, 378 insertions, 51 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 @@ +Index: libutil++/bfd_support.cpp +=================================================================== +RCS file: /cvsroot/oprofile/oprofile/libutil++/bfd_support.cpp,v +retrieving revision 1.9 +diff -u -r1.9 bfd_support.cpp +--- libutil++/bfd_support.cpp 29 Apr 2008 12:07:46 -0000 1.9 ++++ libutil++/bfd_support.cpp 2 Jul 2008 20:55:09 -0000 +@@ -12,8 +12,11 @@ + + #include "op_bfd.h" + #include "op_fileio.h" ++#include "op_config.h" + #include "string_manip.h" ++#include "file_manip.h" + #include "cverb.h" ++#include "locate_images.h" + + #include <cstdlib> + #include <cstring> +@@ -42,13 +45,22 @@ + } + + +-bool separate_debug_file_exists(string const & name, unsigned long const crc) ++bool separate_debug_file_exists(string & name, unsigned long const crc, ++ extra_images const & extra) + { + unsigned long file_crc = 0; + // The size of 2 * 1024 elements for the buffer is arbitrary. + char buffer[2 * 1024]; +- +- ifstream file(name.c_str()); ++ ++ image_error img_ok; ++ string const image_path = extra.find_image_path(name, img_ok, true); ++ ++ if (img_ok != image_ok) ++ return false; ++ ++ name = image_path; ++ ++ ifstream file(image_path.c_str()); + if (!file) + return false; + +@@ -281,40 +293,35 @@ + } + + +-bool find_separate_debug_file(bfd * ibfd, string const & dir_in, +- string const & global_in, string & filename) ++bool find_separate_debug_file(bfd * ibfd, string const & filepath_in, ++ string & debug_filename, extra_images const & extra) + { +- string dir(dir_in); +- string global(global_in); ++ string filepath(filepath_in); + string basename; + unsigned long crc32; + + if (!get_debug_link_info(ibfd, basename, crc32)) + return false; +- +- if (dir.size() > 0 && dir.at(dir.size() - 1) != '/') +- dir += '/'; +- +- if (global.size() > 0 && global.at(global.size() - 1) != '/') +- global += '/'; ++ ++ // Work out the image file's directory prefix ++ string filedir = op_dirname(filepath); ++ // Make sure it starts with / ++ if (filedir.size() > 0 && filedir.at(filedir.size() - 1) != '/') ++ filedir += '/'; ++ ++ string first_try(filedir + ".debug/" + basename); ++ string second_try(DEBUGDIR + filedir + basename); ++ string third_try(filedir + basename); + + cverb << vbfd << "looking for debugging file " << basename + << " with crc32 = " << hex << crc32 << endl; +- +- string first_try(dir + basename); +- string second_try(dir + ".debug/" + basename); +- +- if (dir.size() > 0 && dir[0] == '/') +- dir = dir.substr(1); + +- string third_try(global + dir + basename); +- +- if (separate_debug_file_exists(first_try, crc32)) +- filename = first_try; +- else if (separate_debug_file_exists(second_try, crc32)) +- filename = second_try; +- else if (separate_debug_file_exists(third_try, crc32)) +- filename = third_try; ++ if (separate_debug_file_exists(first_try, crc32, extra)) ++ debug_filename = first_try; ++ else if (separate_debug_file_exists(second_try, crc32, extra)) ++ debug_filename = second_try; ++ else if (separate_debug_file_exists(third_try, crc32, extra)) ++ debug_filename = third_try; + else + return false; + +Index: libutil++/bfd_support.h +=================================================================== +RCS file: /cvsroot/oprofile/oprofile/libutil++/bfd_support.h,v +retrieving revision 1.5 +diff -u -r1.5 bfd_support.h +--- libutil++/bfd_support.h 28 Apr 2008 21:23:25 -0000 1.5 ++++ libutil++/bfd_support.h 2 Jul 2008 20:55:09 -0000 +@@ -13,6 +13,7 @@ + + #include "utility.h" + #include "op_types.h" ++#include "locate_images.h" + + #include <bfd.h> + #include <stdint.h> +@@ -84,9 +85,9 @@ + */ + extern bool + find_separate_debug_file(bfd * ibfd, +- std::string const & dir_in, +- std::string const & global_in, +- std::string & filename); ++ std::string const & filepath_in, ++ std::string & debug_filename, ++ extra_images const & extra); + + /// open the given BFD + bfd * open_bfd(std::string const & file); +Index: libutil++/op_bfd.cpp +=================================================================== +RCS file: /cvsroot/oprofile/oprofile/libutil++/op_bfd.cpp,v +retrieving revision 1.83 +diff -u -r1.83 op_bfd.cpp +--- libutil++/op_bfd.cpp 19 May 2008 23:15:04 -0000 1.83 ++++ libutil++/op_bfd.cpp 2 Jul 2008 20:55:09 -0000 +@@ -97,6 +97,7 @@ + : + filename(fname), + archive_path(extra_images.get_archive_path()), ++ extra_found_images(extra_images), + file_size(-1), + anon_obj(false) + { +@@ -341,11 +342,8 @@ + 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 dirname(image_path.substr(0, image_path.rfind('/'))); + +- if (find_separate_debug_file(ibfd.abfd, dirname, global, debug_filename)) { ++ if (find_separate_debug_file(ibfd.abfd, filename, debug_filename, extra_found_images)) { + cverb << vbfd << "now loading: " << debug_filename << endl; + dbfd.abfd = open_bfd(debug_filename); + if (dbfd.has_debug_info()) +Index: libutil++/op_bfd.h +=================================================================== +RCS file: /cvsroot/oprofile/oprofile/libutil++/op_bfd.h,v +retrieving revision 1.51 +diff -u -r1.51 op_bfd.h +--- libutil++/op_bfd.h 19 May 2008 23:15:04 -0000 1.51 ++++ libutil++/op_bfd.h 2 Jul 2008 20:55:09 -0000 +@@ -21,6 +21,7 @@ + #include <set> + + #include "bfd_support.h" ++#include "locate_images.h" + #include "utility.h" + #include "cached_value.h" + #include "op_types.h" +@@ -261,6 +262,9 @@ + /// path to archive + std::string archive_path; + ++ /// reference to extra_images ++ extra_images const & extra_found_images; ++ + /// file size in bytes + off_t file_size; + +Index: libutil++/op_spu_bfd.cpp +=================================================================== +RCS file: /cvsroot/oprofile/oprofile/libutil++/op_spu_bfd.cpp,v +retrieving revision 1.6 +diff -u -r1.6 op_spu_bfd.cpp +--- libutil++/op_spu_bfd.cpp 29 Apr 2008 12:07:46 -0000 1.6 ++++ libutil++/op_spu_bfd.cpp 2 Jul 2008 20:55:09 -0000 +@@ -43,6 +43,7 @@ + extra_images const & extra_images, bool & ok) + : + archive_path(extra_images.get_archive_path()), ++ extra_found_images(extra_images), + file_size(-1), + embedding_filename(fname) + { +Index: pp/oparchive.cpp +=================================================================== +RCS file: /cvsroot/oprofile/oprofile/pp/oparchive.cpp,v +retrieving revision 1.17 +diff -u -r1.17 oparchive.cpp +--- pp/oparchive.cpp 29 Apr 2008 12:07:46 -0000 1.17 ++++ pp/oparchive.cpp 2 Jul 2008 20:55:09 -0000 +@@ -116,11 +116,10 @@ + */ + bfd * ibfd = open_bfd(real_exe_name); + if (ibfd) { +- string global(archive_path + DEBUGDIR); + string dirname = op_dirname(real_exe_name); + string debug_filename; +- if (find_separate_debug_file(ibfd, dirname, global, +- debug_filename)) { ++ if (find_separate_debug_file(ibfd, real_exe_name, ++ debug_filename, classes.extra_found_images)) { + /* found something copy it over */ + string dest_debug_dir = options::outdirectory + + 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 @@ +Index: libopagent/Makefile.am +=================================================================== +RCS file: /cvsroot/oprofile/oprofile/libopagent/Makefile.am,v +retrieving revision 1.2 +diff -p -a -u -r1.2 Makefile.am +--- libopagent/Makefile.am 28 Apr 2008 21:23:25 -0000 1.2 ++++ libopagent/Makefile.am 1 Jul 2008 21:56:02 -0000 +@@ -9,9 +9,9 @@ libopagent_la_SOURCES = opagent.c \ + + EXTRA_DIST = opagent_symbols.ver + +-nodist_libopagent_la_SOURCES = bfdheader.h + + libopagent_la_CFLAGS = -fPIC -I ${top_srcdir}/libop -I ${top_srcdir}/libutil ++libopagent_la_LIBADD = $(BFD_LIBS) + + # Do not increment the major version for this library except to + # intentionally break backward ABI compatability. Use the +@@ -23,21 +23,3 @@ libopagent_la_LDFLAGS = -version-info 1 + -Wl,--version-script=${top_srcdir}/libopagent/opagent_symbols.ver + + +-# the bfdheader.h is generated by bfddefines at compile time +-# to extract the machine and architecture ids we need +-# to write out a bfd file for this arch. +-# automake does not support modelling such dependency, but +-# has the variable BUILT_SOURCE for all sources that need to +-# be made before the actual compile +-# see automake info page section 8.4.1 +-BUILT_SOURCES = bfdheader.h +- +-CLEANFILES = bfdheader.h +- +-noinst_PROGRAMS = bfddefines +- +-bfddefines_LDADD = $(BFD_LIBS) +- +-bfdheader.h: bfddefines +- ./bfddefines bfddefines > $@ +- +Index: libopagent/opagent.c +=================================================================== +RCS file: /cvsroot/oprofile/oprofile/libopagent/opagent.c,v +retrieving revision 1.2 +diff -p -a -u -r1.2 opagent.c +--- libopagent/opagent.c 28 Apr 2008 21:23:25 -0000 1.2 ++++ libopagent/opagent.c 1 Jul 2008 21:56:02 -0000 +@@ -60,12 +60,57 @@ + #include <fcntl.h> + #include <unistd.h> + #include <time.h> ++#include <bfd.h> + + #include "opagent.h" +-#include "bfdheader.h" + #include "op_config.h" + #include "jitdump.h" + ++// Declare BFD-related global variables. ++static char * _bfd_target_name; ++static int _bfd_arch; ++static unsigned int _bfd_mach; ++ ++// Define BFD-related global variables. ++static int define_bfd_vars(void) ++{ ++ bfd * bfd; ++ bfd_boolean r; ++ int len; ++#define MAX_PATHLENGTH 2048 ++ char mypath[MAX_PATHLENGTH]; ++ ++ len = readlink("/proc/self/exe", mypath, sizeof(mypath)); ++ ++ if (len < 0) { ++ fprintf(stderr, "libopagent: readlink /proc/self/exe failed\n"); ++ return -1; ++ } ++ if (len >= MAX_PATHLENGTH) { ++ fprintf(stderr, "libopagent: readlink /proc/self/exe returned" ++ " path length longer than %d.\n", MAX_PATHLENGTH); ++ ++ return -1; ++ } ++ mypath[len] = '\0'; ++ ++ bfd_init(); ++ bfd = bfd_openr(mypath, NULL); ++ if (bfd == NULL) { ++ bfd_perror("bfd_openr error. Cannot get required BFD info"); ++ return -1; ++ } ++ r = bfd_check_format(bfd, bfd_object); ++ if (!r) { ++ bfd_perror("bfd_get_arch error. Cannot get required BFD info"); ++ return -1; ++ } ++ _bfd_target_name = bfd->xvec->name; ++ _bfd_arch = bfd_get_arch(bfd); ++ _bfd_mach = bfd_get_mach(bfd); ++ ++ return 0; ++} + /** + * Define the version of the opagent library. + */ +@@ -112,15 +157,16 @@ op_agent_t op_open_agent(void) + fprintf(stderr, "%s\n", err_msg); + return NULL; + } +- ++ if (define_bfd_vars()) ++ return NULL; + header.magic = JITHEADER_MAGIC; + header.version = JITHEADER_VERSION; +- header.totalsize = sizeof(header) + strlen(BFD_TARGET_NAME) + 1; ++ header.totalsize = sizeof(header) + strlen(_bfd_target_name) + 1; + /* calculate amount of padding '\0' */ + pad_cnt = PADDING_8ALIGNED(header.totalsize); + header.totalsize += pad_cnt; +- header.bfd_arch = BFD_ARCH; +- header.bfd_mach = BFD_MACH; ++ header.bfd_arch = _bfd_arch; ++ header.bfd_mach = _bfd_mach; + if (gettimeofday(&tv, NULL)) { + fprintf(stderr, "gettimeofday failed\n"); + return NULL; +@@ -132,7 +178,7 @@ op_agent_t op_open_agent(void) + fprintf(stderr, "%s\n", err_msg); + return NULL; + } +- if (!fwrite(BFD_TARGET_NAME, strlen(BFD_TARGET_NAME) + 1, 1, ++ if (!fwrite(_bfd_target_name, strlen(_bfd_target_name) + 1, 1, + dumpfile)) { + fprintf(stderr, "%s\n", err_msg); + 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 @@ Index: oprofile/utils/Makefile.am =================================================================== ---- oprofile.orig/utils/Makefile.am -+++ oprofile/utils/Makefile.am -@@ -3,8 +3,15 @@ AM_CFLAGS = @OP_CFLAGS@ +--- oprofile.orig/utils/Makefile.am 2005-03-31 18:20:41.000000000 +0100 ++++ oprofile/utils/Makefile.am 2008-07-02 15:14:07.000000000 +0100 +@@ -3,8 +3,15 @@ LIBS=@POPT_LIBS@ @LIBERTY_LIBS@ @@ -21,8 +21,8 @@ Index: oprofile/utils/Makefile.am + $(LN_S) opstart opstop Index: oprofile/utils/opstart.c =================================================================== ---- /dev/null -+++ oprofile/utils/opstart.c +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ oprofile/utils/opstart.c 2008-07-02 15:14:07.000000000 +0100 @@ -0,0 +1,110 @@ +/** + * @file opstart.c @@ -136,17 +136,17 @@ Index: oprofile/utils/opstart.c + Index: oprofile/configure.in =================================================================== ---- oprofile.orig/configure.in -+++ oprofile/configure.in -@@ -16,6 +16,7 @@ AM_INIT_AUTOMAKE(oprofile, 0.9.4cvs) +--- oprofile.orig/configure.in 2008-07-02 15:13:58.000000000 +0100 ++++ oprofile/configure.in 2008-07-02 15:17:37.000000000 +0100 +@@ -16,6 +16,7 @@ AM_CONFIG_HEADER(config.h) AC_PROG_RANLIB +AC_PROG_LN_S + AC_PROG_LIBTOOL dnl for the man page - DATE="`date '+%a %d %B %Y'`" -@@ -227,6 +228,8 @@ AC_OUTPUT(Makefile \ +@@ -241,6 +242,8 @@ doc/xsl/catalog-1.xml \ doc/oprofile.1 \ doc/opcontrol.1 \ @@ -157,9 +157,9 @@ Index: oprofile/configure.in doc/opannotate.1 \ Index: oprofile/doc/Makefile.am =================================================================== ---- oprofile.orig/doc/Makefile.am -+++ oprofile/doc/Makefile.am -@@ -11,6 +11,8 @@ STYLESHEETS=$(CHUNK_XHTML_STYLESHEET) $( +--- oprofile.orig/doc/Makefile.am 2008-07-02 15:13:59.000000000 +0100 ++++ oprofile/doc/Makefile.am 2008-07-02 15:14:07.000000000 +0100 +@@ -11,6 +11,8 @@ man_MANS = \ oprofile.1 \ opcontrol.1 \ @@ -170,8 +170,8 @@ Index: oprofile/doc/Makefile.am opgprof.1 \ Index: oprofile/doc/opstart.1.in =================================================================== ---- /dev/null -+++ oprofile/doc/opstart.1.in +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ oprofile/doc/opstart.1.in 2008-07-02 15:14:07.000000000 +0100 @@ -0,0 +1,27 @@ +.TH OPSTART 1 "@DATE@" "oprofile @VERSION@" +.UC 4 @@ -202,8 +202,8 @@ Index: oprofile/doc/opstart.1.in +.BR oprofile(1) Index: oprofile/doc/opstop.1.in =================================================================== ---- /dev/null -+++ oprofile/doc/opstop.1.in +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ oprofile/doc/opstop.1.in 2008-07-02 15:14:07.000000000 +0100 @@ -0,0 +1,28 @@ +.TH OPSTOP 1 "@DATE@" "oprofile @VERSION@" +.UC 4 diff --git a/meta/packages/oprofile/oprofile_0.9.3.bb b/meta/packages/oprofile/oprofile_0.9.3.bb index d0a18588b1..33386e1ab9 100644 --- a/meta/packages/oprofile/oprofile_0.9.3.bb +++ b/meta/packages/oprofile/oprofile_0.9.3.bb @@ -28,18 +28,3 @@ do_configure () { cp ${WORKDIR}/acinclude.m4 ${S}/ autotools_do_configure } -# Available config options -# --enable-abi enable abi portability code (default is disabled) -# --enable-pch enable precompiled header (default is disabled) -# --enable-gcov enable option for gcov coverage testing (default is disabled) -# --disable-werror disable -Werror flag (default is enabled for non-release) -# --disable-optimization disable optimization flags (default is enabled) -# --with-kernel-support Use 2.6 kernel (no kernel source tree required) -# --with-linux=dir Path to Linux source tree -# --with-module-dir=dir Path to module installation directory -# --with-extra-includes=DIR add extra include paths -# --with-extra-libs=DIR add extra library paths -# --with-x use the X Window System -# --with-qt-dir where the root of Qt is installed -# --with-qt-includes where the Qt includes are. -# --with-qt-libraries where the Qt library is installed. diff --git a/meta/packages/oprofile/oprofile_cvs.bb b/meta/packages/oprofile/oprofile_cvs.bb index cab065a073..e848bacf4d 100644 --- a/meta/packages/oprofile/oprofile_cvs.bb +++ b/meta/packages/oprofile/oprofile_cvs.bb @@ -1,5 +1,5 @@ PV = "0.9.3+cvs${SRCDATE}" -PR = "r1" +PR = "r4" SECTION = "devel" DESCRIPTION = "OProfile is a system-wide profiler for Linux systems, capable \ of profiling all running code at low overhead." @@ -10,14 +10,13 @@ RRECOMMENDS = "kernel-vmlinux" SRC_URI = "cvs://anonymous@oprofile.cvs.sourceforge.net/cvsroot/oprofile;module=oprofile \ file://opstart.patch;patch=1 \ + file://fix_debug_search.patch;patch=1;pnum=0 \ + file://op-cross-compile.patch;patch=1;pnum=0 \ file://acinclude.m4" S = "${WORKDIR}/oprofile" inherit autotools -# NOTE: this disables the build of the kernel modules. -# Should add the oprofile kernel modules, for those with 2.4 -# kernels, as a seperate .oe file. EXTRA_OECONF = "--with-kernel-support \ --without-x \ --disable-werror " @@ -26,18 +25,3 @@ do_configure () { cp ${WORKDIR}/acinclude.m4 ${S}/ autotools_do_configure } -# Available config options -# --enable-abi enable abi portability code (default is disabled) -# --enable-pch enable precompiled header (default is disabled) -# --enable-gcov enable option for gcov coverage testing (default is disabled) -# --disable-werror disable -Werror flag (default is enabled for non-release) -# --disable-optimization disable optimization flags (default is enabled) -# --with-kernel-support Use 2.6 kernel (no kernel source tree required) -# --with-linux=dir Path to Linux source tree -# --with-module-dir=dir Path to module installation directory -# --with-extra-includes=DIR add extra include paths -# --with-extra-libs=DIR add extra library paths -# --with-x use the X Window System -# --with-qt-dir where the root of Qt is installed -# --with-qt-includes where the Qt includes are. -# --with-qt-libraries where the Qt library is installed. |