This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[Patch] gprof format patch
- To: gdb-patches at sources dot redhat dot com
- Subject: [Patch] gprof format patch
- From: Ben Elliston <bje at redhat dot com>
- Date: Fri, 9 Feb 2001 16:13:22 +1100
The following patch fixes the format of `gmon.out' files in the case
of the host and target systems having different byte order. Could
this patch please be approved?
2001-02-09 Ben Elliston <bje@redhat.com>
* (profile_print_pc): Write header out in target byte order.
Index: sim-profile.c
===================================================================
RCS file: /cvs/src/src/sim/common/sim-profile.c,v
retrieving revision 1.4
diff -u -r1.4 sim-profile.c
--- sim-profile.c 2000/12/03 04:23:54 1.4
+++ sim-profile.c 2001/02/09 05:10:26
@@ -1,5 +1,5 @@
/* Default profiling support.
- Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
Contributed by Cygnus Support.
This file is part of GDB, the GNU debugger.
@@ -684,6 +684,12 @@
}
/* size of sample buffer (+ header) */
header[2] = PROFILE_PC_NR_BUCKETS (profile) * 2 + sizeof (header);
+
+ /* Header must be written out in target byte order. */
+ H2T (header[0]);
+ H2T (header[1]);
+ H2T (header[2]);
+
ok = fwrite (&header, sizeof (header), 1, pf);
for (loop = 0;
ok && (loop < PROFILE_PC_NR_BUCKETS (profile));