/* trace.c --- tracing output for the M32C simulator.
-Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+Copyright (C) 2005-2020 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of the GNU simulators.
-The GNU simulators are free software; you can redistribute them and/or
-modify them under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+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 3 of the License, or
+(at your option) any later version.
-The GNU simulators are distributed in the hope that they 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.
+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 the GNU simulators; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA */
-
+along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include "config.h"
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include "cpu.h"
#include "mem.h"
#include "load.h"
+#include "trace.h"
static int
sim_dis_read (bfd_vma memaddr, bfd_byte * ptr, unsigned int length,
static bfd *current_bfd;
void
-sim_disasm_init (bfd *prog)
+sim_disasm_init (bfd * prog)
{
current_bfd = prog;
}
int i;
struct stat s;
const char *found_filename, *slash;
+ FILE *file;
found_filename = filename;
while (1)
files = f;
f->filename = strdup (filename);
f->data = (char *) malloc (s.st_size + 2);
- FILE *file = fopen (found_filename, "rb");
+ file = fopen (found_filename, "rb");
fread (f->data, 1, s.st_size, file);
f->data[s.st_size] = 0;
fclose (file);
}
void
-sim_disasm_one ()
+sim_disasm_one (void)
{
static int initted = 0;
static asymbol **symtab = 0;
if (s->flags & SEC_CODE || code_section == 0)
{
code_section = s;
- code_base = bfd_section_lma (current_bfd, s);
+ code_base = bfd_section_lma (s);
break;
}
}
slash++;
printf
("========================================"
- "=====================================\n");
+ "=====================================\n");
printf ("\033[37;41m %s:%d: \033[33;40m %s\033[K\033[0m\n",
slash, lineno, the_line);
}
sym = (min + max) / 2;
sa = bfd_asymbol_value (symtab[sym]);
/*printf("checking %4d %08x %s\n",
- sym, sa, bfd_asymbol_name (symtab[sym])); */
+ sym, sa, bfd_asymbol_name (symtab[sym])); */
if (sa > mypc)
max = sym;
else if (sa < mypc)