Add org.gnu.gdb.i386.avx.
[deliverable/binutils-gdb.git] / sim / common / sim-profile.c
index ff53f71d775bc2decd80343f1ce62a83047b3a43..408f20591c4d87ab3248d961e1a264545f997c6e 100644 (file)
@@ -1,22 +1,22 @@
 /* Default profiling support.
-   Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 2000, 2001, 2007, 2008, 2009, 2010
+   Free Software Foundation, Inc.
    Contributed by Cygnus Support.
 
 This file is part of GDB, the GNU debugger.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "sim-main.h"
 #include "sim-io.h"
@@ -248,7 +248,7 @@ profile_option_handler (SIM_DESC sd,
                        char *arg,
                        int is_command)
 {
-  int cpu_nr,prof_nr;
+  int cpu_nr;
 
   /* FIXME: Need to handle `cpu' arg.  */
 
@@ -519,7 +519,7 @@ profile_pc_init (SIM_DESC sd)
          int bucket_size;
          /* fill in the frequency if not specified */
          if (PROFILE_PC_FREQ (data) == 0)
-           PROFILE_PC_FREQ (data) = 256;
+           PROFILE_PC_FREQ (data) = 257;
          /* fill in the start/end if not specified */
          if (PROFILE_PC_END (data) == 0)
            {
@@ -564,7 +564,7 @@ profile_pc_init (SIM_DESC sd)
                                + PROFILE_PC_NR_BUCKETS (data) - 1)
                               / PROFILE_PC_NR_BUCKETS (data));
              PROFILE_PC_SHIFT (data) = 0;
-             while (bucket_size < PROFILE_PC_BUCKET_SIZE (data))
+             while (bucket_size > PROFILE_PC_BUCKET_SIZE (data))
                {
                  PROFILE_PC_SHIFT (data) += 1;
                }
@@ -684,6 +684,12 @@ profile_print_pc (sim_cpu *cpu, int verbose)
          }
        /* 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));
@@ -694,6 +700,7 @@ profile_print_pc (sim_cpu *cpu, int verbose)
              sample = 0xffff;
            else
              sample = PROFILE_PC_COUNT (profile) [loop];
+           H2T (sample);
            ok = fwrite (&sample, sizeof (sample), 1, pf);
          }
        if (ok == 0)
This page took 0.02404 seconds and 4 git commands to generate.