|
Packit Service |
97d2fb |
/* Support to debug branch prediction.
|
|
Packit Service |
97d2fb |
Copyright (C) 2007 Red Hat, Inc.
|
|
Packit Service |
97d2fb |
This file is part of elfutils.
|
|
Packit Service |
97d2fb |
Written by Ulrich Drepper <drepper@redhat.com>, 2007.
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
This file is free software; you can redistribute it and/or modify
|
|
Packit Service |
97d2fb |
it under the terms of the GNU General Public License as published by
|
|
Packit Service |
97d2fb |
the Free Software Foundation; either version 3 of the License, or
|
|
Packit Service |
97d2fb |
(at your option) any later version.
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
elfutils is distributed in the hope that it will be useful, but
|
|
Packit Service |
97d2fb |
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
97d2fb |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
97d2fb |
GNU General Public License for more details.
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
You should have received a copy of the GNU General Public License
|
|
Packit Service |
97d2fb |
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
#include <stdio.h>
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
#if DEBUGPRED
|
|
Packit Service |
97d2fb |
extern const unsigned long int __start_predict_data;
|
|
Packit Service |
97d2fb |
extern const unsigned long int __stop_predict_data;
|
|
Packit Service |
97d2fb |
extern const unsigned long int __start_predict_line;
|
|
Packit Service |
97d2fb |
extern const char *const __start_predict_file;
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
static void
|
|
Packit Service |
97d2fb |
__attribute__ ((destructor))
|
|
Packit Service |
97d2fb |
predprint (void)
|
|
Packit Service |
97d2fb |
{
|
|
Packit Service |
97d2fb |
const unsigned long int *s = &__start_predict_data;
|
|
Packit Service |
97d2fb |
const unsigned long int *e = &__stop_predict_data;
|
|
Packit Service |
97d2fb |
const unsigned long int *sl = &__start_predict_line;
|
|
Packit Service |
97d2fb |
const char *const *sf = &__start_predict_file;
|
|
Packit Service |
97d2fb |
while (s < e)
|
|
Packit Service |
97d2fb |
{
|
|
Packit Service |
97d2fb |
if (s[0] != 0 || s[1] != 0)
|
|
Packit Service |
97d2fb |
printf ("%s:%lu: wrong=%lu, correct=%lu%s\n", *sf, *sl, s[0], s[1],
|
|
Packit Service |
97d2fb |
s[0] > s[1] ? " <==== WARNING" : "");
|
|
Packit Service |
97d2fb |
++sl;
|
|
Packit Service |
97d2fb |
++sf;
|
|
Packit Service |
97d2fb |
s += 2;
|
|
Packit Service |
97d2fb |
}
|
|
Packit Service |
97d2fb |
}
|
|
Packit Service |
97d2fb |
#endif
|