/* Default profiling support.
- Copyright (C) 1996-2020 Free Software Foundation, Inc.
+ Copyright (C) 1996-2021 Free Software Foundation, Inc.
Contributed by Cygnus Support.
This file is part of GDB, the GNU debugger.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+/* This must come before any other includes. */
+#include "defs.h"
+
#include "sim-main.h"
#include "sim-io.h"
#include "sim-options.h"
#include "sim-assert.h"
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
-
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
#include <ctype.h>
#if !WITH_PROFILE_PC_P
\f
/* Profiling output hooks. */
-static void
+static void ATTRIBUTE_PRINTF (3, 0)
profile_vprintf (SIM_DESC sd, sim_cpu *cpu, const char *fmt, va_list ap)
{
FILE *fp = PROFILE_FILE (CPU_PROFILE_DATA (cpu));
sim_io_evprintf (sd, fmt, ap);
}
-__attribute__ ((format (printf, 3, 4)))
+ATTRIBUTE_PRINTF (3, 4)
static void
profile_printf (SIM_DESC sd, sim_cpu *cpu, const char *fmt, ...)
{
{
/* nr_buckets = (full-address-range / 2) / (bucket_size / 2) */
PROFILE_PC_NR_BUCKETS (data) =
- ((1 << sizeof (sim_cia) * (8 - 1))
+ ((1ULL << sizeof (sim_cia) * (8 - 1))
/ (PROFILE_PC_BUCKET_SIZE (data) / 2));
}
else
{
if (PROFILE_PC_END (data) == 0)
/* bucket_size = (full-address-range / 2) / (nr_buckets / 2) */
- bucket_size = ((1 << ((sizeof (sim_cia) * 8) - 1))
+ bucket_size = ((1ULL << ((sizeof (sim_cia) * 8) - 1))
/ (PROFILE_PC_NR_BUCKETS (data) / 2));
else
bucket_size = ((PROFILE_PC_END (data)
#if WITH_PROFILE_MODEL_P
|| PROFILE_FLAGS (data) [PROFILE_MODEL_IDX]
#endif
-#if WITH_PROFILE_SCACHE_P && WITH_SCACHE
+#if WITH_PROFILE_SCACHE_P && WITH_SCACHE && defined(CGEN_ARCH)
|| PROFILE_FLAGS (data) [PROFILE_SCACHE_IDX]
#endif
#if WITH_PROFILE_PC_P
profile_print_model (cpu, verbose);
#endif
-#if WITH_PROFILE_SCACHE_P && WITH_SCACHE
+#if WITH_PROFILE_SCACHE_P && WITH_SCACHE && defined(CGEN_ARCH)
if (PROFILE_FLAGS (data) [PROFILE_SCACHE_IDX])
scache_print_profile (cpu, verbose);
#endif
}
\f
-/* Install profiling support in the simulator. */
+/* Provide a prototype to silence -Wmissing-prototypes. */
+SIM_RC sim_install_profile (SIM_DESC sd);
+/* Install profiling support in the simulator. */
SIM_RC
-profile_install (SIM_DESC sd)
+sim_install_profile (SIM_DESC sd)
{
int i;