--- Makefile.am +++ Makefile.am @@ -16,6 +16,7 @@ SUBDIRS = \ doc \ gui +AUTOMAKE_OPTIONS = foreign ACLOCAL_AMFLAGS = -I m4 # The module will not build under distcheck --- configure.in +++ configure.in @@ -127,7 +127,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) --- gui/oprof_start_util.cpp +++ gui/oprof_start_util.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include #include --- libabi/opimport.cpp +++ libabi/opimport.cpp @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include #include --- libpp/op_header.cpp +++ libpp/op_header.cpp @@ -15,6 +15,8 @@ #include #include +#include + #include "op_exception.h" #include "odb.h" #include "op_cpu_type.h" --- libpp/profile.cpp +++ libpp/profile.cpp @@ -17,6 +17,7 @@ #include #include +#include #include "op_exception.h" #include "op_header.h" --- libpp/sample_container.cpp +++ libpp/sample_container.cpp @@ -14,6 +14,8 @@ #include #include +#include + #include "sample_container.h" using namespace std; --- libregex/demangle_symbol.cpp +++ libregex/demangle_symbol.cpp @@ -10,6 +10,8 @@ #include "config.h" +#include + #include "demangle_symbol.h" #include "op_regex.h" --- libregex/op_regex.cpp +++ libregex/op_regex.cpp @@ -282,15 +282,15 @@ void setup_regex(regular_expression_repl string left = line; left_rule.execute(left); if (left == line) { - throw bad_regex("invalid input file: " + - '"' + line + '"'); + throw bad_regex("invalid input file: \"" + + line + '"'); } string right = line; right_rule.execute(right); if (right == line) { - throw bad_regex("invalid input file: " - + '"' + line + '"'); + throw bad_regex("invalid input file: \"" + + line + '"'); } regex.add_pattern(left, right); @@ -301,8 +301,8 @@ void setup_regex(regular_expression_repl string var_value = line; var_value_rule.execute(var_value); if (var_value == line) { - throw bad_regex("invalid input file: " + - '"' + line + '"'); + throw bad_regex("invalid input file: \"" + + line + '"'); } regex.add_definition(var_name, var_value); --- libutil++/bfd_spu_support.cpp +++ libutil++/bfd_spu_support.cpp @@ -14,7 +14,8 @@ #include "config.h" #include "cverb.h" -#include +#include +#include #include #include #include --- libutil++/bfd_support.cpp +++ libutil++/bfd_support.cpp @@ -15,6 +15,8 @@ #include "string_manip.h" #include "cverb.h" +#include +#include #include #include #include --- libutil++/child_reader.cpp +++ libutil++/child_reader.cpp @@ -12,6 +12,9 @@ #include #include +#include +#include +#include #include #include #include --- libutil++/cverb.cpp +++ libutil++/cverb.cpp @@ -9,6 +9,7 @@ * @author John Levon */ +#include #include #include #include --- libutil++/file_manip.cpp +++ libutil++/file_manip.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -37,7 +38,7 @@ bool copy_file(string const & source, st if (stat(source.c_str(), &buf)) 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); --- libutil++/op_bfd.cpp +++ libutil++/op_bfd.cpp @@ -166,7 +166,7 @@ op_bfd::~op_bfd() } -unsigned long const op_bfd::get_start_offset(bfd_vma vma) const +unsigned long op_bfd::get_start_offset(bfd_vma vma) const { if (!vma || !ibfd.valid()) { filepos_map_t::const_iterator it = filepos_map.find(".text"); --- libutil++/op_bfd.h +++ libutil++/op_bfd.h @@ -171,7 +171,7 @@ public: * Otherwise, return the filepos of a section with a matching * vma. */ - unsigned long const get_start_offset(bfd_vma vma = 0) const; + unsigned long get_start_offset(bfd_vma vma = 0) const; /** * Return the image name of the underlying binary image. For an --- libutil++/op_spu_bfd.cpp +++ libutil++/op_spu_bfd.cpp @@ -13,6 +13,8 @@ #include #include +#include +#include #include #include "op_bfd.h" --- m4/binutils.m4 +++ m4/binutils.m4 @@ -8,6 +8,7 @@ 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])) # Determine if bfd_get_synthetic_symtab macro is available --- pp/common_option.cpp +++ pp/common_option.cpp @@ -13,6 +13,8 @@ #include #include +#include + #include "op_config.h" #include "locate_images.h" #include "op_exception.h" --- pp/opannotate_options.cpp +++ pp/opannotate_options.cpp @@ -14,6 +14,8 @@ #include #include +#include + #include "profile_spec.h" #include "arrange_profiles.h" #include "op_exception.h" --- pp/oparchive.cpp +++ pp/oparchive.cpp @@ -13,6 +13,8 @@ #include #include +#include + #include #include --- pp/opgprof_options.cpp +++ pp/opgprof_options.cpp @@ -14,6 +14,8 @@ #include #include +#include + #include "opgprof_options.h" #include "popt_options.h" #include "cverb.h" --- utils/opcontrol +++ utils/opcontrol @@ -489,11 +489,20 @@ get_image_range() return; 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 then continue to the end - 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}'` tmp_length=`echo $range_info | awk '{print $3}'` - tmp2=`objdump -h $FILE_IMAGE --adjust-vma=0x$tmp_length 2>/dev/null | grep " .text " | awk '{print $4}'` + tmp2=`objdump -h $kernel_file --adjust-vma=0x$tmp_length 2>/dev/null | grep " .text " | awk '{print $4}'` if test -z "$tmp1" -o -z "$tmp2"; then echo "The specified file $FILE_IMAGE does not seem to be valid" >&2