aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2002-01-31 18:37:58 +0000
committerNick Clifton <nickc@redhat.com>2002-01-31 18:37:58 +0000
commite7e2dd92262f34fd7246fb639edc6001acf9171d (patch)
treee4d67f7e2f6c542712867a2930cee7d82b0e8059
parentdea03d4e101d4d52a1fda4680794d4ceec1cfc55 (diff)
downloadgdb-e7e2dd92262f34fd7246fb639edc6001acf9171d.zip
gdb-e7e2dd92262f34fd7246fb639edc6001acf9171d.tar.gz
gdb-e7e2dd92262f34fd7246fb639edc6001acf9171d.tar.bz2
Deal with target architecture that have a pointer size that is different from
the host architectures pointer size.
-rw-r--r--gprof/ChangeLog38
-rw-r--r--gprof/Makefile.in15
-rw-r--r--gprof/TODO3
-rw-r--r--gprof/acconfig.h2
-rwxr-xr-xgprof/configure165
-rw-r--r--gprof/configure.in25
-rw-r--r--gprof/gmon.h78
-rw-r--r--gprof/gmon_io.c332
-rw-r--r--gprof/po/gprof.pot198
9 files changed, 488 insertions, 368 deletions
diff --git a/gprof/ChangeLog b/gprof/ChangeLog
index 0eb592d..63654b9 100644
--- a/gprof/ChangeLog
+++ b/gprof/ChangeLog
@@ -1,3 +1,41 @@
+2002-01-31 Jason R Thorpe <thorpej@wasabisystems.com>
+
+ * TODO: Remove "host architecture pointer size" item.
+ * acconfig.h: Remove.
+ * gconfig.in: Regenerate.
+ * configure.in: Remove check for gmon pointer size.
+ * configure: Regenerate.
+ * gmon.h (GMON_HDRSIZE_BSD44_32): Define.
+ (GMON_HDRSIZE_BSD44_64): Ditto.
+ (GMON_HDRSIZE_OLDBSD_32): Ditto.
+ (GMON_HDRSIZE_OLDBSD_64): Ditto.
+ (struct raw_phdr): Wrap in #if 0, keeping it for
+ documentation purposes only.
+ (struct old_raw_phdr): Likewise.
+ (struct raw_arc): Likewise. Change type/size of
+ "count" member to long match 4.4BSD.
+ * gmon_io: Update copyright years.
+ (gmon_io_read_64): New function.
+ (gmon_io_read_vma): Use bfd_arch_bits_per_address to
+ determine target pointer size. Use gmon_io_read_32
+ and gmon_io_read_64.
+ (gmon_io_write_64): New function.
+ (gmon_io_write_vma): Use bfd_arch_bits_per_address to
+ determine target pointer size. Use gmon_io_write_32
+ and gmon_io_write_64.
+ (get_vma): Remove.
+ (put_vma): Ditto.
+ (gmon_read_raw_arc): New function.
+ (gmon_write_raw_arc): New function.
+ (gmon_out_read): Do not use struct raw_phdr or
+ struct old_raw_phdr to read the gmon header. Use
+ gmon_read_raw_arc to read call graph records.
+ (gmon_out_write): Do not use struct raw_phdr or
+ struct old_raw_phdr to write the gmon header. Use
+ gmon_write_raw_arc to write call graph records.
+ * po/gprof.pot: Regenerate.
+ * Makefile.in: Regenerate.
+
2002-01-31 Alan Modra <amodra@bigpond.net.au>
* alpha.c (alpha_Instruction): Don't use.
diff --git a/gprof/Makefile.in b/gprof/Makefile.in
index 530623a..5220619 100644
--- a/gprof/Makefile.in
+++ b/gprof/Makefile.in
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -187,13 +187,12 @@ NROFF = nroff
HEADERS = $(noinst_HEADERS)
DIST_COMMON = README ./stamp-h.in ChangeLog Makefile.am Makefile.in \
-TODO acconfig.h acinclude.m4 aclocal.m4 configure configure.in \
-gconfig.in
+TODO acinclude.m4 aclocal.m4 configure configure.in gconfig.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = tar
+TAR = gtar
GZIP_ENV = --best
SOURCES = $(gprof_SOURCES)
OBJECTS = $(gprof_OBJECTS)
@@ -231,7 +230,7 @@ $(srcdir)/gconfig.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h.in
rm -f $(srcdir)/stamp-h.in; \
$(MAKE) $(srcdir)/stamp-h.in; \
else :; fi
-$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
+$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOHEADER)
@echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
@@ -390,7 +389,7 @@ uninstall-info:
else ii=; fi; \
list='$(INFO_DEPS)'; \
for file in $$list; do \
- test -z "$ii" \
+ test -z "$$ii" \
|| install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
done
@$(NORMAL_UNINSTALL)
@@ -504,7 +503,7 @@ maintainer-clean-recursive:
dot_seen=no; \
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
rev="$$subdir $$rev"; \
- test "$$subdir" = "." && dot_seen=yes; \
+ test "$$subdir" != "." || dot_seen=yes; \
done; \
test "$$dot_seen" = "no" && rev=". $$rev"; \
target=`echo $@ | sed s/-recursive//`; \
diff --git a/gprof/TODO b/gprof/TODO
index 20111c6..3249838 100644
--- a/gprof/TODO
+++ b/gprof/TODO
@@ -1,7 +1,4 @@
-- gmon_io.c cannot deal with target architecture that have a pointer size
- that is different from the host architectures pointer size---fix this
- (gmon_out.h, and gmon_io.c)
- add support for prof file format so that prof files can be displayed
at the line-level (this is useful for the uprofile tool under DEC's
OSF/1)
diff --git a/gprof/acconfig.h b/gprof/acconfig.h
deleted file mode 100644
index 11991dd..0000000
--- a/gprof/acconfig.h
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Define as the size of a pointer in the target profile file format. */
-#undef GMON_PTR_SIZE
diff --git a/gprof/configure b/gprof/configure
index cae0bd8..442e642 100755
--- a/gprof/configure
+++ b/gprof/configure
@@ -3143,7 +3143,7 @@ EOF
fi
-for ac_hdr in unistd.h
+for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@@ -3275,11 +3275,24 @@ else
#include <fcntl.h>
#include <sys/mman.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
/* This mess was copied from the GNU getpagesize.h. */
#ifndef HAVE_GETPAGESIZE
-# ifdef HAVE_UNISTD_H
-# include <unistd.h>
-# endif
/* Assume that all systems that can run configure have sys/param.h. */
# ifndef HAVE_SYS_PARAM_H
@@ -3387,7 +3400,7 @@ main()
}
EOF
-if { (eval echo configure:3391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_mmap_fixed_mapped=yes
else
@@ -3415,17 +3428,17 @@ unistd.h values.h sys/param.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3419: checking for $ac_hdr" >&5
+echo "configure:3432: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3424 "configure"
+#line 3437 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3429: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3442: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -3455,12 +3468,12 @@ done
__argz_count __argz_stringify __argz_next
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3459: checking for $ac_func" >&5
+echo "configure:3472: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3464 "configure"
+#line 3477 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3483,7 +3496,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3512,12 +3525,12 @@ done
for ac_func in stpcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3516: checking for $ac_func" >&5
+echo "configure:3529: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3521 "configure"
+#line 3534 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3540,7 +3553,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3557: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3574,19 +3587,19 @@ EOF
if test $ac_cv_header_locale_h = yes; then
echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:3578: checking for LC_MESSAGES" >&5
+echo "configure:3591: checking for LC_MESSAGES" >&5
if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3583 "configure"
+#line 3596 "configure"
#include "confdefs.h"
#include <locale.h>
int main() {
return LC_MESSAGES
; return 0; }
EOF
-if { (eval echo configure:3590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_val_LC_MESSAGES=yes
else
@@ -3607,7 +3620,7 @@ EOF
fi
fi
echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:3611: checking whether NLS is requested" >&5
+echo "configure:3624: checking whether NLS is requested" >&5
# Check whether --enable-nls or --disable-nls was given.
if test "${enable_nls+set}" = set; then
enableval="$enable_nls"
@@ -3627,7 +3640,7 @@ fi
EOF
echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:3631: checking whether included gettext is requested" >&5
+echo "configure:3644: checking whether included gettext is requested" >&5
# Check whether --with-included-gettext or --without-included-gettext was given.
if test "${with_included_gettext+set}" = set; then
withval="$with_included_gettext"
@@ -3646,17 +3659,17 @@ fi
ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:3650: checking for libintl.h" >&5
+echo "configure:3663: checking for libintl.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3655 "configure"
+#line 3668 "configure"
#include "confdefs.h"
#include <libintl.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3660: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3673: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -3673,19 +3686,19 @@ fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6
-echo "configure:3677: checking for gettext in libc" >&5
+echo "configure:3690: checking for gettext in libc" >&5
if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3682 "configure"
+#line 3695 "configure"
#include "confdefs.h"
#include <libintl.h>
int main() {
return (int) gettext ("")
; return 0; }
EOF
-if { (eval echo configure:3689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
gt_cv_func_gettext_libc=yes
else
@@ -3701,7 +3714,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6
if test "$gt_cv_func_gettext_libc" != "yes"; then
echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
-echo "configure:3705: checking for bindtextdomain in -lintl" >&5
+echo "configure:3718: checking for bindtextdomain in -lintl" >&5
ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3709,7 +3722,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lintl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3713 "configure"
+#line 3726 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3720,7 +3733,7 @@ int main() {
bindtextdomain()
; return 0; }
EOF
-if { (eval echo configure:3724: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3737: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3736,19 +3749,19 @@ fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6
-echo "configure:3740: checking for gettext in libintl" >&5
+echo "configure:3753: checking for gettext in libintl" >&5
if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3745 "configure"
+#line 3758 "configure"
#include "confdefs.h"
int main() {
return (int) gettext ("")
; return 0; }
EOF
-if { (eval echo configure:3752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
gt_cv_func_gettext_libintl=yes
else
@@ -3776,7 +3789,7 @@ EOF
# Extract the first word of "msgfmt", so it can be a program name with args.
set dummy msgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3780: checking for $ac_word" >&5
+echo "configure:3793: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3810,12 +3823,12 @@ fi
for ac_func in dcgettext
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3814: checking for $ac_func" >&5
+echo "configure:3827: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3819 "configure"
+#line 3832 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3838,7 +3851,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3842: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3865,7 +3878,7 @@ done
# Extract the first word of "gmsgfmt", so it can be a program name with args.
set dummy gmsgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3869: checking for $ac_word" >&5
+echo "configure:3882: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3901,7 +3914,7 @@ fi
# Extract the first word of "xgettext", so it can be a program name with args.
set dummy xgettext; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3905: checking for $ac_word" >&5
+echo "configure:3918: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3933,7 +3946,7 @@ else
fi
cat > conftest.$ac_ext <<EOF
-#line 3937 "configure"
+#line 3950 "configure"
#include "confdefs.h"
int main() {
@@ -3941,7 +3954,7 @@ extern int _nl_msg_cat_cntr;
return _nl_msg_cat_cntr
; return 0; }
EOF
-if { (eval echo configure:3945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
CATOBJEXT=.gmo
DATADIRNAME=share
@@ -3973,7 +3986,7 @@ fi
# Extract the first word of "msgfmt", so it can be a program name with args.
set dummy msgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3977: checking for $ac_word" >&5
+echo "configure:3990: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4007,7 +4020,7 @@ fi
# Extract the first word of "gmsgfmt", so it can be a program name with args.
set dummy gmsgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4011: checking for $ac_word" >&5
+echo "configure:4024: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4043,7 +4056,7 @@ fi
# Extract the first word of "xgettext", so it can be a program name with args.
set dummy xgettext; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4047: checking for $ac_word" >&5
+echo "configure:4060: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4133,7 +4146,7 @@ fi
LINGUAS=
else
echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:4137: checking for catalogs to be installed" >&5
+echo "configure:4150: checking for catalogs to be installed" >&5
NEW_LINGUAS=
for lang in ${LINGUAS=$ALL_LINGUAS}; do
case "$ALL_LINGUAS" in
@@ -4161,17 +4174,17 @@ echo "configure:4137: checking for catalogs to be installed" >&5
if test "$CATOBJEXT" = ".cat"; then
ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6
-echo "configure:4165: checking for linux/version.h" >&5
+echo "configure:4178: checking for linux/version.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4170 "configure"
+#line 4183 "configure"
#include "confdefs.h"
#include <linux/version.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4175: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4188: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4234,7 +4247,7 @@ fi
echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:4238: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:4251: checking whether to enable maintainer-specific portions of Makefiles" >&5
# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
if test "${enable_maintainer_mode+set}" = set; then
enableval="$enable_maintainer_mode"
@@ -4259,7 +4272,7 @@ fi
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:4263: checking for executable suffix" >&5
+echo "configure:4276: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4269,7 +4282,7 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:4273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:4286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj) ;;
@@ -4294,17 +4307,17 @@ for ac_hdr in sys/gmon_out.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4298: checking for $ac_hdr" >&5
+echo "configure:4311: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4303 "configure"
+#line 4316 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4308: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4321: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4331,54 +4344,6 @@ fi
done
-echo $ac_n "checking the size of gmon pointers""... $ac_c" 1>&6
-echo "configure:4336: checking the size of gmon pointers" >&5
-if test "$cross_compiling" = yes; then
- gmon_ptr_size=4
-else
- cat > conftest.$ac_ext <<EOF
-#line 4341 "configure"
-#include "confdefs.h"
-#include <stdio.h>
-#include <stdlib.h>
-#if HAVE_SYS_GMON_OUT_H
-#include <sys/gmon_out.h>
-#endif
-main()
-{
-#if HAVE_SYS_GMON_OUT_H
- struct gmon_cg_arc_record arc;
- FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
- fprintf(f, "%d\n", sizeof(arc.from_pc));
- exit(0);
-#else
- FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
- fprintf(f, "%d\n", (int) sizeof(char *));
- exit(1);
-#endif
-}
-EOF
-if { (eval echo configure:4364: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- gmon_ptr_size=`cat conftestval`
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- gmon_ptr_size=4
-fi
-rm -fr conftest*
-fi
-
-echo "$ac_t""$gmon_ptr_size" 1>&6
-
-cat >> confdefs.h <<EOF
-#define GMON_PTR_SIZE $gmon_ptr_size
-EOF
-
-
build_warnings="-W -Wall"
# Check whether --enable-build-warnings or --disable-build-warnings was given.
if test "${enable_build_warnings+set}" = set; then
diff --git a/gprof/configure.in b/gprof/configure.in
index d9ddf48..cbe43b3 100644
--- a/gprof/configure.in
+++ b/gprof/configure.in
@@ -31,31 +31,6 @@ AC_EXEEXT
AC_CHECK_HEADERS(sys/gmon_out.h)
-AC_MSG_CHECKING(the size of gmon pointers)
-AC_TRY_RUN([#include <stdio.h>
-#include <stdlib.h>
-#if HAVE_SYS_GMON_OUT_H
-#include <sys/gmon_out.h>
-#endif
-main()
-{
-#if HAVE_SYS_GMON_OUT_H
- struct gmon_cg_arc_record arc;
- FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
- fprintf(f, "%d\n", sizeof(arc.from_pc));
- exit(0);
-#else
- FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
- fprintf(f, "%d\n", (int) sizeof(char *));
- exit(1);
-#endif
-}], gmon_ptr_size=`cat conftestval`, gmon_ptr_size=4, gmon_ptr_size=4)
-AC_MSG_RESULT($gmon_ptr_size)
-
-AC_DEFINE_UNQUOTED(GMON_PTR_SIZE, $gmon_ptr_size)
-
build_warnings="-W -Wall"
AC_ARG_ENABLE(build-warnings,
[ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
diff --git a/gprof/gmon.h b/gprof/gmon.h
index 28a54bc..884add1 100644
--- a/gprof/gmon.h
+++ b/gprof/gmon.h
@@ -35,37 +35,53 @@
#ifndef gmon_h
#define gmon_h
-struct raw_phdr
- {
- /* FIXME: Checking a host compiler define means that we can't use
- a cross gprof to the alpha. */
- char low_pc[GMON_PTR_SIZE]; /* base pc address of sample buffer */
- char high_pc[GMON_PTR_SIZE];/* max pc address of sampled buffer */
- char ncnt[4]; /* size of sample buffer (plus this header) */
+/* Size of the 4.4BSD gmon header */
+#define GMON_HDRSIZE_BSD44_32 (4 + 4 + 4 + 4 + 4 + (3 * 4))
+#define GMON_HDRSIZE_BSD44_64 (8 + 8 + 4 + 4 + 4 + (3 * 4))
- char version[4]; /* version number */
- char profrate[4]; /* profiling clock rate */
- char spare[3*4]; /* reserved */
- };
+#if 0 /* For documentation purposes only. */
+ struct raw_phdr
+ {
+ char low_pc[sizeof(void *)]; /* base pc address of sample buffer */
+ char high_pc[sizeof(void *)];/* max pc address of sampled buffer */
+ char ncnt[4]; /* size of sample buffer (plus this
+ header) */
+
+ char version[4]; /* version number */
+ char profrate[4]; /* profiling clock rate */
+ char spare[3*4]; /* reserved */
+ };
+#endif
#define GMONVERSION 0x00051879
-struct old_raw_phdr
- {
- char low_pc[GMON_PTR_SIZE]; /* base pc address of sample buffer */
- char high_pc[GMON_PTR_SIZE];/* max pc address of sampled buffer */
- char ncnt[4]; /* size of sample buffer (plus this header) */
+/* Size of the old BSD gmon header */
+#define GMON_HDRSIZE_OLDBSD_32 (4 + 4 + 4)
+
+/* FIXME: Checking host compiler defines here means that we can't
+ use a cross gprof alpha OSF. */
+#if defined(__alpha__) && defined (__osf__)
+#define GMON_HDRSIZE_OLDBSD_64 (8 + 8 + 4 + 4)
+#else
+#define GMON_HDRSIZE_OLDBSD_64 (8 + 8 + 4)
+#endif
- /* FIXME: Checking host compiler defines here means that we can't
- use a cross gprof alpha OSF. */
+#if 0 /* For documentation purposes only. */
+ struct old_raw_phdr
+ {
+ char low_pc[sizeof(void *)]; /* base pc address of sample buffer */
+ char high_pc[sizeof(void *)];/* max pc address of sampled buffer */
+ char ncnt[4]; /* size of sample buffer (plus this
+ header) */
#if defined (__alpha__) && defined (__osf__)
- /*
- * DEC's OSF v3.0 uses 4 bytes of padding to bring the header to
- * a size that is a multiple of 8.
- */
- char pad[4];
+ /*
+ * DEC's OSF v3.0 uses 4 bytes of padding to bring the header to
+ * a size that is a multiple of 8.
+ */
+ char pad[4];
+#endif
+ };
#endif
- };
/*
* Histogram counters are unsigned shorts:
@@ -120,12 +136,14 @@ struct tostruct
* as to get a packed representation (otherwise, different compilers
* might introduce different padding):
*/
-struct raw_arc
- {
- char from_pc[GMON_PTR_SIZE];
- char self_pc[GMON_PTR_SIZE];
- char count[4];
- };
+#if 0 /* For documentation purposes only. */
+ struct raw_arc
+ {
+ char from_pc[sizeof(void *)];
+ char self_pc[sizeof(void *)];
+ char count[sizeof(long)];
+ };
+#endif
/*
* General rounding functions:
diff --git a/gprof/gmon_io.c b/gprof/gmon_io.c
index bf8efef..0bc5caa 100644
--- a/gprof/gmon_io.c
+++ b/gprof/gmon_io.c
@@ -1,6 +1,6 @@
/* gmon_io.c - Input and output from/to gmon.out files.
- Copyright 2000, 2001 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -38,49 +38,81 @@ int gmon_input = 0;
int gmon_file_version = 0; /* 0 == old (non-versioned) file format. */
int
-DEFUN (gmon_io_read_vma, (ifp, valp), FILE * ifp AND bfd_vma *valp)
+DEFUN (gmon_io_read_32, (ifp, valp), FILE * ifp AND unsigned int *valp)
+{
+ char buf[4];
+
+ if (fread (buf, 1, 4, ifp) != 4)
+ return 1;
+ *valp = bfd_get_32 (core_bfd, buf);
+ return 0;
+}
+
+int
+DEFUN (gmon_io_read_64, (ifp, valp), FILE * ifp AND BFD_HOST_U_64_BIT *valp)
{
char buf[8];
- bfd_vma val;
- switch (GMON_PTR_SIZE)
+ if (fread (buf, 1, 8, ifp) != 8)
+ return 1;
+ *valp = bfd_get_64 (core_bfd, buf);
+ return 0;
+}
+
+int
+DEFUN (gmon_io_read_vma, (ifp, valp), FILE * ifp AND bfd_vma *valp)
+{
+ unsigned int val32;
+ BFD_HOST_U_64_BIT val64;
+
+ switch (bfd_arch_bits_per_address (core_bfd))
{
- case 4:
- if (fread (buf, 1, 4, ifp) != 4)
+ case 32:
+ if (gmon_io_read_32 (ifp, &val32))
return 1;
- val = bfd_get_32 (core_bfd, buf);
+ *valp = val32;
break;
- case 8:
- if (fread (buf, 1, 8, ifp) != 8)
+ case 64:
+ if (gmon_io_read_64 (ifp, &val64))
return 1;
- val = bfd_get_64 (core_bfd, buf);
+ *valp = val64;
break;
default:
- fprintf (stderr, _("%s: GMON_PTR_SIZE has unexpected value of %u\n"),
- whoami, GMON_PTR_SIZE);
+ fprintf (stderr, _("%s: bits per address has unexpected value of %u\n"),
+ whoami, bfd_arch_bits_per_address (core_bfd));
done (1);
}
- *valp = val;
return 0;
}
int
-DEFUN (gmon_io_read_32, (ifp, valp), FILE * ifp AND unsigned int *valp)
+DEFUN (gmon_io_read, (ifp, buf, n), FILE * ifp AND char *buf AND size_t n)
+{
+ if (fread (buf, 1, n, ifp) != n)
+ return 1;
+ return 0;
+}
+
+int
+DEFUN (gmon_io_write_32, (ofp, val), FILE * ofp AND unsigned int val)
{
char buf[4];
- if (fread (buf, 1, 4, ifp) != 4)
+ bfd_put_32 (core_bfd, val, buf);
+ if (fwrite (buf, 1, 4, ofp) != 4)
return 1;
- *valp = bfd_get_32 (core_bfd, buf);
return 0;
}
int
-DEFUN (gmon_io_read, (ifp, buf, n), FILE * ifp AND char *buf AND size_t n)
+DEFUN (gmon_io_write_64, (ofp, val), FILE * ofp AND BFD_HOST_U_64_BIT val)
{
- if (fread (buf, 1, n, ifp) != n)
+ char buf[8];
+
+ bfd_put_64 (core_bfd, val, buf);
+ if (fwrite (buf, 1, 8, ofp) != 8)
return 1;
return 0;
}
@@ -88,42 +120,28 @@ DEFUN (gmon_io_read, (ifp, buf, n), FILE * ifp AND char *buf AND size_t n)
int
DEFUN (gmon_io_write_vma, (ofp, val), FILE * ofp AND bfd_vma val)
{
- char buf[8];
- switch (GMON_PTR_SIZE)
+ switch (bfd_arch_bits_per_address (core_bfd))
{
- case 4:
- bfd_put_32 (core_bfd, val, buf);
- if (fwrite (buf, 1, 4, ofp) != 4)
+ case 32:
+ if (gmon_io_write_32 (ofp, (unsigned int) val))
return 1;
break;
- case 8:
- bfd_put_64 (core_bfd, val, buf);
- if (fwrite (buf, 1, 8, ofp) != 8)
+ case 64:
+ if (gmon_io_write_64 (ofp, (BFD_HOST_U_64_BIT) val))
return 1;
break;
default:
- fprintf (stderr, _("%s: GMON_PTR_SIZE has unexpected value of %u\n"),
- whoami, GMON_PTR_SIZE);
+ fprintf (stderr, _("%s: bits per address has unexpected value of %u\n"),
+ whoami, bfd_arch_bits_per_address (core_bfd));
done (1);
}
return 0;
}
int
-DEFUN (gmon_io_write_32, (ofp, val), FILE * ofp AND unsigned int val)
-{
- char buf[4];
-
- bfd_put_32 (core_bfd, val, buf);
- if (fwrite (buf, 1, 4, ofp) != 4)
- return 1;
- return 0;
-}
-
-int
DEFUN (gmon_io_write_8, (ofp, val), FILE * ofp AND unsigned char val)
{
char buf[1];
@@ -142,39 +160,64 @@ DEFUN (gmon_io_write, (ofp, buf, n), FILE * ofp AND char *buf AND size_t n)
return 0;
}
-/* get_vma and put_vma are for backwards compatibility only */
-static bfd_vma
-DEFUN (get_vma, (abfd, addr), bfd * abfd AND bfd_byte * addr)
+int
+DEFUN (gmon_read_raw_arc, (ifp, fpc, spc, cnt), FILE * ifp AND bfd_vma * fpc AND bfd_vma * spc AND unsigned long * cnt)
{
- switch (sizeof (char*))
+ BFD_HOST_U_64_BIT cnt64;
+ unsigned int cnt32;
+
+ if (gmon_io_read_vma (ifp, fpc)
+ || gmon_io_read_vma (ifp, spc))
+ return 1;
+
+ switch (bfd_arch_bits_per_address (core_bfd))
{
- case 4:
- return bfd_get_32 (abfd, addr);
- case 8:
- return bfd_get_64 (abfd, addr);
+ case 32:
+ if (gmon_io_read_32 (ifp, &cnt32))
+ return 1;
+ *cnt = cnt32;
+ break;
+
+ case 64:
+ if (gmon_io_read_64 (ifp, &cnt64))
+ return 1;
+ *cnt = cnt64;
+ break;
+
default:
- fprintf (stderr, _("%s: bfd_vma has unexpected size of %ld bytes\n"),
- whoami, (long) sizeof (char*));
+ fprintf (stderr, _("%s: bits per address has unexpected value of %u\n"),
+ whoami, bfd_arch_bits_per_address (core_bfd));
done (1);
}
+ return 0;
}
-static void
-DEFUN (put_vma, (abfd, val, addr), bfd * abfd AND bfd_vma val AND bfd_byte * addr)
+int
+DEFUN (gmon_write_raw_arc, (ofp, fpc, spc, cnt), FILE * ofp AND bfd_vma fpc AND bfd_vma spc AND unsigned long cnt)
{
- switch (sizeof (char*))
+
+ if (gmon_io_write_vma (ofp, fpc)
+ || gmon_io_write_vma (ofp, spc))
+ return 1;
+
+ switch (bfd_arch_bits_per_address (core_bfd))
{
- case 4:
- bfd_put_32 (abfd, val, addr);
+ case 32:
+ if (gmon_io_write_32 (ofp, (unsigned int) cnt))
+ return 1;
break;
- case 8:
- bfd_put_64 (abfd, val, addr);
+
+ case 64:
+ if (gmon_io_write_64 (ofp, (BFD_HOST_U_64_BIT) cnt))
+ return 1;
break;
+
default:
- fprintf (stderr, _("%s: bfd_vma has unexpected size of %ld bytes\n"),
- whoami, (long) sizeof (char*));
+ fprintf (stderr, _("%s: bits per address has unexpected value of %u\n"),
+ whoami, bfd_arch_bits_per_address (core_bfd));
done (1);
}
+ return 0;
}
void
@@ -273,14 +316,13 @@ DEFUN (gmon_out_read, (filename), const char *filename)
bfd_vma high_pc;
int ncnt;
};
- int i, samp_bytes, header_size;
+ int i, samp_bytes, header_size = 0;
unsigned long count;
bfd_vma from_pc, self_pc;
- struct raw_arc raw_arc;
- struct raw_phdr raw;
static struct hdr h;
UNIT raw_bin_count;
struct hdr tmp;
+ int version;
/* Information from a gmon.out file is in two parts: an array of
sampling hits within pc ranges, and the arcs. */
@@ -295,25 +337,29 @@ DEFUN (gmon_out_read, (filename), const char *filename)
done (1);
}
- if (fread (&raw, 1, sizeof (struct raw_phdr), ifp)
- != sizeof (struct raw_phdr))
+ /* The beginning of the old BSD header and the 4.4BSD header
+ are the same: lowpc, highpc, ncnt */
+ if (gmon_io_read_vma (ifp, &tmp.low_pc)
+ || gmon_io_read_vma (ifp, &tmp.high_pc)
+ || gmon_io_read_32 (ifp, &tmp.ncnt))
{
- fprintf (stderr, _("%s: file too short to be a gmon file\n"),
+ bad_gmon_file:
+ fprintf (stderr, _("%s: file too short to be a gmon file\n"),
filename);
done (1);
}
- tmp.low_pc = get_vma (core_bfd, (bfd_byte *) &raw.low_pc[0]);
- tmp.high_pc = get_vma (core_bfd, (bfd_byte *) &raw.high_pc[0]);
- tmp.ncnt = bfd_get_32 (core_bfd, (bfd_byte *) &raw.ncnt[0]);
+ /* Check to see if this a 4.4BSD-style header. */
+ if (gmon_io_read_32 (ifp, &version))
+ goto bad_gmon_file;
- if (bfd_get_32 (core_bfd, (bfd_byte *) &raw.version[0])
- == GMONVERSION)
+ if (version == GMONVERSION)
{
int profrate;
/* 4.4BSD format header. */
- profrate = bfd_get_32 (core_bfd, (bfd_byte *) &raw.profrate[0]);
+ if (gmon_io_read_32 (ifp, &profrate))
+ goto bad_gmon_file;
if (!s_highpc)
hz = profrate;
@@ -325,7 +371,22 @@ DEFUN (gmon_out_read, (filename), const char *filename)
done (1);
}
- header_size = sizeof (struct raw_phdr);
+ switch (bfd_arch_bits_per_address (core_bfd))
+ {
+ case 32:
+ header_size = GMON_HDRSIZE_BSD44_32;
+ break;
+
+ case 64:
+ header_size = GMON_HDRSIZE_BSD44_64;
+ break;
+
+ default:
+ fprintf (stderr,
+ _("%s: bits per address has unexpected value of %u\n"),
+ whoami, bfd_arch_bits_per_address (core_bfd));
+ done (1);
+ }
}
else
{
@@ -337,13 +398,29 @@ DEFUN (gmon_out_read, (filename), const char *filename)
done (1);
}
- if (fseek (ifp, sizeof (struct old_raw_phdr), SEEK_SET) < 0)
+ switch (bfd_arch_bits_per_address (core_bfd))
{
- perror (filename);
- done (1);
+ case 32:
+ header_size = GMON_HDRSIZE_OLDBSD_32;
+ break;
+
+ case 64:
+ header_size = GMON_HDRSIZE_OLDBSD_64;
+ break;
+
+ default:
+ fprintf (stderr,
+ _("%s: bits per address has unexpected value of %u\n"),
+ whoami, bfd_arch_bits_per_address (core_bfd));
+ done (1);
}
+ }
- header_size = sizeof (struct old_raw_phdr);
+ /* Position the file to after the header. */
+ if (fseek (ifp, header_size, SEEK_SET) < 0)
+ {
+ perror (filename);
+ done (1);
}
if (s_highpc && (tmp.low_pc != h.low_pc
@@ -408,12 +485,9 @@ DEFUN (gmon_out_read, (filename), const char *filename)
/* The rest of the file consists of a bunch of
<from,self,count> tuples. */
- while (fread (&raw_arc, sizeof (raw_arc), 1, ifp) == 1)
+ while (gmon_read_raw_arc (ifp, &from_pc, &self_pc, &count) == 0)
{
++narcs;
- from_pc = get_vma (core_bfd, (bfd_byte *) raw_arc.from_pc);
- self_pc = get_vma (core_bfd, (bfd_byte *) raw_arc.self_pc);
- count = bfd_get_32 (core_bfd, (bfd_byte *) raw_arc.count);
DBG (SAMPLEDEBUG,
printf ("[gmon_out_read] frompc 0x%lx selfpc 0x%lx count %lu\n",
@@ -503,43 +577,97 @@ DEFUN (gmon_out_write, (filename), const char *filename)
}
else if (file_format == FF_BSD || file_format == FF_BSD44)
{
- struct raw_arc raw_arc;
UNIT raw_bin_count;
- struct raw_phdr h;
- int i;
+ int i, hdrsize;
+ unsigned padsize;
+ char pad[3*4];
Arc *arc;
Sym *sym;
- memset (&h, 0, sizeof h);
- put_vma (core_bfd, s_lowpc, (bfd_byte *) &h.low_pc);
- put_vma (core_bfd, s_highpc, (bfd_byte *) &h.high_pc);
- bfd_put_32 (core_bfd,
- hist_num_bins * sizeof (UNIT) + sizeof (struct raw_phdr),
- (bfd_byte *) &h.ncnt);
+ memset (pad, 0, sizeof (pad));
- /* Write header. Use new style BSD format is explicitly
- specified, or if the profiling rate is non-standard;
- otherwise, use the old BSD format. */
+ hdrsize = 0;
+ /* Decide how large the header will be. Use the 4.4BSD format
+ header if explicitly specified, or if the profiling rate is
+ non-standard. Otherwise, use the old BSD format. */
if (file_format == FF_BSD44
- || hz != hertz ())
+ || hz != hertz())
{
- bfd_put_32 (core_bfd, GMONVERSION, (bfd_byte *) &h.version);
- bfd_put_32 (core_bfd, hz, (bfd_byte *) &h.profrate);
- if (fwrite (&h, sizeof (struct raw_phdr), 1, ofp) != 1)
+ padsize = 3*4;
+ switch (bfd_arch_bits_per_address (core_bfd))
{
- perror (filename);
- done (1);
+ case 32:
+ hdrsize = GMON_HDRSIZE_BSD44_32;
+ break;
+
+ case 64:
+ hdrsize = GMON_HDRSIZE_BSD44_64;
+ break;
+
+ default:
+ fprintf (stderr,
+ _("%s: bits per address has unexpected value of %u\n"),
+ whoami, bfd_arch_bits_per_address (core_bfd));
+ done (1);
}
}
else
{
- if (fwrite (&h, sizeof (struct old_raw_phdr), 1, ofp) != 1)
+ padsize = 0;
+ switch (bfd_arch_bits_per_address (core_bfd))
+ {
+ case 32:
+ hdrsize = GMON_HDRSIZE_OLDBSD_32;
+ break;
+
+ case 64:
+ hdrsize = GMON_HDRSIZE_OLDBSD_64;
+ /* FIXME: Checking host compiler defines here means that we can't
+ use a cross gprof alpha OSF. */
+#if defined(__alpha__) && defined (__osf__)
+ padsize = 4;
+#endif
+ break;
+
+ default:
+ fprintf (stderr,
+ _("%s: bits per address has unexpected value of %u\n"),
+ whoami, bfd_arch_bits_per_address (core_bfd));
+ done (1);
+ }
+ }
+
+ /* Write the parts of the headers that are common to both the
+ old BSD and 4.4BSD formats. */
+ if (gmon_io_write_vma (ofp, s_lowpc)
+ || gmon_io_write_vma (ofp, s_highpc)
+ || gmon_io_write_32 (ofp, hist_num_bins * sizeof (UNIT) + hdrsize))
+ {
+ perror (filename);
+ done (1);
+ }
+
+ /* Write out the 4.4BSD header bits, if that's what we're using. */
+ if (file_format == FF_BSD44
+ || hz != hertz())
+ {
+ if (gmon_io_write_32 (ofp, GMONVERSION)
+ || gmon_io_write_32 (ofp, hz))
{
perror (filename);
done (1);
}
}
+ /* Now write out any necessary padding after the meaningful
+ header bits. */
+ if (padsize != 0
+ && fwrite (pad, 1, padsize, ofp) != padsize)
+ {
+ perror (filename);
+ done (1);
+ }
+
/* Dump the samples. */
for (i = 0; i < hist_num_bins; ++i)
{
@@ -556,12 +684,8 @@ DEFUN (gmon_out_write, (filename), const char *filename)
{
for (arc = sym->cg.children; arc; arc = arc->next_child)
{
- put_vma (core_bfd, arc->parent->addr,
- (bfd_byte *) raw_arc.from_pc);
- put_vma (core_bfd, arc->child->addr,
- (bfd_byte *) raw_arc.self_pc);
- bfd_put_32 (core_bfd, arc->count, (bfd_byte *) raw_arc.count);
- if (fwrite (&raw_arc, sizeof (raw_arc), 1, ofp) != 1)
+ if (gmon_write_raw_arc (ofp, arc->parent->addr,
+ arc->child->addr, arc->count))
{
perror (filename);
done (1);
diff --git a/gprof/po/gprof.pot b/gprof/po/gprof.pot
index 5eb13e4..f586066 100644
--- a/gprof/po/gprof.pot
+++ b/gprof/po/gprof.pot
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2002-01-17 14:03+0000\n"
+"POT-Creation-Date: 2002-01-31 18:32+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -14,46 +14,46 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: alpha.c:90
+#: alpha.c:93 mips.c:47
msgid "<indirect child>"
msgstr ""
-#: alpha.c:107
+#: alpha.c:110 mips.c:64
#, c-format
msgid "[find_call] %s: 0x%lx to 0x%lx\n"
msgstr ""
-#: alpha.c:129
+#: alpha.c:132
#, c-format
msgid "[find_call] 0x%lx: jsr%s <indirect_child>\n"
msgstr ""
-#: alpha.c:138
+#: alpha.c:142
#, c-format
msgid "[find_call] 0x%lx: bsr"
msgstr ""
-#: basic_blocks.c:124 call_graph.c:87 hist.c:92
+#: basic_blocks.c:122 call_graph.c:90 hist.c:93
#, c-format
msgid "%s: %s: unexpected end of file\n"
msgstr ""
-#: basic_blocks.c:192
+#: basic_blocks.c:190
#, c-format
msgid "%s: warning: ignoring basic-block exec counts (use -l or --line)\n"
msgstr ""
#. FIXME: This only works if bfd_vma is unsigned long.
-#: basic_blocks.c:283 basic_blocks.c:293
+#: basic_blocks.c:281 basic_blocks.c:291
#, c-format
msgid "%s:%d: (%s:0x%lx) %lu executions\n"
msgstr ""
-#: basic_blocks.c:284 basic_blocks.c:294
+#: basic_blocks.c:282 basic_blocks.c:292
msgid "<unknown>"
msgstr ""
-#: basic_blocks.c:538
+#: basic_blocks.c:536
#, c-format
msgid ""
"\n"
@@ -64,284 +64,280 @@ msgid ""
"\n"
msgstr ""
-#: basic_blocks.c:562
+#: basic_blocks.c:560
msgid ""
"\n"
"Execution Summary:\n"
"\n"
msgstr ""
-#: basic_blocks.c:563
+#: basic_blocks.c:561
#, c-format
msgid "%9ld Executable lines in this file\n"
msgstr ""
-#: basic_blocks.c:565
+#: basic_blocks.c:563
#, c-format
msgid "%9ld Lines executed\n"
msgstr ""
-#: basic_blocks.c:566
+#: basic_blocks.c:564
#, c-format
msgid "%9.2f Percent of the file executed\n"
msgstr ""
-#: basic_blocks.c:570
+#: basic_blocks.c:568
#, c-format
msgid ""
"\n"
"%9lu Total number of line executions\n"
msgstr ""
-#: basic_blocks.c:572
+#: basic_blocks.c:570
#, c-format
msgid "%9.2f Average executions per line\n"
msgstr ""
-#: call_graph.c:66
+#: call_graph.c:69
#, c-format
msgid "[cg_tally] arc from %s to %s traversed %lu times\n"
msgstr ""
-#: cg_print.c:54
+#: cg_print.c:58
msgid ""
"\t\t Call graph (explanation follows)\n"
"\n"
msgstr ""
-#: cg_print.c:56
+#: cg_print.c:60
msgid ""
"\t\t\tCall graph\n"
"\n"
msgstr ""
-#: cg_print.c:59 hist.c:354
+#: cg_print.c:63 hist.c:355
#, c-format
msgid ""
"\n"
"granularity: each sample hit covers %ld byte(s)"
msgstr ""
-#: cg_print.c:63
+#: cg_print.c:67
#, c-format
msgid ""
" for %.2f%% of %.2f seconds\n"
"\n"
msgstr ""
-#: cg_print.c:67
+#: cg_print.c:71
msgid ""
" no time propagated\n"
"\n"
msgstr ""
-#: cg_print.c:76 cg_print.c:79 cg_print.c:81
+#: cg_print.c:80 cg_print.c:83 cg_print.c:85
msgid "called"
msgstr ""
-#: cg_print.c:76 cg_print.c:81
+#: cg_print.c:80 cg_print.c:85
msgid "total"
msgstr ""
-#: cg_print.c:76
+#: cg_print.c:80
msgid "parents"
msgstr ""
-#: cg_print.c:78 cg_print.c:79
+#: cg_print.c:82 cg_print.c:83
msgid "index"
msgstr ""
-#: cg_print.c:78
+#: cg_print.c:82
msgid "%time"
msgstr ""
-#: cg_print.c:78 cg_print.c:79
+#: cg_print.c:82 cg_print.c:83
msgid "self"
msgstr ""
-#: cg_print.c:78
+#: cg_print.c:82
msgid "descendants"
msgstr ""
-#: cg_print.c:79 hist.c:380
+#: cg_print.c:83 hist.c:381
msgid "name"
msgstr ""
-#: cg_print.c:81
+#: cg_print.c:85
msgid "children"
msgstr ""
-#: cg_print.c:86
+#: cg_print.c:90
#, c-format
msgid "index %% time self children called name\n"
msgstr ""
-#: cg_print.c:109
+#: cg_print.c:113
#, c-format
msgid " <cycle %d as a whole> [%d]\n"
msgstr ""
-#: cg_print.c:335
+#: cg_print.c:339
#, c-format
msgid "%6.6s %5.5s %7.7s %11.11s %7.7s %7.7s <spontaneous>\n"
msgstr ""
-#: cg_print.c:336
+#: cg_print.c:340
#, c-format
msgid "%6.6s %5.5s %7.7s %7.7s %7.7s %7.7s <spontaneous>\n"
msgstr ""
-#: cg_print.c:570
+#: cg_print.c:574
msgid ""
"Index by function name\n"
"\n"
msgstr ""
-#: cg_print.c:627 cg_print.c:636
+#: cg_print.c:631 cg_print.c:640
#, c-format
msgid "<cycle %d>"
msgstr ""
-#: corefile.c:61
+#: corefile.c:64
#, c-format
msgid "%s: could not open %s.\n"
msgstr ""
-#: corefile.c:75 corefile.c:109
+#: corefile.c:78 corefile.c:112
#, c-format
msgid "%s: unable to parse mapping file %s.\n"
msgstr ""
-#: corefile.c:151
+#: corefile.c:154
#, c-format
msgid "%s: %s: not in a.out format\n"
msgstr ""
-#: corefile.c:162
+#: corefile.c:165
#, c-format
msgid "%s: can't find .text section in %s\n"
msgstr ""
-#: corefile.c:220
+#: corefile.c:223
#, c-format
msgid "%s: ran out room for %lu bytes of text space\n"
msgstr ""
-#: corefile.c:234
+#: corefile.c:237
#, c-format
msgid "%s: can't do -c\n"
msgstr ""
-#: corefile.c:265
+#: corefile.c:272
#, c-format
msgid "%s: -c not supported on architecture %s\n"
msgstr ""
-#: corefile.c:432
+#: corefile.c:439
#, c-format
msgid "%s: file `%s' has no symbols\n"
msgstr ""
-#: corefile.c:732
+#: corefile.c:739
#, c-format
msgid "%s: somebody miscounted: ltab.len=%d instead of %ld\n"
msgstr ""
-#: gmon_io.c:59 gmon_io.c:106
+#: gmon_io.c:83 gmon_io.c:137 gmon_io.c:188 gmon_io.c:216 gmon_io.c:386
+#: gmon_io.c:413 gmon_io.c:609 gmon_io.c:634
#, c-format
-msgid "%s: GMON_PTR_SIZE has unexpected value of %u\n"
+msgid "%s: bits per address has unexpected value of %u\n"
msgstr ""
-#: gmon_io.c:154 gmon_io.c:172
-#, c-format
-msgid "%s: bfd_vma has unexpected size of %ld bytes\n"
-msgstr ""
-
-#: gmon_io.c:207 gmon_io.c:299
+#: gmon_io.c:252 gmon_io.c:347
#, c-format
msgid "%s: file too short to be a gmon file\n"
msgstr ""
-#: gmon_io.c:217 gmon_io.c:333
+#: gmon_io.c:262 gmon_io.c:396
#, c-format
msgid "%s: file `%s' has bad magic cookie\n"
msgstr ""
-#: gmon_io.c:228
+#: gmon_io.c:273
#, c-format
msgid "%s: file `%s' has unsupported version %d\n"
msgstr ""
-#: gmon_io.c:258
+#: gmon_io.c:303
#, c-format
msgid "%s: %s: found bad tag %d (file corrupted?)\n"
msgstr ""
-#: gmon_io.c:321
+#: gmon_io.c:369
#, c-format
msgid "%s: profiling rate incompatible with first gmon file\n"
msgstr ""
-#: gmon_io.c:350
+#: gmon_io.c:429
#, c-format
msgid "%s: incompatible with first gmon file\n"
msgstr ""
-#: gmon_io.c:378
+#: gmon_io.c:457
#, c-format
msgid "%s: file '%s' does not appear to be in gmon.out format\n"
msgstr ""
-#: gmon_io.c:399
+#: gmon_io.c:478
#, c-format
msgid "%s: unexpected EOF after reading %d/%d bins\n"
msgstr ""
-#: gmon_io.c:435
+#: gmon_io.c:511
msgid "time is in ticks, not seconds\n"
msgstr ""
-#: gmon_io.c:441 gmon_io.c:578
+#: gmon_io.c:517 gmon_io.c:704
#, c-format
msgid "%s: don't know how to deal with file format %d\n"
msgstr ""
-#: gmon_io.c:448
+#: gmon_io.c:524
#, c-format
msgid "File `%s' (version %d) contains:\n"
msgstr ""
-#: gmon_io.c:451
+#: gmon_io.c:527
#, c-format
msgid "\t%d histogram record\n"
msgstr ""
-#: gmon_io.c:452
+#: gmon_io.c:528
#, c-format
msgid "\t%d histogram records\n"
msgstr ""
-#: gmon_io.c:454
+#: gmon_io.c:530
#, c-format
msgid "\t%d call-graph record\n"
msgstr ""
-#: gmon_io.c:455
+#: gmon_io.c:531
#, c-format
msgid "\t%d call-graph records\n"
msgstr ""
-#: gmon_io.c:457
+#: gmon_io.c:533
#, c-format
msgid "\t%d basic-block count record\n"
msgstr ""
-#: gmon_io.c:458
+#: gmon_io.c:534
#, c-format
msgid "\t%d basic-block count records\n"
msgstr ""
-#: gprof.c:145
+#: gprof.c:147
#, c-format
msgid ""
"Usage: %s [-[abcDhilLsTvwxyz]] [-[ACeEfFJnNOpPqQZ][name]] [-I dirs]\n"
@@ -359,119 +355,119 @@ msgid ""
"\t[image-file] [profile-file...]\n"
msgstr ""
-#: gprof.c:161
+#: gprof.c:163
#, c-format
msgid "Report bugs to %s\n"
msgstr ""
-#: gprof.c:233
+#: gprof.c:235
#, c-format
msgid "%s: debugging not supported; -d ignored\n"
msgstr ""
-#: gprof.c:313
+#: gprof.c:315
#, c-format
msgid "%s: unknown file format %s\n"
msgstr ""
#. This output is intended to follow the GNU standards document.
-#: gprof.c:397
+#: gprof.c:399
#, c-format
msgid "GNU gprof %s\n"
msgstr ""
-#: gprof.c:398
+#: gprof.c:400
msgid ""
"Based on BSD gprof, copyright 1983 Regents of the University of California.\n"
msgstr ""
-#: gprof.c:399
+#: gprof.c:401
msgid ""
"This program is free software. This program has absolutely no warranty.\n"
msgstr ""
-#: gprof.c:440
+#: gprof.c:442
#, c-format
msgid "%s: unknown demangling style `%s'\n"
msgstr ""
-#: gprof.c:460
+#: gprof.c:462
#, c-format
msgid ""
"%s: Only one of --function-ordering and --file-ordering may be specified.\n"
msgstr ""
-#: gprof.c:560
+#: gprof.c:562
#, c-format
msgid "%s: sorry, file format `prof' is not yet supported\n"
msgstr ""
-#: gprof.c:621
+#: gprof.c:623
#, c-format
msgid "%s: gmon.out file is missing histogram\n"
msgstr ""
-#: gprof.c:628
+#: gprof.c:630
#, c-format
msgid "%s: gmon.out file is missing call-graph data\n"
msgstr ""
-#: hist.c:121
+#: hist.c:122
#, c-format
msgid "%s: `%s' is incompatible with first gmon file\n"
msgstr ""
-#: hist.c:137
+#: hist.c:138
#, c-format
msgid "%s: %s: unexpected EOF after reading %d of %d samples\n"
msgstr ""
-#: hist.c:350
+#: hist.c:351
#, c-format
msgid "%c%c/call"
msgstr ""
-#: hist.c:358
+#: hist.c:359
#, c-format
msgid ""
" for %.2f%% of %.2f %s\n"
"\n"
msgstr ""
-#: hist.c:364
+#: hist.c:365
#, c-format
msgid ""
"\n"
"Each sample counts as %g %s.\n"
msgstr ""
-#: hist.c:369
+#: hist.c:370
msgid ""
" no time accumulated\n"
"\n"
msgstr ""
-#: hist.c:376
+#: hist.c:377
msgid "cumulative"
msgstr ""
-#: hist.c:376
+#: hist.c:377
msgid "self "
msgstr ""
-#: hist.c:376
+#: hist.c:377
msgid "total "
msgstr ""
-#: hist.c:379
+#: hist.c:380
msgid "time"
msgstr ""
-#: hist.c:379
+#: hist.c:380
msgid "calls"
msgstr ""
-#: hist.c:468
+#: hist.c:469
msgid ""
"\n"
"\n"
@@ -479,10 +475,20 @@ msgid ""
"flat profile:\n"
msgstr ""
-#: hist.c:474
+#: hist.c:475
msgid "Flat profile:\n"
msgstr ""
+#: mips.c:75
+#, c-format
+msgid "[find_call] 0x%lx: jal"
+msgstr ""
+
+#: mips.c:100
+#, c-format
+msgid "[find_call] 0x%lx: jalr\n"
+msgstr ""
+
#: source.c:163
#, c-format
msgid "%s: could not locate `%s'\n"
@@ -493,7 +499,7 @@ msgstr ""
msgid "*** File %s:\n"
msgstr ""
-#: utils.c:94
+#: utils.c:96
#, c-format
msgid " <cycle %d>"
msgstr ""