2008-07-19 00:32:25 +02:00
|
|
|
--- Makefile.am
|
|
|
|
+++ Makefile.am
|
|
|
|
@@ -25,6 +25,7 @@ SUBDIRS = \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+AUTOMAKE_OPTIONS = foreign
|
|
|
|
ACLOCAL_AMFLAGS = -I m4
|
|
|
|
|
|
|
|
# The module will not build under distcheck
|
2008-10-23 12:27:14 +02:00
|
|
|
--- agents/jvmpi/Makefile.am
|
|
|
|
+++ agents/jvmpi/Makefile.am
|
|
|
|
@@ -1,6 +1,6 @@
|
|
|
|
-pkglib_LTLIBRARIES = libjvmpi_oprofile.la
|
|
|
|
+lib_LTLIBRARIES = libjvmpi_oprofile.la
|
|
|
|
|
|
|
|
-libjvmpi_oprofile_la_CXXFLAGS = -W -Wall -fPIC
|
|
|
|
+libjvmpi_oprofile_la_LDFLAGS = -module -avoid-version
|
|
|
|
|
|
|
|
libjvmpi_oprofile_la_SOURCES = jvmpi_oprofile.cpp
|
|
|
|
|
2008-07-19 00:32:25 +02:00
|
|
|
--- agents/jvmpi/jvmpi_oprofile.cpp
|
|
|
|
+++ agents/jvmpi/jvmpi_oprofile.cpp
|
|
|
|
@@ -16,6 +16,7 @@
|
|
|
|
#include <string>
|
|
|
|
#include <stdexcept>
|
|
|
|
#include <cerrno>
|
|
|
|
+#include <cstring>
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include <jvmpi.h>
|
2008-10-23 12:27:14 +02:00
|
|
|
--- agents/jvmti/Makefile.am
|
|
|
|
+++ agents/jvmti/Makefile.am
|
|
|
|
@@ -1,8 +1,8 @@
|
|
|
|
AM_CFLAGS = @OP_CFLAGS@
|
|
|
|
|
|
|
|
-pkglib_LTLIBRARIES = libjvmti_oprofile.la
|
|
|
|
+lib_LTLIBRARIES = libjvmti_oprofile.la
|
|
|
|
|
|
|
|
-libjvmti_oprofile_la_CFLAGS = $(AM_CFLAGS) -fPIC
|
|
|
|
+libjvmti_oprofile_la_LDFLAGS = -module -avoid-version
|
|
|
|
|
|
|
|
libjvmti_oprofile_la_LIBADD = ../../libopagent/libopagent.la
|
|
|
|
|
2008-07-19 00:32:25 +02:00
|
|
|
--- configure.in
|
|
|
|
+++ configure.in
|
|
|
|
@@ -140,7 +140,7 @@ AX_CHECK_DOCBOOK
|
|
|
|
dnl finally restore the original libs setting
|
|
|
|
LIBS="$ORIG_SAVE_LIBS"
|
|
|
|
LIBERTY_LIBS="-liberty $DL_LIB $INTL_LIB"
|
|
|
|
-BFD_LIBS="-lbfd -liberty $DL_LIB $INTL_LIB"
|
|
|
|
+BFD_LIBS="-lbfd -liberty $Z_LIB $DL_LIB $INTL_LIB"
|
|
|
|
POPT_LIBS="-lpopt"
|
|
|
|
AC_SUBST(LIBERTY_LIBS)
|
|
|
|
AC_SUBST(BFD_LIBS)
|
2008-10-23 12:27:14 +02:00
|
|
|
--- libopagent/Makefile.am
|
|
|
|
+++ libopagent/Makefile.am
|
|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
-pkglib_LTLIBRARIES = libopagent.la
|
|
|
|
+lib_LTLIBRARIES = libopagent.la
|
|
|
|
|
|
|
|
# install opagent.h to include directory
|
|
|
|
include_HEADERS = opagent.h
|
|
|
|
@@ -10,7 +10,7 @@ libopagent_la_SOURCES = opagent.c \
|
|
|
|
EXTRA_DIST = opagent_symbols.ver
|
|
|
|
|
|
|
|
|
|
|
|
-libopagent_la_CFLAGS = -fPIC -I ${top_srcdir}/libop -I ${top_srcdir}/libutil
|
|
|
|
+libopagent_la_CPPFLAGS = -I ${top_srcdir}/libop -I ${top_srcdir}/libutil
|
|
|
|
libopagent_la_LIBADD = $(BFD_LIBS)
|
|
|
|
|
|
|
|
# Do not increment the major version for this library except to
|
2008-10-23 22:39:30 +02:00
|
|
|
--- libutil++/bfd_support.cpp
|
|
|
|
+++ libutil++/bfd_support.cpp
|
|
|
|
@@ -364,6 +364,9 @@ bool interesting_symbol(asymbol * sym)
|
|
|
|
if (!strcmp("gcc2_compiled.", sym->name))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
+ if (sym->flags & BSF_SECTION_SYM)
|
|
|
|
+ return false;
|
|
|
|
+
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-07-19 00:32:25 +02:00
|
|
|
--- libutil++/file_manip.cpp
|
|
|
|
+++ libutil++/file_manip.cpp
|
|
|
|
@@ -44,7 +44,7 @@ bool copy_file(string const & source, st
|
|
|
|
if (!in)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
- int fd = open(destination.c_str(), O_RDWR|O_CREAT);
|
|
|
|
+ int fd = open(destination.c_str(), O_RDWR|O_CREAT, 0600);
|
|
|
|
if (fd < 0)
|
|
|
|
return false;
|
|
|
|
close(fd);
|
2008-11-20 18:02:26 +01:00
|
|
|
--- libutil++/op_bfd.cpp
|
|
|
|
+++ libutil++/op_bfd.cpp
|
|
|
|
@@ -91,6 +91,11 @@ bool op_bfd_symbol::operator<(op_bfd_sym
|
|
|
|
return filepos() < rhs.filepos();
|
|
|
|
}
|
|
|
|
|
|
|
|
+unsigned long op_bfd_symbol::symbol_endpos(void) const
|
|
|
|
+{
|
|
|
|
+ return bfd_symbol->section->filepos + bfd_symbol->section->size;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
|
|
|
|
op_bfd::op_bfd(string const & fname, string_filter const & symbol_filter,
|
|
|
|
extra_images const & extra_images, bool & ok)
|
|
|
|
@@ -245,7 +250,8 @@ void op_bfd::get_symbols(op_bfd::symbols
|
|
|
|
while (it != symbols.end()) {
|
|
|
|
symbols_found_t::iterator temp = it;
|
|
|
|
++temp;
|
|
|
|
- if (temp != symbols.end() && (it->vma() == temp->vma())) {
|
|
|
|
+ if (temp != symbols.end() && (it->vma() == temp->vma()) &&
|
|
|
|
+ (it->filepos() == temp->filepos())) {
|
|
|
|
if (boring_symbol(*it, *temp)) {
|
|
|
|
it = symbols.erase(it);
|
|
|
|
} else {
|
|
|
|
@@ -382,7 +388,12 @@ size_t op_bfd::symbol_size(op_bfd_symbol
|
|
|
|
op_bfd_symbol const * next) const
|
|
|
|
{
|
|
|
|
unsigned long long start = sym.filepos();
|
|
|
|
- unsigned long long end = next ? next->filepos() : file_size;
|
|
|
|
+ unsigned long long end;
|
|
|
|
+
|
|
|
|
+ if (next && (sym.section() != next->section()))
|
|
|
|
+ end = sym.symbol_endpos();
|
|
|
|
+ else
|
|
|
|
+ end = next ? next->filepos() : file_size;
|
|
|
|
|
|
|
|
return end - start;
|
|
|
|
}
|
|
|
|
--- libutil++/op_bfd.h
|
|
|
|
+++ libutil++/op_bfd.h
|
|
|
|
@@ -50,6 +50,8 @@ public:
|
|
|
|
bfd_vma vma() const { return symb_value + section_vma; }
|
|
|
|
unsigned long value() const { return symb_value; }
|
|
|
|
unsigned long filepos() const { return symb_value + section_filepos; }
|
|
|
|
+ unsigned long symbol_endpos(void) const;
|
|
|
|
+ asection const * section(void) const { return bfd_symbol->section; }
|
|
|
|
std::string const & name() const { return symb_name; }
|
|
|
|
asymbol const * symbol() const { return bfd_symbol; }
|
|
|
|
size_t size() const { return symb_size; }
|
2008-11-03 14:15:45 +01:00
|
|
|
--- libutil++/op_spu_bfd.cpp
|
|
|
|
+++ libutil++/op_spu_bfd.cpp
|
|
|
|
@@ -45,7 +45,8 @@ op_bfd::op_bfd(uint64_t spu_offset, stri
|
|
|
|
archive_path(extra_images.get_archive_path()),
|
|
|
|
extra_found_images(extra_images),
|
|
|
|
file_size(-1),
|
|
|
|
- embedding_filename(fname)
|
|
|
|
+ embedding_filename(fname),
|
|
|
|
+ anon_obj(false)
|
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
struct stat st;
|
2008-07-19 00:32:25 +02:00
|
|
|
--- m4/binutils.m4
|
|
|
|
+++ m4/binutils.m4
|
|
|
|
@@ -8,11 +8,12 @@ AC_CHECK_FUNCS(xcalloc)
|
|
|
|
AC_CHECK_FUNCS(xmemdup)
|
|
|
|
AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl"; DL_LIB="-ldl", DL_LIB="")
|
|
|
|
AC_CHECK_LIB(intl, main, LIBS="$LIBS -lintl"; INTL_LIB="-lintl", INTL_LIB="")
|
|
|
|
+AC_CHECK_LIB(z, zlibVersion, LIBS="$LIBS -lz"; Z_LIB=-lz, Z_LIB=)
|
|
|
|
AC_CHECK_LIB(bfd, bfd_openr,, AC_MSG_ERROR([bfd library not found]))
|
|
|
|
|
|
|
|
AC_LANG_PUSH(C)
|
|
|
|
SAVE_LIBS=$LIBS
|
|
|
|
-LIBS=" -lbfd -liberty "
|
|
|
|
+LIBS=" -lbfd -liberty -lz"
|
|
|
|
# Determine if bfd_get_synthetic_symtab macro is available
|
|
|
|
OS="`uname`"
|
|
|
|
if test "$OS" = "Linux"; then
|
|
|
|
--- m4/builtinexpect.m4
|
|
|
|
+++ m4/builtinexpect.m4
|
|
|
|
@@ -5,7 +5,7 @@ AC_MSG_CHECKING([whether __builtin_expec
|
|
|
|
SAVE_CFLAGS=$CFLAGS
|
|
|
|
CFLAGS="-Werror $CFLAGS"
|
|
|
|
AC_TRY_LINK(,[
|
|
|
|
-int i;
|
|
|
|
+int i = 0;
|
|
|
|
if (__builtin_expect(i, 0)) { }
|
|
|
|
],
|
|
|
|
AC_MSG_RESULT([yes]); EXTRA_CFLAGS_MODULE="$EXTRA_CFLAGS_MODULE -DEXPECT_OK",
|
|
|
|
--- m4/cellspubfdsupport.m4
|
|
|
|
+++ m4/cellspubfdsupport.m4
|
|
|
|
@@ -12,7 +12,7 @@ AC_DEFUN([AX_CELL_SPU],
|
|
|
|
|
|
|
|
AC_LANG_PUSH(C)
|
|
|
|
SAVE_LIBS=$LIBS
|
|
|
|
-LIBS=" -lbfd -liberty "
|
|
|
|
+LIBS=" -lbfd -liberty -lz"
|
|
|
|
|
|
|
|
AC_CHECK_LIB(bfd, bfd_openr_iovec,
|
|
|
|
[bfd_openr_iovec_exists="yes"],
|
|
|
|
--- m4/mallocattribute.m4
|
|
|
|
+++ m4/mallocattribute.m4
|
|
|
|
@@ -4,9 +4,9 @@ AC_DEFUN([AX_MALLOC_ATTRIBUTE],
|
|
|
|
AC_MSG_CHECKING([whether malloc attribute is understood])
|
|
|
|
SAVE_CFLAGS=$CFLAGS
|
|
|
|
CFLAGS="-Werror $CFLAGS"
|
|
|
|
-AC_TRY_COMPILE(,[
|
|
|
|
+AC_TRY_COMPILE([
|
|
|
|
void monkey() __attribute__((malloc));
|
|
|
|
-],AC_MSG_RESULT([yes]); AC_DEFINE(MALLOC_ATTRIBUTE_OK, 1, [whether malloc attribute is understood]), AC_MSG_RESULT([no]))
|
|
|
|
+],,AC_MSG_RESULT([yes]); AC_DEFINE(MALLOC_ATTRIBUTE_OK, 1, [whether malloc attribute is understood]), AC_MSG_RESULT([no]))
|
|
|
|
CFLAGS=$SAVE_CFLAGS
|
|
|
|
]
|
|
|
|
)
|
|
|
|
--- utils/opcontrol
|
|
|
|
+++ utils/opcontrol
|
|
|
|
@@ -508,10 +508,19 @@ get_image_range()
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
+ kernel_file=$FILE_IMAGE
|
|
|
|
+ case $(file -L $kernel_file) in
|
|
|
|
+ *"gzip compressed"*)
|
|
|
|
+ kernel_file=$(mktemp /tmp/opcXXXXXX) || exit 1
|
|
|
|
+ trap "rm -f $kernel_file" EXIT
|
|
|
|
+ gzip -cd $FILE_IMAGE > $kernel_file
|
|
|
|
+ ;;
|
|
|
|
+ esac
|
|
|
|
+
|
|
|
|
# start at the start of .text, and end at _etext
|
|
|
|
- range_info=`objdump -h $FILE_IMAGE 2>/dev/null | grep " .text "`
|
|
|
|
+ range_info=`objdump -h $kernel_file 2>/dev/null | grep " .text "`
|
|
|
|
tmp1=`echo $range_info | awk '{print $4}'`
|
|
|
|
- tmp2=`objdump -t $FILE_IMAGE 2>/dev/null | grep "_etext$" | awk '{ print $1 }'`
|
|
|
|
+ tmp2=`objdump -t $kernel_file 2>/dev/null | grep "_etext$" | awk '{ print $1 }'`
|
|
|
|
|
|
|
|
if test -z "$tmp1" -o -z "$tmp2"; then
|
|
|
|
echo "The specified file $FILE_IMAGE does not seem to be valid" >&2
|
2009-03-02 01:39:47 +01:00
|
|
|
--- agents/jvmpi/jvmpi_oprofile.cpp 2009-03-01 16:07:09.000000000 +0000
|
|
|
|
+++ agents/jvmpi/jvmpi_oprofile.cpp 2009-03-01 16:11:37.000000000 +0000
|
|
|
|
@@ -11,6 +11,7 @@
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
+#include <inttypes.h>
|
|
|
|
#include <iostream>
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
|