From cab30d75a34782ea5ea0017238022da77494ce5f Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 7 Oct 1999 07:25:16 +0000 Subject: Update. 1999-10-07 Ulrich Drepper * debug/Makefile (install-bin): Add pcprofiledump and xtrace. Add rules for both programs. * debug/pcprofiledump.c: New file. * debug/xtrace.sh: New file. * debug/pcprofile.c: Allow creating output file. Add magic signature to let reader recognize file format. --- debug/pcprofile.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'debug/pcprofile.c') diff --git a/debug/pcprofile.c b/debug/pcprofile.c index b5dc4e709c..11447deb7d 100644 --- a/debug/pcprofile.c +++ b/debug/pcprofile.c @@ -18,7 +18,9 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include #include +#include #include #include @@ -39,10 +41,25 @@ install (void) if (outfile != NULL && *outfile != '\0') { - fd = open (outfile, O_RDWR); + fd = open (outfile, O_RDWR | O_CREAT, 0666); if (fd != -1) - active = 1; + { + uint32_t word; + + active = 1; + + /* Write a magic word which tells the reader about the byte + order and the size of the following entries. */ + word = 0xdeb00000 | sizeof (void *); + if (TEMP_FAILURE_RETRY (write (fd, &word, 4)) != 4) + { + /* If even this fails we shouldn't try further. */ + close (fd); + fd = -1; + active = 0; + } + } } } -- cgit v1.2.3